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

From: Ben Bolker <>
Date: Wed, 28 May 2008 15:45:47 +0000 (UTC)

 <alicia.senauer <at>> 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 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 mailing list PLEASE do read the posting guide and provide commented, minimal, self-contained, reproducible code. Received on Wed 28 May 2008 - 18:43:15 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Wed 28 May 2008 - 19:30:42 GMT.

Mailing list information is available at Please read the posting guide before posting to the list.

list of date sections of archive