Skip to content

multiple numerical variables in aov

6 messages · Rishabh Gupta, Brian Ripley, Chuck Cleland +1 more

#
Hi all,
 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?

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.

Any help would be greatly appreciated. Many Thanks

Rishabh
#
On Fri, 11 Apr 2003, Rishabh Gupta wrote:

            
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).
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.
#
Rishabh Gupta wrote:
Rishabh:
   With v1, v2, v3, and g in the dataframe mydata, try the following:

summary(manova(cbind(v1, v2, v3) ~ g, data = mydata), test="Wilks")

hope it helps,

Chuck Cleland
#
Hi Chuck,
 Thanks very much for your help. Just a follow up question..

Like I said I was using aov() instead of anova(). I want to maintain maximum compatability with
what I've been using so far and I notice that manova() is just a wrapper to aov(). How important
is it to use summary(......, test="Wilks") exactly, do you think that the default test statistic
would be sufficient.

Once again, many thanks for your help.

Rishabh
--- Chuck Cleland <ccleland at optonline.net> wrote: > Rishabh Gupta wrote:
#
Rishabh Gupta wrote:
Rishabh:
   The default multivariate test would be based on Pillai's 
trace.  That may meet your needs.  Also, note how the following 
differ:

summary(manova(cbind(v1, v2, v3) ~ g, data = mydata))

vs.

summary(aov(cbind(v1, v2, v3) ~ g, data = mydata))

   So if I understood your initial request, I think you want 
summary(manova()) and not summary(aov()).

hope it helps,

Chuck Cleland
#
On Fri, 11 Apr 2003, [iso-8859-1] Rishabh Gupta wrote:

            
help(aov) does say that the formula can specify multiple responses,
though admittedly it doesn't explain how.  You use

       aov(cbind(v1,v2,v3)~g)

However, if you want to find out about whether these variables
collectively discriminate this will not be the right way. You want
something like lda() in the MASS package.
They are both of excellent quality :). They do completely different
things. As their respective help pages say

 Compute analysis of variance (or deviance) tables for one or more
     fitted model objects.

 Fit an analysis of variance model by a call to `lm' for each
     stratum.



	-thomas