grass_compute: Compute the full inter-rater agreement panel

View source: R/compute.R

grass_computeR Documentation

Compute the full inter-rater agreement panel

Description

Computes Cohen's kappa, PABAK, Gwet's AC1, positive and negative agreement, Byrt prevalence and bias indices, and two confidence intervals for kappa (Wald, and a logit-transformed Wilson-type interval).

Usage

grass_compute(
  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 grass_metrics S3 object.

Deprecated

grass_compute() is deprecated in grass 0.2.0. The new headline API is grass_report(ratings = Y) returning a grass_card object. The full coefficient panel is available via summary() or as.data.frame(). See vignette("grassr") and grass_report().

Examples

# 2x2 counts (Cohen 1960 Table 1)
tab <- matrix(c(88, 10, 14, 88), nrow = 2,
              dimnames = list(R1 = c("0", "1"), R2 = c("0", "1")))
grass_compute(tab, format = "matrix")

# Paired vectors
r1 <- c(1, 1, 0, 0, 1, 0, 1)
r2 <- c(1, 0, 0, 0, 1, 1, 1)
grass_compute(list(r1, r2), format = "paired")

grassr documentation built on Sept. 22, 2026, 5:08 p.m.