Skip to contents

Estimates Fleiss and Brennan-Prediger weighted agreement coefficients for counts-format data: each row is one subject, each column is a category, and `x[i, k]` is the number of raters who assigned subject `i` to category `k`. Row sums (number of raters per subject) need not be uniform across subjects.

The count-format moment estimator follows the Fleiss-Cuzick unequal-judges convention: observed row disagreement is weighted by `r_i - 1`, and chance disagreement uses the pooled rating-token margin. This differs from the unit-weighted distribution/count convention used by some software. The unit-weighted comparator is kept only in the C++ API for validation studies.

Rows with fewer than two observed ratings contain no within-subject pair information and receive zero observed-disagreement weight. At least one row with two or more ratings is required.

Counts data discards rater identity, so all counts estimators impose exchangeability. The categorical count-FIML model treats full count compositions as exchangeable iid rater draws. The compound-symmetry estimators (`"nt_fiml"` and the moment estimator `"fleiss_cuzick"`) fit the corresponding common-mean, compound-symmetry scored model \(\Sigma = \psi J + e I\). For non-exchangeable raters, use rater-identified data and `kappa()` instead.

The quadratic compound-symmetry likelihood estimator (`"nt_fiml"`) works **directly on the counts**: each subject contributes only the sufficient statistics \((m_i, \sum_c n_{ic} v_c, \sum_c n_{ic} v_c^2)\) of its observed ratings, so no realizing subjects-by-raters table is constructed. The coefficients are the `r_total`-invariant maps \(\kappa_{\mathrm{Fleiss}} = \psi/(\psi+e)\) and \(\kappa_{\mathrm{BP}} = 1 - 2e/c_{\mathrm{BP}}\), and every route returns robust (sandwich) standard errors.

To obtain counts from a rater-identified subjects-by-raters matrix, use [ratings_to_counts()]. Chaining it into `estimator = "cat_fiml"` fits the exchangeable categorical count-FIML.

Conger is not reported (raters are not identified in this input format), and neither IPW nor Gwet are meaningful (per-rater observation rates are aggregated away by the counts representation).

Usage

kappa_counts(
  x,
  estimator = c("fleiss_cuzick", "cat_fiml", "nt_fiml"),
  weight = c("nominal", "linear", "quadratic"),
  values = NULL,
  r_total = NULL,
  em_options = list()
)

Arguments

x

A subjects-by-categories non-negative integer matrix.

estimator

One of `"fleiss_cuzick"` (the Fleiss-Cuzick count-format moment estimator, the available-case / moment member of the compound-symmetry family), `"cat_fiml"` (EM over the composition simplex with multivariate hypergeometric weights for completing partial counts), or `"nt_fiml"` (the exchangeable common-mean normal FIML, `weight = "quadratic"` only, the efficient ignorable-missingness MLE). All agree when every row of `x` sums to `r_total`. With partial counts (some `r_i < r_total`) `"cat_fiml"` and `"nt_fiml"` are the efficient routes and `"fleiss_cuzick"` is the consistent-under-MCAR moment estimator. For a complete-case (listwise) analysis, drop the incomplete rows yourself and pass the result to any estimator.

weight

Weighting scheme: `"nominal"` (default), `"linear"`, or `"quadratic"`. The `"nt_fiml"` estimator requires `"quadratic"`.

values

Optional length-C numeric vector of category scores used by the metric weightings. Defaults to `1:C`.

r_total

Total number of raters per subject. Defaults to the maximum observed row sum. Required for `"cat_fiml"` when rows have varying totals and the maximum observed total is not the design total. `"fleiss_cuzick"` and `"nt_fiml"` are `r_total`-invariant.

em_options

Named list of EM/optimiser options. For `estimator = "cat_fiml"`: `tol`, `max_iter`, `prune_tol`, `start_alpha`, `info_rcond`. The raw-data `flatten` option does not apply there: count-data categorical FIML fits a low-dimensional composition model, not the saturated joint. For `estimator = "nt_fiml"`: `tol` and `max_iter` tune the optimiser. `mean` and `covariance`, if supplied, must be the exchangeable common-mean compound-symmetry model.

Value

A `misskappa_estimate` object with `Fleiss` and `Brennan-Prediger` coefficients, the 2x2 vcov, a `psi` component, and the registered `stats::influence` method.

Details

Older Krippendorff / irrCAC-style categorical schemes (`"ordinal"`, `"radical"`, `"ratio"`, `"circular"`, `"bipolar"`) remain available only through unsupported internal helpers and the C++ `misskappa::loss` factories. They are retained for validation and parity work, not as part of the recommended R interface.

References

Moss, J. (in preparation). *Quadratically weighted agreement coefficients.* Working paper (quadratic); citation to be updated on preprint and publication.

Krippendorff, K. (2011). Computing Krippendorff's alpha-reliability.

Gwet, K. L. (2019). irrCAC: Computing chance-corrected agreement coefficients among raters.

Examples

# Fleiss (1971) psychiatric diagnoses: 30 subjects, 6 raters, 5 categories,
# in counts format (one row per subject, one column per category).
kappa_counts(dat.fleiss1971, estimator = "fleiss_cuzick")
#> misskappa: estimator=fleiss_cuzick, weight=nominal
#>                  estimate     se  lower  upper
#> Fleiss             0.4302 0.0533 0.3258 0.5347
#> Brennan-Prediger   0.4444 0.0542 0.3382 0.5507

# Treat the categories as ordered scores with a quadratic loss.
kappa_counts(dat.fleiss1971, estimator = "fleiss_cuzick", weight = "quadratic")
#> misskappa: estimator=fleiss_cuzick, weight=quadratic
#>                  estimate     se  lower  upper
#> Fleiss             0.2841 0.1093 0.0698 0.4983
#> Brennan-Prediger   0.3339 0.1019 0.1342 0.5336

# Exchangeable common-mean compound-symmetry FIML, fit directly on the
# per-subject counts (the count-format counterpart of "nt_fiml_cs").
kappa_counts(dat.fleiss1971, estimator = "nt_fiml", weight = "quadratic")
#> misskappa: estimator=nt_fiml, weight=quadratic, covariance=variance_components, mean=equal
#>                  estimate     se  lower  upper
#> Fleiss             0.2841 0.1093 0.0698 0.4983
#> Brennan-Prediger   0.3339 0.1019 0.1342 0.5336