calc_2x2_res_table: Calculate agreement statistics for a 2 x 2 table

View source: R/calc_2x2_res_table.R

calc_2x2_res_tableR Documentation

Calculate agreement statistics for a 2 x 2 table

Description

I have opinions about what statistics should be reported along with kappa when asssessing agreement between two raters. The chosen stats are based on the advice in paper a paper by reference needed.

Usage

calc_2x2_res_table(table, has_gold_std = FALSE)

Arguments

table

A table

has_gold_std

Logical; TRUE will show the sensitivity and specificity using rater __ as the gold standard. FALSE assumes there is no gold standard and calculated the proportions of positive and negative agreement instead.

Value

A tibble or data frame

Examples

## Example 1 ----------------

foo <- matrix(c(20.61, 1.52, 9.58, 68.29), ncol = 2, byrow = TRUE)
foo <- as.table(100 * foo)
foo

calc_2x2_res_table(table = foo, has_gold_std = FALSE)
calc_2x2_res_table(table = foo, has_gold_std = TRUE)

## Example 2 ----------------

df <- tibble::tribble(
  ~a, ~b, ~c,
  1L, 1L, 1L,
  0L, 1L, 1L,
  1L, 1L, 0L,
  0L, 1L, 0L,
  1L, 1L, 1L,
  0L, 1L, 1L,
  1L, 1L, 0L
)

bar <- lamisc::make_table(data = df,
                          x = a,
                          x_lvls = c("1", "0"),
                          y = b,
                          y_lvls = c("1", "0"))

calc_2x2_res_table(table = bar, has_gold_std = FALSE)
calc_2x2_res_table(table = bar, has_gold_std = TRUE)

emilelatour/lamisc documentation built on April 9, 2024, 10:33 a.m.