######################################################
# Example: Geeganage2010 data
# Preparing covariances for multivariate meta-analysis
######################################################
## set the correlation coefficients list r
r12 <- 0.71
r.Gee <- lapply(1:nrow(Geeganage2010), function(i){matrix(c(1, r12, r12, 1), 2, 2)})
computvcov <- md.vcov(nt = subset(Geeganage2010, select = c(nt_SBP, nt_DBP)),
nc = subset(Geeganage2010, select = c(nc_SBP, nc_DBP)),
sdt = subset(Geeganage2010, select=c(sdt_SBP, sdt_DBP)),
sdc = subset(Geeganage2010, select=c(sdc_SBP, sdc_DBP)),
r = r.Gee)
# name variance-covariance matrix as S
S <- computvcov$matrix.vcov
## fixed-effect model
y <- as.data.frame(subset(Geeganage2010, select = c(MD_SBP, MD_DBP)))
MMA_FE <- summary(metafixed(y = y, Slist = computvcov$list.vcov))
MMA_FE
#######################################################################
# Running random-effects model using package "mixmeta" or "metaSEM"
#######################################################################
# Restricted maximum likelihood (REML) estimator from the mixmeta package
#library(mixmeta)
#mvmeta_RE <- summary(mixmeta(cbind(MD_SBP, MD_DBP)~1, S = S,
# data = subset(Geeganage2010, select = c(MD_SBP, MD_DBP)),
# method = "reml"))
#mvmeta_RE
# maximum likelihood estimators from the metaSEM package
# library(metaSEM)
# metaSEM_RE <- summary(meta(y = y, v = S))
# metaSEM_RE
##############################################################
# Plotting the result:
##############################################################
# obj <- MMA_FE
# obj <- mvmeta_RE
# obj <- metaSEM_RE
# plotCI(y = y, v = computvcov$list.vcov,
# name.y = c("MD_SBP", "MD_DBP"), name.study = Geeganage2010$studyID,
# y.all = obj$coefficients[,1],
# y.all.se = obj$coefficients[,2])
Run the code above in your browser using DataLab