Skip to contents

Averages the marginal positive rates of the two raters.

Usage

grass_prevalence(
  data,
  format = c("wide", "matrix", "long", "paired"),
  positive = NULL,
  ...
)

Arguments

data

Input data. Form depends on format:

  • "matrix" – a 2x2 integer count matrix with R1 rows, R2 columns.

  • "wide" – a data.frame with exactly two rater columns (or pass rater_cols = c("r1", "r2") if the data contains extra columns).

  • "long" – a data.frame with subject, rater, and rating columns (names configurable via subject =, rater =, rating =). Must contain exactly two distinct raters.

  • "paired" – a list of two equal-length rating vectors, a 2-column matrix, or a 2-column data.frame.

format

One of "matrix", "wide", "long", "paired".

positive

Optional character string naming the level to treat as the positive (=1) class. Defaults to "yes" if present among levels, then "1" / "true" / "positive" / "case", then first-encountered.

...

Format-specific arguments: rater_cols for "wide"; subject, rater, rating for "long".

Value

A single numeric in [0, 1].

Examples

tab <- matrix(c(88, 10, 14, 88), nrow = 2,
              dimnames = list(R1 = c("0", "1"), R2 = c("0", "1")))
grass_prevalence(tab, format = "matrix")
#> [1] 0.5