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
multiple numerical variables in aov
6 messages · Rishabh Gupta, Brian Ripley, Chuck Cleland +1 more
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
Rishabh Gupta wrote:
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?
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:
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?
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
Rishabh Gupta wrote:
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.
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:
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?
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.
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 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