[R-meta] Calculating I-square for multilevel and multivariate models

Huang Wu hu@ng@wu @end|ng |rom wm|ch@edu
Thu Sep 2 07:19:22 CEST 2021


Dear friends,

I want to calculate the I^2 for multilevel and multivariate model. I understand that Dr. Viechtbauer has provided an approach to calculate it.
http://www.metafor-project.org/doku.php/tips:i2_multilevel_multivariate

Taking multilevel model for example, the codes are below.

dat <- dat.konstantopoulos2011
res <- rma.mv(yi, vi, random = ~ 1 | district/school, data=dat)
res
W <- diag(1/dat$vi)
X <- model.matrix(res)
P <- W - W %*% X %*% solve(t(X) %*% W %*% X) %*% t(X) %*% W
100 * sum(res$sigma2) / (sum(res$sigma2) + (res$k-res$p)/sum(diag(P)))
100 * res$sigma2 / (sum(res$sigma2) + (res$k-res$p)/sum(diag(P)))

However, in another Youtube video (https://www.youtube.com/watch?v=rJjeRRf23L8&t=1134s). Dr. Polanin showed different code to calculate it (at 41:03 of the video; see below).

I2_2 <- (multi>metafor$sigma2[1])/(multi.metafor$sigma[1]+multi.metafor$sigma[2]+mean(corr1$var))
I2_3 <- (multi>metafor$sigma2[2])/(multi.metafor$sigma[1]+multi.metafor$sigma[2]+mean(corr1$var))

The key difference I think is the way of calculating error variance. I tried two approaches but it seems they produced different results. I wonder which one is right or both of them are right?
Thank you.


	[[alternative HTML version deleted]]



More information about the R-sig-meta-analysis mailing list