[R] ANOVA/aov question

Prof Brian Ripley ripley at stats.ox.ac.uk
Mon Jul 25 23:35:09 CEST 2005

On Mon, 25 Jul 2005 eph1v3t8-rhls6783 at mailblocks.com wrote:

> I'm a bit confused about the anova/aov functions.  Both seem to rely on
> data models, where the relationship between the dependent variables and
> the independent variables can be expressed as a formula.  In what I am
> trying to do, all of my independent variables are qualitative, not
> quantitative.  For example, for each of two options, "option A" and
> "option B" I have collected a set of measurements of the same quantity,
> and I wish to do an ANOVA test to see if that factor (actually I have
> three factors, with 2 levels each) has a significant influence on the
> measured quantity.
> Can R be used for this kind of ANOVA, or must the independent variables
> be quantitative in nature?  If the answer is that it can be done, and
> that it can be done with anova/aov, how do I go about expressing the
> "data model" for qualitative factors?

aov() is the model fitting function for ANOVA models.  anova() is a helper 
function to produce ANOVA tables (or analogues like analysis of deviance 
tables) from one or more fitted models.

The first example in ?aov has three binary explanatory variables (and one 
6-way one).  So it certainly can be done with factors (which in the R 
sense are necessarily qualitative), and the help page is a good start.

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