[R] Random effects ANOVA?
Peter Dalgaard
p.dalgaard at biostat.ku.dk
Thu Mar 30 22:41:51 CEST 2006
"Chris Bergstresser" <chris at subtlety.com> writes:
> On 3/30/06, Prof Brian Ripley <ripley at stats.ox.ac.uk> wrote:
> > I think you want print or summary rather than anova. anova() is not very
> > useful for aov() models even without error strata.
>
> That's sort of better. summary(aov(time ~ drink + Error(video),
> data = df));
>
> gives me:
>
> Error: video
> Df Sum Sq Mean Sq F value Pr(>F)
> Residuals 2 160 80
>
> Error: Within
> Df Sum Sq Mean Sq F value Pr(>F)
> drink 1 240.000 240.000 44.211 1.313e-08 ***
> Residuals 56 304.000 5.429
> ---
> Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
>
> ...what I'm really looking for is something akin to the output from
> SAS, which is:
>
> Source DF Anova SS Mean Square F Value Pr > F
> DRINK 1 240.000 240.000 12.00 0.0742
> VIDEO 2 160.000 80.000 4.00 0.2000
>
> > I didn't follow how the videos were chosen. Random effects apply when the
> > 'treatments' were chosen from a large population (which might apply if
> > each subject watched (on separate occasions) three videos chosen randomly
> > from a larger pool), and if the interest is in the variability of the
> > response over videos in the pool. If subjects were observed more than
> > once then I suspect you most likely want a random effect for subjects.
>
> This problem comes directly from the final for my Experimental
> Stats class, which is why it feels a little odd. The videos were
> randomly selected from a library. Subjects watched one of the three
> videos, drank one of the two drinks, and completed the tasks. There
> were no repeated measures, so we can't block on subjects.
> The hypothesis test, according to SAS, treats DRINK*VIDEO as an
> error term. Setting aside whether this is the right analysis, how can
> I replicate this analysis in R?
Possibly,
time ~ drink + Error(video/drink)
It won't give you the F test for "video" though. Not quite sure
whether
time ~ drink + video + Error(video:drink)
works. It might, although it is a bit unnatural to have a random
interaction between to systematic effects.
--
O__ ---- Peter Dalgaard Øster Farimagsgade 5, Entr.B
c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K
(*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk) FAX: (+45) 35327907
More information about the R-help
mailing list