simulKappa: Simulate rating data and calculate agreement with gold...

View source: R/kappa.R

simulKappaR Documentation

Simulate rating data and calculate agreement with gold standard

Description

The function generates simulation data according to given categories and probabilities. and can repeatedly apply function kappam_gold(). Currently, there is no variation in probabilities from rater to rater, only sampling variability from multinomial distribution is at work.

Usage

simulKappa(nRater, cats, nSubj, probs, mcSim = 10, simOnly = FALSE)

Arguments

nRater

numeric. number of raters.

cats

categories specified either as character vector or just the numbers of categories.

nSubj

numeric. number of subjects per gold standard category. Either a single number or as vector of numbers per category, e.g. for non-balanced situation.

probs

numeric square matrix (nCat x nCat) with classification probabilities. Row i has probabilities of rater categorization for subjects of category i (gold standard).

mcSim

numeric. Number of Monte-Carlo simulations.

simOnly

logical. Need only simulation data? Default is FALSE.

Details

This function is future-aware for the repeated evaluation of kappam_gold() that is triggered by this function.

Value

dataframe of kappa-gold on the simulated datasets or (when simOnly=TRUE) list of length mcSim with each element a simulated data set with goldrating in first column and then the raters.

Examples

# repeatedly estimate agreement with goldstandard for simulated data
simulKappa(nRater = 8, cats = 3, nSubj = 11,
           # assumed prob for classification by raters
           probs = matrix(c(.6, .2, .1, # subjects of cat 1
                            .3, .4, .3, # subjects of cat 2
                            .1, .4, .5  # subjects of cat 3
           ), nrow = 3, byrow = TRUE))



kappaGold documentation built on April 4, 2025, 1:02 a.m.