Re: [R] mixed effects meta-regression: nlme vs. metafor

2013-01-23 Thread Christian Röver
Hi Wolfgang,

thanks for the instant and comprehensive reply!

On 01/23/2013 12:39 PM, Viechtbauer Wolfgang (STAT) wrote:
> 
> [...]
> 
> In fact, trying to disentangle that residual variance component from any 
> random study effects is usually next to impossible. I mention this explicitly 
> one more time, because I have seen some publications using lme() in exactly 
> this way ...

I'm not too surprised -- it was only after some double-checking that I
noticed that variances are not actually fixed when using the "varFixed"
option...

> 
> [...]
> 
> The updated version of the package still does not include that aforementioned 
> function, but I may consider putting a pre-alpha version on the website so 
> that the adventurous are able to try it out.

I'm looking forward to it...!

> Alternatively, you could try taking a look at MCMCglmm 
> (http://cran.r-project.org/web/packages/MCMCglmm/index.html), which should be 
> able to fit the model that you want. Can't give you any details on how, but 
> if you get stuck, try posting to R-sig-mixed-models and Jarrod Hadfield (the 
> MCMCglmm package author) is very likely to help you further.

Thanks; I was also thinking of switching to OpenBUGS + R2OpenBUGS, which
should provide the necessary flexibility at the price of some extra
complication... but having worked with it before, it should be doable...

Cheers,

Christian

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] mixed effects meta-regression: nlme vs. metafor

2013-01-23 Thread Christian Röver
Hi,

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
more.

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.

Any ideas?

Many thanks in advance,

Christian Roever

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.