# [R] accuracy of GLM dispersion parameters

Timothy_Handley at nps.gov Timothy_Handley at nps.gov
Mon Nov 29 20:34:27 CET 2010

```I'm confused as to the trustworthiness of the dispersion parameters
reported by glm. Any help or advice would be greatly appreciated.

Context: I'm interested in using a fitted GLM to make some predictions.
Along with the predicted values, I'd also like to have estimates of
variance for each of those predictions. For a Gamma-family model, I believe
this can be done as Var[y] = dispersion parameter * predicted value ^ 2.
Thus, I'm interested in knowing the dispersion parameter for this fitted
model.

Specifics: The summary function says that my fitted GLM has a dispersion
parameter=15.8. On the other hand, the gamma.dispersion function (MASS)
says that the GLM uses a dispersion parameter of 1.86. I could understand
some modest difference, as the help for gamma.shape() says that the MASS
functions return a more accurate dispersion value than summary(). However,
these two numbers differ by a factor of 8, which is quite a lot. Is this
normal? Would you folks expect such a large difference? Which value should
I trust?

R terminal excerpt:

> summary(tempglm_g2)

Call:
glm(formula = precip_sbi ~ precip_oxx + precip_oxx_sq, family = Gamma(link
= identity),
data = w.combo, start = c(0.1, 0.4, 0.02))

Deviance Residuals:
Min        1Q    Median        3Q       Max
-2.99999  -1.63183  -1.00720   0.04878   8.93461

Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept)    0.09236    0.04834   1.911   0.0583 .
precip_oxx     0.26848    0.35891   0.748   0.4558
precip_oxx_sq  0.05138    0.13418   0.383   0.7024
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

(Dispersion parameter for Gamma family taken to be 15.78978)

Null deviance: 528.73  on 130  degrees of freedom
Residual deviance: 305.81  on 128  degrees of freedom
AIC: -100.33

Number of Fisher Scoring iterations: 5

> library(MASS)
> gamma.shape(tempglm_g2)

Alpha: 0.53807358
SE:    0.05526108
> gamma.dispersion(tempglm_g2)
[1] 1.858482

Thanks,

Tim Handley
Research Assistant
Channel Islands National Park
(Will be working from both CHIS and SAMO)
CHIS Phone: 805-658-5759
SAMO Phone: 805-370-2300 x2412
```