[R] Type I and Type III SS in anova

John Fox jfox at mcmaster.ca
Fri Sep 26 14:55:51 CEST 2008


Dear Stefan,

One place is my Applied Regression text (Sage, 1997 or 2008).

Regards,
 John

------------------------------
John Fox, Professor
Department of Sociology
McMaster University
Hamilton, Ontario, Canada
web: socserv.mcmaster.ca/jfox


> -----Original Message-----
> From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org]
On
> Behalf Of Stefan Uhmann
> Sent: September-26-08 8:20 AM
> To: r-help at r-project.org
> Subject: Re: [R] Type I and Type III SS in anova
> 
> Dear list,
> 
> slightly OT: can you recommend me any sources where I can find more
> about this Type I - II - III anova problem? It seems as my statistics
> courses did not cover this issue, so I feel rather naive and have this
> sort of feeling that some of my analyses might be complete nonsense.
> 
> Regards,
> Stefan
> 
> John Fox schrieb, Am 26.09.2008 12:36:
> > Dear Menelaos,
> >
> >> -----Original Message-----
> >> From: r-help-bounces at r-project.org
[mailto:r-help-bounces at r-project.org]
> > On
> >> Behalf Of Menelaos Stavrinides
> >> Sent: September-25-08 9:56 PM
> >> To: r-help at r-project.org
> >> Subject: [R] Type I and Type III SS in anova
> >>
> >> Hi all,
> >> I have been trying to calculate Type III SS in R for an unbalanced
two-way
> >> anova. However, the Type III SS are lower for the first factor compared
to
> >> type I but higher for the second factor (see below). I have the
impression
> >> that Type III are always lower than Type I - is that right?
> >
> > No.
> >
> >> And a clarification about how to fit Type III SS. Fitting
> > model<-aov(y~a*b)
> >> in the base package and then loading car / changing contrasts / running
> >> Anova(model,type=c("III")) gives different results compared to loading
car
> > /
> >> changing contrasts / fitting model<-aov(y~a*b) / running
> >> Anova(model,type=c("III")). However summary(model) gives the same
results
> > in
> >> both cases. Is this how it is set up?
> >
> > If you use "type-III" tests in an unbalanced ANOVA, and want to test
> > sensible hypotheses, you should use an orthogonal row-basis for the
> effects,
> > such as is provided by contr.helmert, contr.poly, or contr.sum, but not
by
> > the default contr.treatment. When you fit a model before changing the
> > contrast type, contr.treatment is used. Changing the contrast type
> > subsequent to that has no effect on a model that's already fit (how
could
> > it, unless, e.g., the model is updated?). Because the summary method for
> aov
> > objects reports "typei-I" (sequential) tests, the results are
independent
> of
> > the contrast type.
> >
> > Regards,
> >  John
> >
> >>> local({pkg <- select.list(sort(.packages(all.available = TRUE)))
> >> + if(nchar(pkg)) library(pkg, character.only=TRUE)})
> >>> options(contrasts=c("contr.helmert","contr.poly"))
> >>> model2<-aov(tdrate~temp*sex)
> >>> summary(model2)
> >>              Df   Sum Sq  Mean Sq   F value  Pr(>F)
> >> temp          3 0.110137 0.036712 1005.6947 < 2e-16 ***
> >> sex           1 0.000141 0.000141    3.8593 0.05095 .
> >> temp:sex      3 0.000154 0.000051    1.4073 0.24206
> >> Residuals   187 0.006826 0.000037
> >> ---
> >> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
> >>> Anova(model2,type=c"III")
> >> Error: unexpected string constant in "Anova(model2,type=c"III""
> >>> Anova(model2,type=c("III"))
> >> Anova Table (Type III tests)
> >>
> >> Response: tdrate
> >>              Sum Sq  Df    F value  Pr(>F)
> >> (Intercept) 0.57549   1 15764.9249 < 2e-16 ***
> >> temp        0.08571   3   782.6314 < 2e-16 ***
> >> sex         0.00023   1     6.2851 0.01303 *
> >> temp:sex    0.00015   3     1.4073 0.24206
> >> Residuals   0.00683 187
> >> ---
> >> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
> >>
> >> --
> >> Menelaos Stavrinides
> >> Ph.D. Candidate
> >> Environmental Science, Policy and Management
> >> 137 Mulford Hall MC #3114
> >> University of California
> >> Berkeley, CA 94720-3114 USA
> >> Tel: 510 717 5249
> >>
> >> 	[[alternative HTML version deleted]]
> >>
> >> ______________________________________________
> >> R-help at r-project.org mailing list
> >> https://stat.ethz.ch/mailman/listinfo/r-help
> >> PLEASE do read the posting guide
> > http://www.R-project.org/posting-guide.html
> >> and provide commented, minimal, self-contained, reproducible code.
> >
> > ______________________________________________
> > R-help at r-project.org mailing list
> > https://stat.ethz.ch/mailman/listinfo/r-help
> > PLEASE do read the posting guide http://www.R-project.org/posting-
> guide.html
> > and provide commented, minimal, self-contained, reproducible code.
> >
> 
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.



More information about the R-help mailing list