### load data
dat <- get(data(dat.konstantopoulos2011))
### regular random-effects model
res <- rma(yi, vi, data=dat)
res
### regular random-effects model using rma.mv()
res <- rma.mv(yi, vi, random = ~ 1 | study, data=dat)
res
### multilevel random-effects model
res.ml <- rma.mv(yi, vi, random = list(~ 1 | district, ~ 1 | study), data=dat)
res.ml
### profile variance components
par(mfrow=c(2,1))
profile(res.ml, sigma2=1, xlim=c(.01,.4))
profile(res.ml, sigma2=2, xlim=c(.01,.1))
### multivariate parameterization of the model
res.mv <- rma.mv(yi, vi, random = ~ study | district, data=dat)
res.mv
### tau^2 from multivariate model = sum of the two variance components from the multilevel model
sum(res.ml$sigma2)
### rho from multivariate model = intraclass correlation coefficient based on the multilevel model
res.ml$sigma2[1] / sum(res.ml$sigma2)
Run the code above in your browser using DataLab