Skip to content
Prev 334 / 5632 Next

[R-meta] Benefits to metafor when missing vi estimates?

Dear Bronwen,

Simply setting vi=1 for studies where the sampling variance is unknown is not appropriate.

Instead, you might want to use a model as suggested by James (in the post you linked to). In your case, you would have to assume homoscedasticity of the error/sampling variances (instead of assuming that they are inversely proportional to the sample sizes or number of replicates). This can then be followed up by using cluster-robust inference methods, which should also account (at least asymptotically) for the fact that the sampling variances are actually heteroscedastic.

One could also use a model that sets the sampling variances to the known values for those studies where the information required to compute 'vi' is available and estimates 'vi' (under the homoescedasticity assumption) for the remaining studies. With a bit of trickery, this can actually be done with metafor. Here is an example:

library(metafor)

dat <- get(data(dat.konstantopoulos2011))

### fit multilevel model
res <- rma.mv(yi, vi, random = ~ 1 | district/school, data=dat)
res

### pretend that 'vi' is only known for a subset of the studies
### and set 'vi' to 0 for studies where 'vi' is unknown
set.seed(1235)
dat$viknown <- 0
dat$viknown[sample(1:nrow(dat), 10)] <- 1
dat$vi[dat$viknown == 0] <- 0

### fit model that estimates the sampling variance for studies where 'vi' is unknown
### (assuming that the sampling variance is homoscedastic for those studies)
res <- rma.mv(yi, vi, random = list(~ 1 | district/school, ~ factor(viknown) | study), struct="DIAG", tau2=c(NA,0), data=dat)
res

You would want to follow this up with cluster-robust inference methods again, since we know that 'vi' is not homoescedastic in studies where it was unknown. So:

robust(res, cluster=dat$district)

Or more refined:

library(clubSandwich)
coef_test(res, vcov="CR2")

That seems like quite a bit of work though instead of just:

library(nlme)
res <- lme(yi ~ 1, random = ~ 1 | district, data=dat)
coef_test(res, vcov="CR2")

Best,
Wolfgang