[R] multiple numerical variables in aov

Prof Brian Ripley ripley at stats.ox.ac.uk
Fri Apr 11 12:52:48 CEST 2003


On Fri, 11 Apr 2003, Rishabh Gupta wrote:

>  I have a question regarding the anova function aov(). I want to perform 
> an anova calculation
> using one grouping variable but more than one numerical variables:
> So instead of:
>      aov(v ~ g)
> I want something like
>      aov(v1 + v2 + v3 ~ g)
> Essentially I want to find out whether the variables v1, v2, v3, etc can collectively discriminate
> between different values of variable g. Could somebody tell whether this is possible and if so
> how?

You might intend MANOVA, run in R by

summary(manova(cbind(v1,v2,v3) ~g)))

but from your words it sounds like you want lda(g ~ v1+v2+v3).

> Also, could somebody please tell me the difference between the aov() function and the anova()
> function. I've been using aov() so far and it seems to work fine. Could somebody tell me what the
> difference is and which one is better.

They are completely different. anova() extracts results from one or more
fitted models.

See the help pages or any of the good books on using S.

-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595



More information about the R-help mailing list