Edgar I agree with what Chris says
(1 + BOAT | fYEAR) makes no sense It is probably (1|BOAT) + (1|fYEAR) that you want Providing you have enough boats and years to estimate variance components for these two factors: please feel free to post any further queries but you will need to provide more information on the data if people are to give useful help. Clearly boat is random, making year a factor and then random is a useful simplification to compare variances providing it makes sense to your research question. Regards Mike -----Original Message----- From: r-sig-ecology-boun...@r-project.org [mailto:r-sig-ecology-boun...@r-project.org] On Behalf Of Christian Parker Sent: 20 August 2011 17:44 To: Elizabeth Green Cc: r-sig-ecology@r-project.org Subject: Re: [R-sig-eco] random effects in a linear mixed model Edgar, Based on the information provided its difficult to thoroughly answer your question. But I will assume that you have samples within each year, say weekly or monthly. Based on this I would say that you can treat the years as a random effect but I dont think that I would do it the way that you have specified LMM2 <- lmer(Op_Obj ~ BOAT + (1 + BOAT | fYEAR), data=YM, family=gaussian, na.action=na.omit, verbose=T) Which tests for a difference in Op_Obj across boats and allowing that difference to vary from year to year. Instead I think you are interested in whether Op_Obj (either average or as a function of other predictors measured) and you want to allow that relationship to vary by both boat and year. So I would suggest that if you want to allow the relationship to vary from year to year that you also include boat as a random variable. I believe the syntax is like this: LMM2 <- lmer(Op_Obj ~ 1 +(1|BOAT)+(1| fYEAR), data=YM) Which is basically an anova design where you allow the intercept to vary by boat and year. If you are interested in covariates you would include them in place of the 1 on the "fixed" effects side of the model. And if you wanted to allow their slopes to vary you would include them in place of the 1's on the "random" effects side of the model. There always seems to be a good discussion going in the mixed effects discussion group as to the definition of fixed and random effects and how to model them (e.g http://andrewgelman.com/2010/12/so-called_fixed/) but I am curious as to what advice others on this list have. Cheers, Chris Parker On Fri, Aug 19, 2011 at 11:05 AM, Elizabeth Green <bessie....@gmail.com>wrote: > > On Aug 19, 2011, at 2:00 AM, > r-sig-ecology-request@r-**project.org<r-sig-ecology-requ...@r-project.org>wrote: > > >> 1. Random effects in a linear mix model (Edgar Torres) >> >> > Edgar, the random effects represent the variable that has an effect, but > not an effect that is likely to be biologically interesting, in this case, > your fishing vessel. The effects you want to test are the fixed effects, in > this case time, because you want to see how your variable varies by year, > accounting for the random effects of the different vessels fishing. > > bessie > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~**~~~~~~~~~~~~~~~~~~ > Bessie Green > 907-388-4496 > http://mercury.bio.uaf.edu/~**elizabeth_green/<http://mercury.bio.uaf.edu/%7Eelizabeth_green/> > > ______________________________**_________________ > R-sig-ecology mailing list > R-sig-ecology@r-project.org > https://stat.ethz.ch/mailman/**listinfo/r-sig-ecology<https://stat.ethz.ch/mailman/listinfo/r-sig-ecology> > [[alternative HTML version deleted]] _______________________________________________ R-sig-ecology mailing list R-sig-ecology@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-ecology -- This message (and any attachments) is for the recipient only. NERC is subject to the Freedom of Information Act 2000 and the contents of this email and any reply you make may be disclosed by NERC unless it is exempt from release under the Act. Any material supplied to NERC may be stored in an electronic records management system. _______________________________________________ R-sig-ecology mailing list R-sig-ecology@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-ecology