library(psych)
rater1=c(rep(1,21),rep(1,4),rep(0,2),rep(0,22))
#rater1
rater2=c(rep(1,21),rep(0,4),rep(1,2),rep(0,22))
dta=(cbind(rater1,rater2))
#dta
cohen.kappa(cbind(rater1,rater2))
## Call: cohen.kappa1(x = x, w = w, n.obs = n.obs, alpha = alpha, levels = levels)
##
## Cohen Kappa and Weighted Kappa correlation coefficients and confidence boundaries
## lower estimate upper
## unweighted kappa 0.57 0.76 0.94
## weighted kappa 0.57 0.76 0.94
##
## Number of subjects = 49
lower upper 左右信賴區間
data=matrix(c(21, 4,2, 22),ncol=2,byrow=TRUE)
data
## [,1] [,2]
## [1,] 21 4
## [2,] 2 22
cohen.kappa(data)
## Call: cohen.kappa1(x = x, w = w, n.obs = n.obs, alpha = alpha, levels = levels)
##
## Cohen Kappa and Weighted Kappa correlation coefficients and confidence boundaries
## lower estimate upper
## unweighted kappa 0.57 0.76 0.94
## weighted kappa 0.57 0.76 0.94
##
## Number of subjects = 49
data = matrix(c(11, 3, 1, 1 ,
4, 18, 3, 2 ,
2, 5,16, 6 ,
1, 2, 4,21 ),ncol=4,byrow=TRUE)
data
## [,1] [,2] [,3] [,4]
## [1,] 11 3 1 1
## [2,] 4 18 3 2
## [3,] 2 5 16 6
## [4,] 1 2 4 21
cohen.kappa(data)
## Call: cohen.kappa1(x = x, w = w, n.obs = n.obs, alpha = alpha, levels = levels)
##
## Cohen Kappa and Weighted Kappa correlation coefficients and confidence boundaries
## lower estimate upper
## unweighted kappa 0.42 0.54 0.67
## weighted kappa 0.55 0.69 0.82
##
## Number of subjects = 100
weights <-matrix(c(1.0 , 0.888, 0.555, 0.0 ,
0.888, 1.0 , 0.888, 0.555,
0.555, 0.888, 1.0 , 0.888,
0.0 , 0.555, 0.888, 1.0 ), ncol=4)
weights
## [,1] [,2] [,3] [,4]
## [1,] 1.000 0.888 0.555 0.000
## [2,] 0.888 1.000 0.888 0.555
## [3,] 0.555 0.888 1.000 0.888
## [4,] 0.000 0.555 0.888 1.000
cohen.kappa(data, weights)
## Call: cohen.kappa1(x = x, w = w, n.obs = n.obs, alpha = alpha, levels = levels)
##
## Cohen Kappa and Weighted Kappa correlation coefficients and confidence boundaries
## lower estimate upper
## unweighted kappa 0.42 0.54 0.67
## weighted kappa 0.55 0.69 0.82
##
## Number of subjects = 100