[R] anova and lm results differ
Iasonas Lamprianou
lamprianou at yahoo.com
Tue Aug 31 20:33:34 CEST 2010
So, should I avoid using the Anova option of the Rcmdr and use aov instead (as I have been doing)?
Dr. Iasonas Lamprianou
Assistant Professor (Educational Research and Evaluation)
Department of Education Sciences
European University-Cyprus
P.O. Box 22006
1516 Nicosia
Cyprus
Tel.: +357-22-713178
Fax: +357-22-590539
Honorary Research Fellow
Department of Education
The University of Manchester
Oxford Road, Manchester M13 9PL, UK
Tel. 0044 161 275 3485
iasonas.lamprianou at manchester.ac.uk
--- On Tue, 31/8/10, Prof Brian Ripley <ripley at stats.ox.ac.uk> wrote:
> From: Prof Brian Ripley <ripley at stats.ox.ac.uk>
> Subject: Re: [R] anova and lm results differ
> To: "Iasonas Lamprianou" <lamprianou at yahoo.com>
> Cc: r-help at r-project.org
> Date: Tuesday, 31 August, 2010, 17:27
> You have confused 'Anova', 'aov' and
> 'anova'. R has aov() and
> anova(), package car (called from Rcmdr) has Anova().
> They are not
> the same things: Anova computes (so-called, by SAS)
> 'type-II or
> type-III analysis-of-variance tables', something
> deliberately not
> available in base R.
>
> See http://www.stats.ox.ac.uk/pub/MASS3/Exegeses.pdf for
> some
> background and why many distinguished statisticians regard
> your
> example of the use of Anova() as meaningless.
>
> In any case, lm (in your subject line) is innocent ... it
> does not
> compute any form of ANOVA table.
>
> On Tue, 31 Aug 2010, Iasonas Lamprianou wrote:
>
> > Dear all
> >
> > I have found that the two "equivalent" commands do not
> produce the same results.
> > 1. (I wrote this command by hand, this is
> what I would do usually)
> > >summary(aov(eduyrs ~ cntry * edf,
> data=ESS1))
> >
> Df Sum Sq Mean Sq F value
> Pr(>F)
> > cntry
> 1 257 256.65 21.2251 4.243e-06 ***
> > edf
> 4 11010 2752.42 227.6296 < 2.2e-16 ***
> > cntry:edf 4
> 24
> 6.03 0.4987 0.7367
> > Residuals 3205
> 38754 12.09
> > ---
> > Signif. codes: 0 '***' 0.001 '**'
> 0.01 '*' 0.05 '.' 0.1 ' ' 1
> >
> > 2. (I run this from Rcmdr, this is what my students
> would normally do)
> > >AnovaModel.2 <- (lm(eduyrs ~
> cntry*edf, data=ESS1))
> > > Anova(AnovaModel.2)
> > Anova Table (Type II tests)
> > Response: eduyrs
> > Sum
> Sq Df F value Pr(>F)
> > cntry
> 38 1 3.1158
> 0.07763 .
> > edf
> 11010 4 227.6296 < 2e-16 ***
> > cntry:edf
> 24 4 0.4987
> 0.73672
> > Residuals 38754 3205
> > ---
> > Signif. codes: 0 '***' 0.001 '**'
> 0.01 '*' 0.05 '.' 0.1 ' ' 1
> >
> > Unfortunately, the results are different.
> Could anyone, please, explain why?
> >
> >
> > Dr. Iasonas Lamprianou
> >
> >
> > Assistant Professor (Educational Research and
> Evaluation)
> > Department of Education Sciences
> > European University-Cyprus
> > P.O. Box 22006
> > 1516 Nicosia
> > Cyprus
> > Tel.: +357-22-713178
> > Fax: +357-22-590539
> >
> >
> > Honorary Research Fellow
> > Department of Education
> > The University of Manchester
> > Oxford Road, Manchester M13 9PL, UK
> > Tel. 0044 161 275 3485
> > iasonas.lamprianou at manchester.ac.uk
>
> --
> 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