Łukasz Ręcławowicz
2010-Oct-12 09:58 UTC
[R] Bootstrapping Krippendorff's alpha coefficient
Hi, I don't know how to sample such data, it can't be done by row sampling as default method on matrix in boot. Function takes matrix and returns single coefficient. #There is a macro but I want use R :) comm.ohio-state.edu/ahayes/SPSS programs/kalphav2_1.SPS library(concord) library(boot) # The data are rates among observers with NA's nmm<-matrix(c(1,1,NA,1,2,2,3,2,3,3,3,3,3,3,3,3,2,2,2,2,1,2,3,4,4,4,4,4, + 1,1,2,1,2,2,2,2,NA,5,5,5,NA,NA,1,1,NA,NA,3,NA),nrow=4) sample.rates<-function(matrix.data,i){ #mixed.rates<-sample individual rates and put back in new matrix (?) return(kripp.alpha(mixed.rates)$statistic[i]) } to.get<-boot(nmm, sample.rates, R=1e4, stype="i") -- Mi?ego dnia
On 10/12/2010 08:58 PM, ?ukasz R?c?awowicz wrote:> Hi, > > I don't know how to sample such data, it can't be done by row sampling > as default method on matrix in boot. > Function takes matrix and returns single coefficient. > > #There is a macro but I want use R :) > comm.ohio-state.edu/ahayes/SPSS programs/kalphav2_1.SPS > library(concord) > library(boot) > # The data are rates among observers with NA's > nmm<-matrix(c(1,1,NA,1,2,2,3,2,3,3,3,3,3,3,3,3,2,2,2,2,1,2,3,4,4,4,4,4, > + 1,1,2,1,2,2,2,2,NA,5,5,5,NA,NA,1,1,NA,NA,3,NA),nrow=4) > > sample.rates<-function(matrix.data,i){ > #mixed.rates<-sample individual rates and put back in new matrix (?) > return(kripp.alpha(mixed.rates)$statistic[i]) > } > to.get<-boot(nmm, sample.rates, R=1e4, stype="i") >Hi Lukasz, First, switch to the kripp.alpha function in the irr package. concord is no longer maintained. The SPSS code would take some time to decipher and translate into R, so I'll see if I can locate the algorithm. Professor Krippendorff once wrote to me how he did it, so it must be available somewhere. Jim