*! version 1.1.7 02may2023

Title

cohenkap -- Kappa and Weighted kappa

Syntax

cohenkap varnameY varnameX
[, options]

Immediate command

cohenkapi #n11 #n12 ... #n1k \ #n21 #n22 ... #n2k \ ... \ #nk1 #nk2 ... #nkk [, options]

Main
ordered ordered categories; by default categories are not ordered

level(#) confidence level (%); default is level(95)

nst(string) name of the study (label)

2x2 tables only
wilson calculate Wilson confidence intervals; the default

exact calculate exact confidence intervals

wald calculate Wald confidence intervals

by is allowed; see [D] by.

Description

Kappa and Weighted kappa.

| Rating X | Rating X

Rating Y | 1(-)| 2(+) Rating Y | 1 | 2 | ... | k

+-----+-----
+-----+-----+-----+-----

1(-) | n11 | n12 1 | n11 | n12 | ... | n1k

2(+) | n21 | n22 2 | n21 | n22 | ... | n2k

+-----+----- . | ... | ... | ... | ...

k | nk1 | nk2 | ... | nkk

+-----+-----+-----+-----

The command needs two variables with the values for each rater to compute the results.

cohenkapi is the immediate form of
cohenkap; see immed. The immediate command needs k numlists, one for each category, separated by '\'.

You can click here to pop up a dialog or type db cohenkap. For the
immediate command, you can click here to pop up a dialog or type db conhenkapi.

Execute net from http://metodo.uab.cat/stata for install.

It is important to keep the commands updated. Execute adoupdate cohenkap, update to update the cohenkap command.

Execute adoupdate, update to update all the user-written commands.

If you find any bugs or want to suggest any improvements, please send an e-mail to: leam@uab.cat.

Examples

. use http://metodo.uab.cat/stata/kappa_data.dta

. cohenkap Rating2 Rating1, ordered

. cohenkapi 15 4 2 0 \ 5 16 4 1 \ 3 6 18 6 \ 1 2 3 14, ordered

. cohenkap QoL2 QoL1, nst(Study name)

. cohenkapi 25 63 0 3 \ 0 0 0 0 \ 7 122 0 40 \ 1 21 0 66, nst(Study name)

. cohenkap RatingY RatingX

. cohenkapi 171 1 \ 19 9

Stored results

The command stores the following in r():

Scalars

r(level) confidence level of confidence intervals

k>2 ordered categories

r(po_u) observed agreement, unweighted

r(kappa_u) kappa, unweighted

r(se0_u) standard error 0, unweighted

r(se1_u) standard error 1, unweighted

r(p_u) significance, unweighted

r(lb_u) lower bound of confidence interval, unweighted

r(ub_u) upper bound of confidence interval, unweighted

r(po_l) observed agreement, lineal weight

r(kappa_l) kappa, lineal weight

r(se0_l) standard error 0, lineal weight

r(se1_l) standard error 1, lineal weight

r(p_l) significance, lineal weight

r(lb_l) lower bound of confidence interval, lineal weight

r(ub_l) upper bound of confidence interval, lineal weight

r(po_q) observed agreement, lineal weight

r(kappa_q) kappa, quadratic weight

r(se0_q) standard error 0, quadratic weight

r(se1_q) standard error 1, quadratic weight

r(p_q) significance, quadratic weight

r(lb_q) lower bound of confidence interval, quadratic weight

r(ub_q) upper bound of confidence interval, quadratic weight

k>2 not ordered categories

r(po) observed agreement

r(kappa) kappa

r(se0) standard error 0

r(se1) standard error 1

r(p) significance

r(lb) lower bound of confidence interval

r(ub) upper bound of confidence interval

k==2 categories

r(kappa) kappa

r(se0) standard error 0

r(se1) standard error 1

r(p) significance

r(lb) lower bound of confidence interval

r(ub) upper bound of confidence interval

r(agr_p) specific agreement (+)

r(lb_agr_p) lower bound of specific agreement (+) confidence interval

r(ub_agr_p) upper bound of specific agreement (+) confidence interval

r(agr_n) specific agreement (-)

r(lb_agr_n) lower bound of specific agreement (-) confidence interval

r(ub_agr_n) upper bound of specific agreement (-) confidence interval

r(agr) global agreement

r(lb_agr) lower bound of global agreement confidence interval

r(ub_agr) upper bound of global agreement confidence interval

r(kappa_min) kappa minimum

r(kappa_max) kappa maximum

r(obs_dis_p) observed disagreement X-Y+

r(obs_dis_n) observed disagreement X+Y-

r(bias) bias index

r(bak) bias adjusted kappa (BAK)

r(obs_agr_p) observed agreement (+)

r(obs_agr_n) observed agreement (-)

r(pi) prevalence index

r(bak) prev. & bias adjusted kappa (PABAK)

Matrices

r(Categories) Categories results for k>2 not ordered

Version

Version 1.1.7 -- 02 May 2023

Authors

JM.Doménech

Programmer: R.Sesma

Laboratori d'Estadística Aplicada

Universitat Autònoma de Barcelona

leam@uab.cat

Vancouver reference

Doménech JM. Weighted kappa: User-written command cohenkap for Stata [computer program].

V1.1.7. Bellaterra: Universitat Autònoma de Barcelona; 2023.

Available executing from Stata: net from http://metodo.uab.cat/stata

References

Byrt T, Bishop J, Carlin JB. Bias, prevalence and kappa. J Clin Epidemiol. 1993; 46(5):423-9.

Cicchetti D, Feinstein AR. High agreement but low kappa: II. Resolving the paradoxes. J Clin Epidemiol. 1990; 43:551-8.

Doménech JM. Fundamentos de Diseño y Estadística. UD 14. Medida del cambio: Análisis de
diseños con medidas intrasujeto. 16ª ed. Barcelona: Signo; 2015.

Fleiss JL, Levin B, Paik MC. Statistical Methods for Rates and Proportions. 3rd ed. Hoboken, NJ: John Wiley & Sons; 2003. pp. 598-610.