Description Usage Arguments Details Value Author(s) References See Also Examples
A kappa-like measure for multinomial models
1 | kappa_multinomial(obs, pred, nsim = 1000)
|
obs |
a data.frame with class obervations with n columns and m rows; each row represents a sample, the columns represent the classes of outcomes. |
pred |
a data.frame with class predictions with n columns and m rows; each rows represents a sample, the columns represent the classes of outcomes. |
nsim |
to be passed to the null model if null model is computed based on randmization. nsim represents the number of randomizations |
kappa_multinomial is caclulated from two components: kappa_loc and kappa_prob. For details see Douma et al 2017.
obs and pred should contain probabilities or discrete outcomes (0 or 1).
The null model is calculated analytically when observations are discrete and calculated by randomzation otherwise.
returns a list with the following elements:
Kappa_prob
Kappa_loc
Kappa_multinomial
p0
pe
pmax
Bob Douma
Douma et al 2017 Journal of Biogeography
cohen.kappa
for Cohen's Kappa
1 2 3 4 5 6 | # generate multinomial probabilties with four classes
pred = data.frame(gtools::rdirichlet(100, c(0.1,0.1,0.5,0.5)))
# generate multinomial observations with four classes
obs = data.frame(t(apply(pred,1,rmultinom,size=1,n=1)))
# calculate kappa multinomial
kappa_multinomial(obs=obs,pred=pred)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.