| Title: | Design and Analysis of Consistency Tests Based on Kappa Statistic |
|---|---|
| Description: | Provides a 'Shiny' application and supporting functions for the design and analysis of consistency tests based on Kappa statistic with categorical responses. Wraps 'irr' and 'kappaSize' packages. |
| Authors: | Gai Zheng [aut, cre], Xincheng Li [aut], Yingjie Jiangwang [aut], Panwei Zhao [aut] |
| Maintainer: | Gai Zheng <[email protected]> |
| License: | CC0 |
| Version: | 0.1.0 |
| Built: | 2026-06-02 19:03:01 UTC |
| Source: | https://github.com/cran/catekappa |
CATEKAPPA (Categorical Agreement Test Evaluation) provides a Shiny interactive application and supporting functions for the design and analysis of categorical agreement tests.
This package wraps the core functionality of the irr and
kappaSize packages:
Design stage: Use calc_sample_size_kappa to
calculate sample size, supporting 2–5 categories and 2+ raters.
Analysis stage: Use analyze_kappa to compute
Cohen's, Fleiss', and Light's Kappa statistics.
Interactive app: Use run_cate_app to launch
the Shiny interface.
Gai Zheng [email protected] Xincheng Li [email protected] Yingjie Jiangwang [email protected] Panwei Zhao [email protected]
run_cate_app, calc_sample_size_kappa,
analyze_kappa
Analyze consistency between raters using Cohen's, Fleiss', or Light's Kappa. Wraps functions from the irr package.
analyze_kappa(data, type = "cohen", detail = FALSE)analyze_kappa(data, type = "cohen", detail = FALSE)
data |
A data frame or matrix with subjects as rows and raters as columns. |
type |
Type of kappa: "cohen" (2 raters), "fleiss" (3+ raters), or "light" (3+ raters, pairwise). |
detail |
Logical. If TRUE, returns detailed output including individual scores. |
A list with kappa results, interpretation, and data summary.
data <- data.frame( Rater1 = c("Yes", "No", "Yes", "Yes", "No"), Rater2 = c("Yes", "No", "Yes", "No", "No") ) analyze_kappa(data, type = "cohen")data <- data.frame( Rater1 = c("Yes", "No", "Yes", "Yes", "No"), Rater2 = c("Yes", "No", "Yes", "No", "No") ) analyze_kappa(data, type = "cohen")
Calculate required sample size for consistency tests. Directly wraps kappaSize::PowerBinary / Power3Cats / Power4Cats / Power5Cats.
calc_sample_size_kappa( kappa0 = 0.4, kappa1 = 0.6, props = c(0.5, 0.5), alpha = 0.05, power = 0.8, raters = 2 )calc_sample_size_kappa( kappa0 = 0.4, kappa1 = 0.6, props = c(0.5, 0.5), alpha = 0.05, power = 0.8, raters = 2 )
kappa0 |
Null hypothesis value of kappa (H0). |
kappa1 |
Alternative hypothesis value of kappa (H1). |
props |
Expected proportions of categories. Must sum to 1. |
alpha |
Significance level. Default 0.05. |
power |
Desired power. Default 0.8. |
raters |
Number of raters (>=2). Default 2. |
A list with sample size n and parameters.
calc_sample_size_kappa(kappa0 = 0.4, kappa1 = 0.6, props = c(0.5, 0.5)) calc_sample_size_kappa(kappa0 = 0.4, kappa1 = 0.6, props = c(0.6, 0.3, 0.1), raters = 3)calc_sample_size_kappa(kappa0 = 0.4, kappa1 = 0.6, props = c(0.5, 0.5)) calc_sample_size_kappa(kappa0 = 0.4, kappa1 = 0.6, props = c(0.6, 0.3, 0.1), raters = 3)
Interpret the strength of agreement based on Landis and Koch criteria.
interpret_kappa(kappa)interpret_kappa(kappa)
kappa |
Numeric value of Kappa statistic. |
A named list with level, description, and color code.
interpret_kappa(0.3) interpret_kappa(0.75)interpret_kappa(0.3) interpret_kappa(0.75)
Given a fixed sample size, estimate the lower confidence bound. Wraps kappaSize::FixedNBinary / FixedN3Cats / FixedN4Cats / FixedN5Cats.
kappa_fixed_n(n, kappa0 = 0.4, props = c(0.5, 0.5), alpha = 0.05, raters = 2)kappa_fixed_n(n, kappa0 = 0.4, props = c(0.5, 0.5), alpha = 0.05, raters = 2)
n |
Sample size. |
kappa0 |
Anticipated value of kappa. |
props |
Category proportions. |
alpha |
Significance level. |
raters |
Number of raters. |
List with kappaSize raw result and parameters.
Print Method for cate_analysis Objects
## S3 method for class 'cate_analysis' print(x, ...)## S3 method for class 'cate_analysis' print(x, ...)
x |
An object of class cate_analysis. |
... |
Additional arguments. |
Print Method for cate_design Objects
## S3 method for class 'cate_design' print(x, ...)## S3 method for class 'cate_design' print(x, ...)
x |
An object of class cate_design. |
... |
Additional arguments. |
Print Method for cate_fixed_n Objects
## S3 method for class 'cate_fixed_n' print(x, ...)## S3 method for class 'cate_fixed_n' print(x, ...)
x |
An object of class cate_fixed_n. |
... |
Additional arguments. |
Launch the Shiny application for design and analysis of consistency tests based on Kappa statistic with categorical responses.
run_cate_app( port = getOption("shiny.port"), launch.browser = getOption("shiny.launch.browser", interactive()), host = getOption("shiny.host", "127.0.0.1") )run_cate_app( port = getOption("shiny.port"), launch.browser = getOption("shiny.launch.browser", interactive()), host = getOption("shiny.host", "127.0.0.1") )
port |
The TCP port for the application. Defaults to random available port. |
launch.browser |
Logical. Whether to launch browser automatically. |
host |
The IPv4 address to listen on. |
A Shiny application object (invisible).
if(interactive()){ run_cate_app() }if(interactive()){ run_cate_app() }
Summary Method for cate_analysis Objects
## S3 method for class 'cate_analysis' summary(object, ...)## S3 method for class 'cate_analysis' summary(object, ...)
object |
An object of class cate_analysis. |
... |
Additional arguments. |