[R-meta] Calculating the covariance structure for multilevel meta-analysis using the raw mean
Akifumi Yanagisawa
ayanagis at uwo.ca
Mon Feb 19 14:56:31 CET 2018
Dear all,
I am currently conducting a multilevel meta-analysis with the metafor package using the raw mean.
The following is sample data which describes the characteristics of my data. Please note the actual data set includes more studies.
## data structure ##
dat <- data.frame(
id = c(1,2,3,4,5, 6, 7),
study = c("study1","study1", "study2", "study2", "study3", "study3", "study4"),
treatment = c("treatment1","treatment1", "treatment2", "treatment3", "treatment3", "treatment4", "treatment4"),
mi = c(5.3, 5.1, 2.2, 3.4, 2.5, 5.1, 3.3),
sdi = c(1.2, 1.3, 0.5, 3.1, 0.7, 2.1, 0.8),
ni = c(28, 30, 20, 20, 42, 43, 120))
require(metafor)
dat <- escalc(data = dat, measure = "MN", mi = mi, sdi = sdi, ni = ni)
dat
As you can see in the above data, some studies examined only one type of treatment. I am trying to specify the model using the the following code.
res <- rma.mv (yi, vi, mods = ~ treatment - 1, random = ~treatment | study, struct = "DIAG", data = dat)
However, I cannot figure out how to calculate the covariance structure for this case, i.e., some studies include only one treatment. I am thinking that I probably cannot use the same approach as network meta-analysis. I would appreciate it if I could learn how to calculate the covariance matrix for this case.
Also, some of the studies measured the outcome using two types of measurements. None of these studies reported a correlation between measurement 1 and measurement 2. Would it be possible for me to include this type of measurement as a factor while somehow specifying the covariance matrix for this as well? Or, should I just analyze the data separately for each type of measurement?
## data structure 2 ##
dat <- data.frame(
id = c(1,2,3,4,5, 6, 7),
study = c("study1","study1", "study2", "study2", "study3", "study3", "study4"),
treatment = c("treatment1","treatment1", "treatment2", "treatment3", "treatment3", "treatment4", "treatment4"),
measurement = c("measurement1","measurement2", "measurement1", "measurement1", "measurement2", "measurement2", "measurement1"),
mi = c(5.3, 5.1, 2.2, 3.4, 2.5, 5.1, 3.3),
sdi = c(1.2, 1.3, 0.5, 3.1, 0.7, 2.1, 0.8),
ni = c(28, 30, 20, 20, 42, 43, 120))
dat <- escalc(data = dat, measure = "MN", mi = mi, sdi = sdi, ni = ni)
res <- rma.mv(data = dat ,yi, vi, mods = ~ treatment + measurement -1, random = ~treatment|study, struct = "DIAG”)
Thank you very much for your help,
Aki
More information about the R-sig-meta-analysis
mailing list