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

From: <alicia.senauer_at_yale.edu>
Date: Tue, 27 May 2008 15:19:24 -0400


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?

For example, output from SAS for one of my response variables:

Source       DF     Type III SS     Mean Square    F Value    Pr > F
Treatment     5      6.92081345      1.38416269       1.17    0.3379
Plantation    2     20.67107509     10.33553754       8.73    0.0006
Treat*Plant  10     22.23762534      2.22376253       1.88    0.0718
Light         1      2.52841104      2.52841104       2.14    0.1504
Litter        1      0.25885309      0.25885309       0.22    0.6421

Output from R

                       Df Sum Sq Mean Sq F value   Pr(>F)
daniela2$Treatment     5  6.982   1.396  1.1799 0.332914
daniela2$Plantation    2 18.905   9.453  7.9869 0.001013 **
daniela2$Light         1  8.037   8.037  6.7909 0.012167 *
daniela2$Litter        1  1.912   1.912  1.6154 0.209860
Treatment:Plantation  10 22.238   2.224  1.8790 0.071831 .
Residuals              48 56.808   1.184


For example, multivariate output from SAS for one of my predictors:

 Statistic        Value       F Value    Num DF    Den DF    Pr > F
Wilks' Lambda  0.69901456       1.18        15    127.39    0.2984
Pillai's Trace 0.32156466       1.15        15       144    0.3159
Hotelling      0.40147329       1.21        15    81.797    0.2835
Roy's GRoot    0.31281143       3.00         5        48    0.0194


>From R:
Df test stat approx F num Df den Df Pr(>F) Pillai 5.0000 0.401037 1.481343 15.0000 144.0000 0.1193910 Wilks 5.0000 0.636571 1.509595 15.0000 127.3871 0.1109964 Hotelling-Lawley 5.0000 0.513082 1.527844 15.0000 134.0000 0.1037152 Roy 5.0000 0.368760 3.540095 5.0000 48.0000 0.0083553 **

Thank you,

Ali



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. Received on Tue 27 May 2008 - 21:38:43 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 https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive