FAQ/BPkapCIR - CBU statistics Wiki

Please enter your password of your account at the remote wiki below.
/!\ You should trust both wikis because the password could be read by the particular administrators.

Clear message
location: FAQ / BPkapCIR

95% Bootstrap confidence intervals for Brennan and Prediger (1981) kappa

The complete case data is in this SPSS file. The directory name may need to be changed in the read.spss command argument to identify the location on your PC of your data file.

library(foreign)
x <- read.spss("U://My Documents//raters.sav")
x1 <- data.frame(x)
attach(x1)


# Evaluates a bootstrap 95% CI for Brennan and Prediger's (1981) kappa for random numbers of categories to rate (for two raters)
# Ratings are in  SPSS file in two columns called rater1 and rater2
#
 
#
nb<-1000
n <- length(rater1)
boot<-matrix(NA,nb,n)
boot1<-matrix(NA,nb,n)
bsum <- matrix(NA,nb,1)
kapbp <- matrix(NA,nb,1)

attributes(boot)
for (i in 1:nb) {
bs1<-sample(rater1,n,replace=T)
bs2<-sample(rater2,n,replace=T)
for (j in 1:n) {
boot[i,j] <- bs1[j]-bs2[j]
boot1[i,j] <- ifelse(boot[i,j] == 0,1,0)
}
kapbp[i] <-  ( (sum(boot1[i,])/n) - (1/n))/(1 - (1/n)) 
}

hist(kapbp)
quantile(kapbp,0.025)
quantile(kapbp,0.975)