An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-sig-mixed-models/attachments/20110327/292f4bf7/attachment.pl>
coding for an interaction
3 messages · Andrew Dolman, Saang-Yoon Hyun
If time is being modelled as a continuous variable, i.e. you are looking at a continuous change in x over time, then mod2=lmer(x~time+(1|site), data=mydata) mod3=lmer(x~time+(time|site), data=mydata) is probably what you want. And you can test whether time interacts with site (the slope for time differs between sites) by a likelihood ratio test anova(mod2, mod3) andydolman at gmail.com
On 27 March 2011 07:10, Saang-Yoon Hyun <shyunuw at gmail.com> wrote:
Hi. I have one fixed and one random effect. ?However, I cannot find how to code their interaction term. ?For example, the data have the following two columns: site as random effect, and time as fixed effect. mod1=lmer(x~(1|site), ?data=mydata); ? ? ? #site: random effect; mod2=lmer(x~time+(1|site), ?data=mydata); ? ?#time: fixed effect; These above codes work. ?But I wonder how you do code for their interaction term. ?I tried to do several things (e.g., +time*(1|site), +(1|time*site), ... etc.), but all failed. Please give me some tips. ?Thank you, Saang-Yoon ? ? ? ?[[alternative HTML version deleted]]
_______________________________________________ R-sig-mixed-models at r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models
An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-sig-mixed-models/attachments/20110327/8179df96/attachment.pl>