[R] aov and non-categorical variables

Alexander Sirotkin [at Yahoo] alex_s_42 at yahoo.com
Thu Oct 16 00:53:29 CEST 2003


Thanks. One more question, if you don't mind.

If  instead of aov(), I call lm() directly it fits a
linear regression model and if it encounters
categorical variable it does what needs to be done in
this case - defines a new indicator variable for each
level of categorical var.

However, if I call aov() with the same data
(categorical and numeric) I don't see all these
indicator variables in the ANOVA table. It is unclear
to me how the ANOVA table with lots of inidcator
variables produced by lm() is transferred into the
ANOVA table of aov().

Also, after you mention the Error() term in aov() I
tried to find some explaination about it in R manuals,
and did not find any. Do you know where the meaning of
Error() in aov() is documented ?

Thanks.

--- kjetil at entelnet.bo wrote:
> On 15 Oct 2003 at 9:32, Alexander Sirotkin [at
> Yahoo] wrote:
> 
> > It is unclear to me how aov() handles
> non-categorical
> > variables.
> 
> aov is an interface to lm, so it can estimate every
> model lm
> can, the difference is that it produces the results
> (summary)
> in the classical way for anova.
> 
> > 
> > I mean it works and produces results that I would
> > expect, but I was under impression that ANOVA is
> only
> > defined for categorical variables.
> > 
> > In addition, help(aov) says that it "call to 'lm'
> for
> > each  stratum", which  I presume means that it
> calls
> > to lm() for every group of the categorical
> variable, 
> 
> No. With anova you can also define "error strata"
> using 
> Error() as part of the formula, lm() cannot do that.
> If you don't use 
> Error() in the formula, lm() is called only once. 
> 
> Kjetil Halvorsen
> 
> > however I don't quite understand what this means
> for
> > non-categorical variable.
> > 
> > Thanks
> > 
> > ______________________________________________
> > R-help at stat.math.ethz.ch mailing list
> >
>
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
> 
>




More information about the R-help mailing list