###########################################################################
# Example: Geeganage2010 data
# Preparing risk differences and covariances for multivariate meta-analysis
###########################################################################
data(Geeganage2010)
## 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 <- rd.vcov(nt = subset(Geeganage2010, select = c(nt_DD, nt_D)),
nc = subset(Geeganage2010, select = c(nc_DD, nc_D)),
st = subset(Geeganage2010, select = c(st_DD, st_D)),
sc = subset(Geeganage2010, select = c(sc_DD, sc_D)),
r = r.Gee)
# name computed relative risk as y
y <- computvcov$ef
colnames(y) <- c("rd.DD", "rd.D")
# name variance-covariance matrix of trnasformed z scores as covars
S <- computvcov$matrix.vcov
## fixed-effect model
MMA_FE <- summary(metafixed(y = y, Slist = computvcov$list.vcov))
#######################################################################
# Running random-effects model using package "mixmeta" or "metaSEM"
#######################################################################
#library(mixmeta)
#mvmeta_RE <- summary(mixmeta(cbind(rd.DD, rd.D)~1,
# S = S, data = as.data.frame(y),
# 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
# pdf("CI.pdf", width = 4, height = 7)
plotCI(y = computvcov$ef, v = computvcov$list.vcov,
name.y = c("rd.DD", "rd.D"),
name.study = Geeganage2010$studyID,
y.all = obj$coefficients[,1],
y.all.se = obj$coefficients[,2])
# dev.off()
Run the code above in your browser using DataLab