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

alicia.senauer at yale.edu alicia.senauer at yale.edu
Tue May 27 21:19:24 CEST 2008


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



More information about the R-help mailing list