[R] ANOVA results in R conflicting with results in other software packages

Simon Blomberg s.blomberg1 at uq.edu.au
Thu Apr 26 04:28:31 CEST 2007


R uses "treatment" contrasts for factors (ie 0/1 coding) by default.
Systat is using "sum" (ie sum to zero) contrasts:  Try this:

options(contrasts=c("contr.sum", "contr.poly")
lm(maladapt~host*increase*size2)->fm
Anova(fm, type="III")

I won't discuss the dangers of "types" of sums of squares and different
contrast codings. That would be tempting the wrath of the gods. See
section 7.18 in the R FAQ. John Fox's "Companion" book also has a brief
discussion (p. 140).

Cheers,

Simon.

-- 
Simon Blomberg, BSc (Hons), PhD, MAppStat. 
Lecturer and Consultant Statistician 
Faculty of Biological and Chemical Sciences 
The University of Queensland 
St. Lucia Queensland 4072 
Australia

Room 320, Goddard Building (8)
T: +61 7 3365 2506 
email: S.Blomberg1_at_uq.edu.au 

The combination of some data and an aching desire for 
an answer does not ensure that a reasonable answer can 
be extracted from a given body of data. - John Tukey.



More information about the R-help mailing list