[R] mixed effects meta-regression: nlme vs. metafor
christian.roever at med.uni-goettingen.de
Wed Jan 23 11:10:24 CET 2013
I would like to do a meta-analysis, i.e., a mixed-effects regression,
but I don't seem to get what I want using both the nlme or metafor packages.
My question: is there indeed no way to do it?
And if so, is there another package I could use?
Here are the details:
In my meta-analysis I'm comparing different studies that report a
measure at time zero and after a certain followup time. Each reported
measurement comes with standard error, and each study uses one (or
several) of a few treatment categories. I want to fit a random effect
for each study (the study effect) and a treatment-dependent time effect.
For the moment I use a linear model, i.e., twice the followup time will
give you twice the effect, etc...
I get /almost/ what I want using "nlme" via this command:
lme01 <- lme(effect ~ treatment + treatment*time - time - 1,
random = ~ 1|study,
weights = varFixed(~se2),
data = dat)
"effect" is the real-valued measurement, "treatment" is a factor, and
"time" is the followup time in months. "se2" is the squared standard error.
Problem is: using the "varFixed()" option, "lme()" will fit an
additional variance parameter scaling the provided standard errors by a
certain factor to be estimated. According to some discussions on the
web, you once were able to prevent the fitting of the extra variance
parameter in some pre-1998 S-plus versions of nlme using a
"lmeControl(sigma=1)" option, but this does not appear to available any
I again get /almost/ what I want using the "metafor" package:
rma01 <- rma(yi = effect,
vi = se2,
mods = ~ treatment + treatment*time - time - 1,
data = dat)
"rma()" will correctly digest the provided standard errors, but this
time the problem is that "rma()" will always treat each line in the data
set as a different study, there does not appear to be a way to tell
"rma()" that several data points belong to the same study, i.e., have a
common random effect. What I am missing is an equivalent to the "random"
statement in the "lme()" command above. Adding an option like
"slab=as.character(dat$study)" only seems to affect the labeling but not
the actual computation.
Many thanks in advance,
More information about the R-help