[R] how to run ANCOVA?

Sasha Wolosin sasha.wolosin at gmail.com
Wed Aug 23 16:29:34 CEST 2006


   Thank you very much for your response!

However, I still do not understand how this works.  I would like to
adjust the factors (diagnosis and gender) for the covariate (age), so
you are saying I should use:

        aov.out <- aov(response ~ age + diagnosis*gender, data)
        aov.out <- aov(response ~ age*diagnosis*gender, data)

But how is that different from just a 3-way ANOVA with age, diagnosis,
and gender as the the three effects?  Isn't ANCOVA a fundamentally
different model?


On 8/23/06, Richard M. Heiberger <rmh at temple.edu> wrote:
> >  aov.out <- aov(response~diagnosis*gender,data)
> Just add it where you think it belongs in the
> sequential sum of squares
> To adjust the factors for the covariate use
> aov.out <- aov(response ~ age + diagnosis*gender, data)
> To adjust the covariate for the factors
> aov.out <- aov(response ~ diagnosis*gender + age, data)
> If you want to check for interaction of the factors with the
> covariate, then use * instead of + in the formula.
> Please note that I added spaces to your statement to improve human legibility.
> Rich

More information about the R-help mailing list