[R] lm() output with quantiative predictors not the same as SAS

Ben Bolker bolker at ufl.edu
Wed May 28 17:45:47 CEST 2008


 <alicia.senauer <at> yale.edu> writes:

> 
> I am trying to use R lm() with quantitative and qualitative predictors, but am
> getting different results than those that I get in SAS.
> 
> In the R ANOVA table documentation I see that "Type-II tests corresponds to the
> tests produced by SAS for analysis-of-variance models, where all of the
> predictors are factors, but not more generally (i.e., when there are
> quantitative predictors)." Is this the problem? Is there a way around this so
> that the output matches the results that I am getting in SAS? Is there a
> better/more appropriate way to handle quantitative predictors?

   First of all, it looks you're using Anova, in the car package --
this is an important piece of information.   Second, you're presumably
(you didn't tell us exactly what commands you ran -- this is also
important) using the default type="II" in Anova, vs. SAS type III
sums of squares (as it says in your SAS output), so I wouldn't
expect these to agree.  Third, it's highly questionable whether
type-III SS are appropriate here, in the presence of an interaction
(Treat*Plant) -- you have violated "marginality restrictions" --
see http://www.stats.ox.ac.uk/pub/MASS3/Exegeses.pdf for example.

   While I understand the desire to match the output from SAS,
a better set of questions is "why do these two disagree?  What
are they doing differently?  Which one comes closer to answering
the questions I am really interested in?"  

  Ben Bolker



More information about the R-help mailing list