An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20090323/8125b35c/attachment-0002.pl>
specifying repeated measures model in lmer
2 messages · Lawrence Hanser, Douglas Bates
On Mon, Mar 23, 2009 at 2:35 PM, Lawrence Hanser <lhanser at gmail.com> wrote:
Dear Colleagues, I have what Roger Kirk (Experimental Design: Procedures for the Behavioral Sciences, 1968) refers to as a randomized block factorial design. ?The anova table would look like this: ? ? ? ? ? ? ? ? ? ? ?df A ? ? ? ? ? ? ? ? ? ? 3 Subj/A ? ? ? ? ?103 (error term for A) B ? ? ? ? ? ? ? ? ? 23 A*B ? ? ? ? ? ? ? ?69 B*Subj/A ? ? 2369 (error term for B and A*B)
Subjects are nested within A and give a response for each B. ?If y is the dependent variable, is this the correct lmer specification for the above, where ID is the variable name for Subj:
lmer(y ~ A + B + A*B + (A|ID))
If, as you say, subjects are nested within levels of A, then I don't think you want a random effects term of the form (A | ID). I understand what you say to mean that each subject is exposed to one and only one level of factor A so trying to fit a random effect for the levels of A within each subject doesn't make sense. Trying to understand model specifications for lmer according to the degrees of freedom for each term is probably not the best approach.
Am I barking up the right tree? ?I can also fit: aov(y ~ A + B + A*B ?+ ID) then I have to do some hand calculations to use ID as the error term for A. ?The residual (really B*ID) is the correct error term for B and A*B. Thanks, Larry ? ? ? ?[[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.