Understanding and translating lme() into lmer() model

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Understanding and translating lme() into lmer() model

Petar Milin
I am newbie in R, trying to understand and compare syntax in nlme and
lme4. lme() model from the nlme package I am interested in is:
        lme.m1.1 = lme(Y~A+B+C,random=~1|D/E,data=data,method="ML")
(for simplicity reason, I am giving generic names of factors)
If I understand well, there are three fixed factors: A, B and C, and two
random factors: D and E. In addition to that, E is nested in D, isn't
it? Of course, method is Maximum Likelihood.
If I would like to translate the above model to one suitable for lmer(),
it should look like this:
        lmer.m1.1 = lmer(Y~A+B+C+(1|D:E),data=data,method="ML")
Am I right? Is '/' in nlme same as ':' in lme4?

Sincerely,
Peter M.

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Reply | Threaded
Open this post in threaded view
|

Re: Understanding and translating lme() into lmer() model

Doran, Harold
Peter:

Almost correct. You need to add the variance component for the highest
level of nesting, so your model would be

lmer.m1.1 = lmer(Y~A+B+C+(1|D:E) + (1|E), data=data,method="ML")

But, yes, the : is used to note implicit nesting in lmer similar to the
syntax used for / in lme. The syntax varies a bit because lme was useful
for models with nested random effects. But, lmer can handle models with
more complex structures such as crossed random effects. It doesn't make
sense to use strict nesting structures when units are migrating, so that
is part of the reason for the evolution of lmer().  

If you use RSiteSearch('lmer syntax') you will find a few threads on the
topic that might be helpful.

Harold



-----Original Message-----
From: [hidden email]
[mailto:[hidden email]] On Behalf Of Petar Milin
Sent: Thursday, January 05, 2006 7:48 AM
To: [hidden email]
Subject: [R] Understanding and translating lme() into lmer() model

I am newbie in R, trying to understand and compare syntax in nlme and
lme4. lme() model from the nlme package I am interested in is:
        lme.m1.1 = lme(Y~A+B+C,random=~1|D/E,data=data,method="ML")
(for simplicity reason, I am giving generic names of factors) If I
understand well, there are three fixed factors: A, B and C, and two
random factors: D and E. In addition to that, E is nested in D, isn't
it? Of course, method is Maximum Likelihood.
If I would like to translate the above model to one suitable for lmer(),
it should look like this:
        lmer.m1.1 = lmer(Y~A+B+C+(1|D:E),data=data,method="ML")
Am I right? Is '/' in nlme same as ':' in lme4?

Sincerely,
Peter M.

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide!
http://www.R-project.org/posting-guide.html

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html