Falco tinnunculus
2008-Feb-01 13:30 UTC
[R] Is it possible with two random effects in lme()?
En innebygd og tegnsett-uspesifisert tekst ble skilt ut... Navn: ikke tilgjengelig Nettadresse: https://stat.ethz.ch/pipermail/r-help/attachments/20080201/6cd3960c/attachment.pl
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. >
Bettina Lado Lindner
2013-Sep-26 18:25 UTC
[R] Is it possible with two random effects in lme()?
Hello, I want two random effect in R. One is BLOQUE nested in REP and the other is TRAT. I don’t know how put TRAT independant of the other random effect. My model until this step is ok: data_2010_ECCI_ensayo$le1=groupedData(REND~ REP|BLOQUE, data=data_2010_ECCI_ensayo$le1) lmer_ECC2010_le1AR1BI=lme(REND ~ REP + TRAT, data=data_2010_ECCI_ensayo$le1,random=~1,correlation=corAR1()) If I want put TRAT as other independant random effect I don’t know how to do. When I did this give me an error... lmer_ECC2010_le1AR1BI=lme(REND ~ REP + TRAT, data=data_2010_ECCI_ensayo$le1,random=list(~1, TRAT=~1),correlation=corAR1()) lmer_ECC2010_le1AR1BI=lme(REND ~ REP + TRAT, data=data_2010_ECCI_ensayo$le1,random=list(~1, ~1|TRAT),correlation=corAR1()) I know that in lmer is easier but I use error correlation so I need use lme. Bettina [[alternative HTML version deleted]]