# [R] Understanding and translating lme() into lmer() model

Doran, Harold HDoran at air.org
Thu Jan 5 14:19:02 CET 2006

```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

Harold

-----Original Message-----
From: r-help-bounces at stat.math.ethz.ch
[mailto:r-help-bounces at stat.math.ethz.ch] On Behalf Of Petar Milin
Sent: Thursday, January 05, 2006 7:48 AM
To: r-help at stat.math.ethz.ch
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.

______________________________________________
R-help at stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help