delta.many2: Compare many (multilevel) Conger kappa coefficients using the...

View source: R/multiagree.R

delta.many2R Documentation

Compare many (multilevel) Conger kappa coefficients using the delta method

Description

This function performs Hotelling's T square test using a variance-covariance matrix based on the delta method to compare dependent Conger kappa coefficients

Usage

delta.many2(data, cluster_id, nrat = c(6, 6), multilevel = T,
  a.level = 0.05)

Arguments

data

a N x sum(Rg) matrix representing the classification of the N items by G groups of Rg observers (g=1,...,G).

cluster_id

a vector of lenght N with the identification number of the K clusters

nrat

a vector of lenght G indicating the number of observers in the G groups of observers

multilevel

a binary indicator equal to TRUE in the presence of multilevel data and FALSE otherwise

a.level

the significance level

Details

This function compare several (multilevel) dependent Conger kappa coefficients. It uses Hotelling's T square test with the variance-covariance matrix obtained by the delta method. If only a single Conger kappa coefficient is computed, the kappa coefficient and its standard error are returned.

Value

$kappa a G x 2 matrix with the G kappa coefficients to be compared in the first column and their corresponding standard error in the second column

$T_test a vector of length 2 with the value of Hotelling's T square test as first element and the p-value as second element

$confidence confidence intervals for the pairwise comparisons of kappa coefficients

$var the G x G correlation matrix of the kappa coefficients

Author(s)

Sophie Vanbelle sophie.vanbelle@maastrichtuniversity.nl

References

Vanbelle S. (2017) Comparing dependent agreement coefficients obtained on multilevel data. Biometrical Journal, 59 (5):1016-1034

Vanbelle S. (submitted) On the asymptotic variability of (multilevel) multirater kappa coefficients

Examples

 
#dataset (multilevel) (Vanbelle, 2008)

data(depression)
attach(depression)
delta.pair(data=cbind(diag,BDI,diag,GHQ),cluster_id=ID,weight='unweighted',multilevel=FALSE)


#dataset (multilevel) (Vanbelle, submitted)
data(CRACKLES)
attach(CRACKLES)

AGREEMENT<-matrix(NA,ncol=21,nrow=4)

for (i in 1:7){
 AGREEMENT[1,((i-1)*3+1)]<-mean((rowSums(CRACKLES[UP==1,((i-1)*4+1):(i*4)])*(rowSums((CRACKLES[UP==1,((i-1)*4+1):(i*4)]))-1)+(4-rowSums(CRACKLES[UP==1,((i-1)*4+1):(i*4)]))*((4-rowSums((CRACKLES[UP==1,((i-1)*4+1):(i*4)])))-1))/12)
 AGREEMENT[1,((i-1)*3+2):(i*3)]<-delta.many2(cluster_id=patient[UP==1],data=CRACKLES[UP==1,((i-1)*4+1):(i*4)],nrat=c(4))$kappa
 AGREEMENT[2,((i-1)*3+1)]<-mean((rowSums(CRACKLES[LO==1,((i-1)*4+1):(i*4)])*(rowSums((CRACKLES[LO==1,((i-1)*4+1):(i*4)]))-1)+(4-rowSums(CRACKLES[LO==1,((i-1)*4+1):(i*4)]))*((4-rowSums((CRACKLES[LO==1,((i-1)*4+1):(i*4)])))-1))/12)
 AGREEMENT[2,((i-1)*3+2):(i*3)]<-delta.many2(cluster_id=patient[LO==1],data=CRACKLES[LO==1,((i-1)*4+1):(i*4)],nrat=c(4))$kappa
 AGREEMENT[3,((i-1)*3+1)]<-mean((rowSums(CRACKLES[UP!=1 & LO!=1,((i-1)*4+1):(i*4)])*(rowSums((CRACKLES[UP!=1 & LO!=1,((i-1)*4+1):(i*4)]))-1)+(4-rowSums(CRACKLES[UP!=1 & LO!=1,((i-1)*4+1):(i*4)]))*((4-rowSums((CRACKLES[UP!=1 & LO!=1,((i-1)*4+1):(i*4)])))-1))/12)
 AGREEMENT[3,((i-1)*3+2):(i*3)]<-delta.many2(cluster_id=patient[UP!=1 & LO!=1],data=CRACKLES[UP!=1 & LO!=1,((i-1)*4+1):(i*4)],nrat=c(4))$kappa
 AGREEMENT[4,((i-1)*3+1)]<-mean((rowSums(CRACKLES[,((i-1)*4+1):(i*4)])*(rowSums((CRACKLES[,((i-1)*4+1):(i*4)]))-1)+(4-rowSums(CRACKLES[,((i-1)*4+1):(i*4)]))*((4-rowSums((CRACKLES[,((i-1)*4+1):(i*4)])))-1))/12)
 AGREEMENT[4,((i-1)*3+2):(i*3)]<-delta.many2(cluster_id=patient,data=CRACKLES[,((i-1)*4+1):(i*4)],nrat=c(4))$kappa
}

AGREEMENT2<-matrix(NA,ncol=14,nrow=4)

for (i in 1:7)
{
 AGREEMENT2[,((i-1)*2+2)]<-paste(paste(paste(round(as.numeric(AGREEMENT[,((i-1)*3+2)]),2),' ('),round(as.numeric(AGREEMENT[,((i-1)*3+3)]),2),')'))
 AGREEMENT2[,((i-1)*2+1)]<-round(as.numeric(AGREEMENT[,((i-1)*3+1)]),2)
}
AGREEMENT2 #(table 3)

svanbelle/multiagree documentation built on Feb. 9, 2023, 2:37 p.m.