[R-sig-ME] nested and non-nested random effects
Ben Bolker
bbolker at gmail.com
Tue Mar 15 22:38:10 CET 2011
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On 11-03-15 04:37 PM, Iker Vaquero Alba wrote:
>
> Hello:
>
> I have a doubt about the syntax for random effects, and I hope you
> can help me with that.
>
> I am fitting a mixed effects model with 3 random factors, let's call
> them A, B and C for simplicity. A and B are nested factors, B is
> nested into A, and C is not nested, it's just another random effect
> independent from the other 2. I guess the correct way to specify this
> in "lmer" would be something like:
>
> model1<-lmer(y~fixed1*fixed2+(1|A/B)+(1|C))
>
> but I am not sure how I could do this with "lme". Maybe:
>
> model1<-lme(y~fixed1*fixed2,random=~1|A/B,random=~1/C) ???
>
> or perhaps:
>
> model1<-lme(y~fixed1*fixed2,random=~C|A/B) ???
Fitting non-nested (i.e. crossed) random effects can be done in lme,
but not easily: the best advice is to go read section 4.2.2 of Pinheiro
and Bates 2000, esp. pp. 163-166.
Why do you need to use nlme::lme rather than lme4::lmer ? (R-side
random effects, p-values, .... ?)
Ben Bolker
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
iEYEARECAAYFAk1/3EIACgkQc5UpGjwzenMbIwCfT6oSy43whFrpWNBat+8IUH1N
JjEAn1y2HueNyt9ZZBspOAT6QtXya5RG
=0cH4
-----END PGP SIGNATURE-----
More information about the R-sig-mixed-models
mailing list