View source: R/calc-ac_table.R
calc_ac_table | R Documentation |
This function calculates agreement coefficients, including Gwet's AC, Fleiss' kappa, and others, when input dataset is a contingency table. It supports various weight types and hypothesis testing options.
calc_ac_table(
table,
weights = "unweighted",
categ = NULL,
conf_lev = 0.95,
N = Inf,
test_value = 0,
alternative = "two.sided",
show_weights = FALSE
)
table |
A q×q matrix (or contingency table) showing the distribution of subjects by rater, where q is the number of categories. This is the only argument you must specify if you want the unweighted analysis |
weights |
The type of weighting to apply. One of "unweighted", "quadratic", "linear", "ordinal", "radical", "ratio", "circular", "bipolar", or a custom matrix of weights. |
categ |
Optional. A vector of category labels. If not provided, the function will extract unique categories from the data. |
conf_lev |
Confidence level for confidence intervals (default is 0.95). |
N |
Population size for finite population correction (default is Inf). |
test_value |
Hypothesis test value (default is 0). |
alternative |
The type of alternative hypothesis. One of "two.sided", "less", or "greater". |
show_weights |
Logical whether to show the weights matric with the results. Default is FALSE. |
A list containing:
summary |
A summary of the subjects, raters, and categories. |
ac_table |
A table with calculated agreement coefficients. |
hypothesis |
A string describing the hypothesis test. |
#### Example 2 --------------------------------
(ratings <- matrix(c(118, 5,
2, 0), ncol = 2, byrow = TRUE))
calc_ac_table(table = ratings)
calc_ac_table(table = ratings,
test_value = 0.67,
alternative = "greater")
calc_ac_table(table = ratings,
test_value = 0.67,
alternative = "less")
#### Example 3 --------------------------------
(ratings <- matrix(c(45, 15,
25, 15), ncol = 2, byrow = TRUE))
calc_ac_table(table = ratings)
(ratings <- matrix(c(25, 35,
5, 35), ncol = 2, byrow = TRUE))
calc_ac_table(table = ratings)
#### Example 4 --------------------------------
(ratings <- matrix(c(1, 15, 1,
3, 0, 3,
2, 3, 2), ncol = 3, byrow = TRUE))
calc_ac_table(table = ratings,
weights = "quadratic",
show_weights = TRUE)
(ratings <- matrix(c(1, 1, 1,
3, 17, 3,
2, 0, 2), ncol = 3, byrow = TRUE))
calc_ac_table(table = ratings,
weights = "quadratic",
show_weights = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.