# [R] who can explain the difference between the R and SAS on the results of GLM

From: zhijie zhang <epistat_at_gmail.com>
Date: Wed 05 Jul 2006 - 00:44:38 EST

Dear friends,
I used R and SAS to analyze my data through generalized linear model, and there is some difference between them.

Results from R:

glm(formula = snail ~ grass + gheight + humidity + altitude + soiltemr + airtemr, family = Gamma)

Deviance Residuals:

Min 1Q Median 3Q Max

-1.23873 -0.41123 -0.08703 0.24339 1.21435

Coefficients:

```                   Estimate Std. Error t value Pr(>|t|)

(Intercept)       2.024e-02  1.655e-02   1.223  0.22320

```

grasshuanghuacai 1.321e-02 5.053e-03 2.615 0.00982 **

grasshucao 1.962e-04 1.971e-03 0.100 0.92083

grassyuhao -1.881e-03 2.041e-03 -0.922 0.35810

gheight -1.275e-04 6.288e-05 -2.027 0.04441 *

humidity 6.797e-02 2.278e-02 2.983 0.00332 **

altitudelow -5.090e-03 1.905e-03 -2.671 0.00837 **

soiltemr -8.584e-04 5.165e-04 -1.662 0.09858 *.* #is it show that soiltemr maybe significant at a=0.05???

airtemr 6.547e-05 1.803e-04 0.363 0.71695

```---

Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

(Dispersion parameter for Gamma family taken to be 0.2745989)

Null deviance: 63.635  on 161  degrees of freedom

Residual deviance: 43.214  on 153  degrees of freedom

AIC: 1527.6

Results From SAS

*proc* *genmod* data=a order=data;

class grass altitude;

model snail = grass gheight humidity altitude soiltemr airtemr

/ dist=gamma type3;

*run*;

Analysis Of Parameter Estimates

Standard   Wald 95% Confidence
Chi-

Parameter                 DF   Estimate      Error          Limits
Square   Pr > ChiSq

Intercept                  1     0.0202     0.0160    -0.0111     0.0516
1.60       0.2052

grass       hucao          1     0.0002     0.0019    -0.0035     0.0039
0.01       0.9179

grass       yuhao          1    -0.0019     0.0020    -0.0057     0.0020
0.91       0.3397

grass       huanghuacai    1     0.0132     0.0049     0.0037     0.0228
7.34       0.0068

grass       diluo          0     0.0000     0.0000     0.0000
0.0000
.          .

gheight                    1    -0.0001     0.0001    -0.0002    -0.0000
4.41       0.0358

humidity                   1     0.0680     0.0220     0.0249     0.1111
9.55       0.0020

altitude    low            1    -0.0051     0.0018    -0.0087    -0.0015
7.66       0.0057

altitude    high           0     0.0000     0.0000     0.0000
0.0000
.          .

soiltemr                   1    -0.0009     0.0005    -0.0018     0.0001
2.96       0.0852

airtemr                    1     0.0001     0.0002    -0.0003     0.0004
0.14       0.7067

Scale                      1     3.9077     0.4170     3.1702     4.8167

NOTE: The scale parameter was estimated by maximum likelihood.

The GENMOD Procedure

LR Statistics For Type 3 Analysis

Chi-

Source           DF     Square    Pr > ChiSq

grass             3      17.60        0.0005

gheight           1       4.26        0.0390

humidity          1       9.11        0.0025

altitude          1       7.67        0.0056

soiltemr          1       2.89        0.0889

airtemr           1       0.14        0.7050

Questions:

1.About the variable soiltemr: R could say it maybe significant at 0.05,
while SAS don't give this information,why was that in R?

2.Their dispersion parameters are different, although they are estimated
automatically,why?

3.From R's Results, i can write my model like this:

snail=1.321e-02* grasshuanghuacai+1.962e-04* grasshucao-1.881e-03*
grassyuhao-1.275e-04*gheight+6.797e-02*humidity-5.090e-03*altitudelow-8.584e-04*soiltemr

is it correct?

thanks very much!

--
Kind Regards,
Zhi Jie,Zhang ,PHD
Department of Epidemiology
School of Public Health
Fudan University
Tel:86-21-54237149

[[alternative HTML version deleted]]

______________________________________________
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help