[R-sig-ME] lmer random and fixed effect?
Ben Bolker
bbolker at gmail.com
Thu Aug 14 22:59:01 CEST 2014
In this example:
lmer(formula = extro~open+agree+social+class+(1|school/class),
data = lmm.data)
'class' is included as a fixed effect, and the random effects grouping
variable is specified as school/class, which means "class nested within
school", i.e. the same as school+school:class (where : denotes
interaction). Note that class itself is *not* included as a
random-effects grouping variable. This model specification would make
sense if (1) levels of the class variable are defined across schools
(i.e. class #1 in school #1 has something in common with class #1 in
school #2); (2) it makes sense to treat class as a fixed effect, i.e. we
have a fairly small number of classes and/or we want to make inferences
about the values of particular classes contrasts among specific classes
(and not just the variation among classes)
On 14-08-14 02:25 PM, Farrar, David wrote:
>
>
> A split-plot design is an example where both are used. You may find
> helpful the discussion of that design "the R book."
>
> -----Original Message----- From:
> r-sig-mixed-models-bounces at r-project.org
> [mailto:r-sig-mixed-models-bounces at r-project.org] On Behalf Of
> Charles Determan Jr Sent: Thursday, August 14, 2014 2:09 PM To:
> r-sig-mixed-models at r-project.org Subject: [R-sig-ME] lmer random and
> fixed effect?
>
> Greetings,
>
> I have been looking more into mixed models recently and have run into
> a situation that confuses me. I was initially under the impression
> that fixed and random effect variables are separate, however can they
> be both in an lmer model and if so why would you do so?
>
> Such as example is with the following dataset: lmm.data <-
> read.table("
> http://www.unt.edu/rss/class/Jon/R_SC/Module9/lmm.data.txt",
> header=TRUE, sep=",", na.strings="NA", dec=".", strip.white=TRUE)
>
> Reading online, I have found the following model: require(lme4) fit
> <- lmer(formula = extro~open+agree+social+class+(1|school/class),
> data = lmm.data)
>
> Everything runs fine but I am confused as to what this actually means
> or if it is even appropriate.
>
> Thank you for any insight, Regards,
>
> -- Dr. Charles Determan, PhD Integrated Biosciences
>
> [[alternative HTML version deleted]]
>
> _______________________________________________
> R-sig-mixed-models at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models
>
> _______________________________________________
> R-sig-mixed-models at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models
>
More information about the R-sig-mixed-models
mailing list