[R] Difference in ANOVA results - R vs. JMP/Minitab

Nirmal Govind nirmalg at psu.edu
Thu Nov 20 05:49:27 CET 2003

Thanks for your reply John.

> this works). Applied to a linear-model object, summary() produces 
> coefficients, etc. (as mentioned), while anova() produces a (sequential) 
> ANOVA table. This seems apparent to me from the output.

What I'm having trouble with is understanding the difference between 
aov() and lm() [since it seems like if I do a summary() after fitting 
using aov(), the output is the same as doing anova() after an lm()]. 
Now, the outputs from aov() and lm() are different - the siginificant 
effects are different. I think this may have to do with how these 
functions treat the data - i.e.  whether the function considers the data 
as being in coded or uncoded units. Is this correct? From what I could 
tell, aov() will code the data automatically and then present the ANOVA 
table whereas lm() does not code the data. This pretty much explains 
everything so far..

There's one problem though - how do I get the coefficients that are 
calculated from the data after they are coded by aov()? The problem here 
is that my factor levels are 0 and 1 instead of the usual -1 and 1... 
if I run coefficients() after a aov() fit or an lm() fit, I get the same 
coefficients... these coeffs. don't seem right (I compared with the 
coefficients from Minitab and JMP -both give coefficients after coding 
the data into a -1, 1 form).. I could of course modify my data and 
change all the 0 levels to -1 but is there a way in R to get 
coefficients that correspond to coded data?

> More generally, it probably makes sense to read introductory material 
> about R -- such as the introductory manual that comes with the software 

Yes, I have read some of these (and maybe I should read more :-))... 
thanks for the pointer.. on the same note, is there any reference that 
talks about how lm() and aov() treat data - coded vs. uncoded etc...

Thanks a lot for the help.. it is greatly appreciated!

More information about the R-help mailing list