Re: [R] Is it possible with two random effects in lme()?

From: Douglas Bates <bates_at_stat.wisc.edu>
Date: Sun, 3 Feb 2008 09:59:15 -0600

On Feb 1, 2008 7:30 AM, Falco tinnunculus <kestrel78_at_gmail.com> wrote:
> Dear all,

> Is it possible with two random effects in lme()?

> lmefit1<- lme(Handling ~ Mass + factor(Prey)+ Mass*factor(Prey), random = ~
> 1 |Place+Age)

I assume that Place and Age are not nested. If so, it's possible to fit such a model with lme but not easy. It is much better to use the lmer function in the lme4 package. The call would be

lmerfit1 <- lmer(Handling ~ Mass + factor(Prey) + Mass * factor(Prey) + (1|Place) + (1|Age))

P.S. It is often better to send such questions to the special interest group mailing list for mixed models, R-SIG-Mixed-Models_at_R-project.org.  You may get a faster answer from that list which is lower traffic.

> Here I use Place as random effect, but I also want to add Age as a random
> effect. Since there could be an effect of Age (continous variable), but I
> like to control for it rather than locking at the effect of Age on handling
> time, since Mass and Prey type are of main interest.
>
> Regards Kes,
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help_at_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-help_at_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. Received on Sun 03 Feb 2008 - 16:05:27 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Sun 03 Feb 2008 - 17:30:10 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive