calc_agree_mat: Calculate an agreement matrix

View source: R/calc-agreement-mat.R

calc_agree_matR Documentation

Calculate an agreement matrix

Description

Create an n x q agreement matrix representing the distribution of raters by subjects (n) and category (q)

Usage

calc_agree_mat(data, ..., subject_id = NULL)

Arguments

data

A tbld_df or data.frame

...

Columns (unquoted) with the "ratings" done by the raters. Follows the argument methodology from dplyr::select.

subject_id

Optional. Name of the column (unquoted) that contains the IDs for the subjects or units being rated.

Value

An n x q table

References

  1. Handbook of Inter-Rater Reliability: The Definitive Guide to Measuring the Extent of Agreement Among Raters. 4th ed. Gaithersburg, MD: Advanced Analytics.

Examples

# See Gwet page 72
# Classification of 12 subjects by 4 raters into 5 categories

library(dplyr)
library(tibble)

table_215 <- tibble::tribble(
  ~unit, ~rater_1, ~rater_2, ~rater_3, ~rater_4,
  1,      "a",      "a",       NA,      "a",
  2,      "b",      "b",      "c",      "b",
  3,      "c",      "c",      "c",      "c",
  4,      "c",      "c",      "c",      "c",
  5,      "b",      "b",      "b",      "b",
  6,      "a",      "b",      "c",      "d",
  7,      "d",      "d",      "d",      "d",
  8,      "a",      "a",      "b",      "a",
  9,      "b",      "b",      "b",      "b",
  10,       NA,      "e",      "e",      "e",
  11,       NA,       NA,      "a",      "a",
  12,       NA,       NA,      "c",       NA
)

calc_agree_mat(data = table_215, 
               dplyr::starts_with("rater"))
calc_agree_mat(data = table_215, 
               dplyr::starts_with("rater"), 
               subject_id = "unit")


emilelatour/lagree documentation built on Sept. 18, 2024, 5:19 p.m.