[R-sig-ME] lme vs lme4

Jim Maas j.maas at uea.ac.uk
Fri Nov 4 18:22:39 CET 2011


Thanks Ben, this helps a lot.  Our issue is #2 as you specify here, 
speed is not an issue.

What we are trying to do is accomplish the second analysis, using lme so 
we can use the varConstPower function

this works for the fixed effects model,

results <- lme(lor ~0 + nmatr1 + nmatr3 ,random= ~1|trtpair,
data=indat,weights=varConstPower(form=~var,fixed=list(power=1)))

but we can't figure out how to specify the model (as we would using lmer)
to run a random effects models I need to have two random effects,  one 
for the treatment pair comparison and another for the effect of 
treatment 1 and treatment 3.  Using lmer the code would look like ...

results <- lmer(lor ~0 + nmatr1 + nmatr3+ (1|trtpair) + (nmatr1 + 
nmatr3|n.trials), 
data=indat,weights=varConstPower(form=~var,fixed=list(power=1)))


Could I please get some clues how to specify this using lme?
Thanks a bunch

J



Jim Maas <j.maas at ...> writes:
>> We are attempting to compare some results using lme and lme4.  I'm
>> relatively new to this so could well be asking questions that are overly
>> simplistic or naive, if so please inform.
>>
>> We have an example that works with nlme(lme) and specifying the weights
>> as the function varConstPower, however when we try to do a slightly more
>> specific analysis using lme4(lmer) it doesn't seem to have the
>> varConstPower function built it.  Is in nonsensical to build it into
>> lme4?  It might well have some shortcomings/compromises. Is there a way
>> we could accomplish the same thing with lme4 via some R coding or any
>> other method?
>     It's not nonsensical, but it's way down the priority list for
> the lme4 developer(s), so I wouldn't hold your breath.
>
>    I guess my question would be: what are the advantages of lme4
> for your particular analysis (i.e. reasons to use lme4 instead
> of nlme)?  The main ones that I can think of are (1) speed and
> (2) handling of crossed random effects.  For #1, you might consider
> ASREML-R (I'm not particularly familiar with it, and I mostly
> work with GLMMs, for which ASREML has some lacunae, but I've been
> impressed by some of the posts at http://www.quantumforest.com/ ...)
> For #2, it is *possible* [although clunky/slow] to implement crossed
> random effects in (n)lme.
>
>    See http://glmm.wikidot.com/faq#lme-comp (for example)
>
>
>
> Dr. Jim Maas
> University of East Anglia




More information about the R-sig-mixed-models mailing list