Function for Interrater Reliability.
Usage
agreement(
data,
vars,
sft = FALSE,
showText = FALSE,
wght = "unweighted",
exct = FALSE,
kripp = FALSE,
krippMethod = "nominal",
bootstrap = FALSE,
showSummary = FALSE,
showAbout = FALSE
)
Arguments
- data
The data as a data frame. The data should be in long format, where each row is a unique observation.
- vars
A string naming the variable from
data
that contains the diagnosis given by the observer, variable can be categorical or ordinal.- sft
Display frequency tables showing the distribution of ratings for each rater. Useful for understanding rating patterns and identifying potential biases.
- showText
Display simple preformatted text version of frequency tables. Provides a plain-text alternative to the HTML formatted tables.
- wght
For ordinal variables (e.g., tumor grade G1/G2/G3), weighted kappa accounts for degree of disagreement. Linear weights: Adjacent disagreements (G1 vs G2) receive partial credit. Squared weights: Larger disagreements (G1 vs G3) are penalized more heavily. Use 'Unweighted' for nominal categories with no inherent order.
- exct
Use exact p-value calculation instead of normal approximation. Recommended for small sample sizes (< 30 cases) with 3 or more raters. Note: Not applicable for 2-rater analysis (use Cohen's kappa).
- kripp
Alternative reliability measure that handles missing data and supports various data types. Useful when raters didn't rate all cases or when comparing different measurement levels.
- krippMethod
Specifies the measurement level for Krippendorff's alpha calculation.
- bootstrap
Calculate bootstrap confidence intervals for Krippendorff's alpha.
- showSummary
Display a natural-language interpretation of results with color-coded agreement levels and clinical guidance. Recommended for reports and presentations.
- showAbout
Display an explanatory panel describing what this analysis does, when to use it, and how to interpret results.
Value
A results object containing:
results$welcome | a html | ||||
results$irrtable | a table | ||||
results$text2 | a html | ||||
results$text | a preformatted | ||||
results$krippTable | a table | ||||
results$weightedKappaGuide | a html | ||||
results$summary | a html | ||||
results$about | a html |
Tables can be converted to data frames with asDF
or as.data.frame
. For example:
results$irrtable$asDF
as.data.frame(results$irrtable)