I'm working on a problem involving fitting a GLM to data and I'm curious about how R calculates the dispersion parameter. For example, I have this output for the summary of my GLM.
glm(formula = Lifespan ~ glucose + Temperature, family =
Gamma(link = "inverse"),
data = dat)
Deviance Residuals:
Min 1Q Median 3Q Max
-2.2337 -0.7800 -0.1906 0.3331 2.1397
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 0.455352 0.048656 9.359 < 2e-16 ***
glucose -0.066062 0.015573 -4.242 3.41e-05 ***
Temperature -0.007778 0.001248 -6.233 2.73e-09 ***
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
(Dispersion parameter for Gamma family taken to be 0.6810965)
Null deviance: 172.16 on 199 degrees of freedom
Residual deviance: 135.52 on 197 degrees of freedom
AIC: 1207.6
Number of Fisher Scoring iterations: 6
My question is, how does R calculate the dispersion parameter to be equal to 0.6810965? I've tried looking at the documentation for the GLM function but I can't seem to find it.
As a follow-up question too, I tried changing the summary so that the dispersion is one, and this doesn't affect the AIC value or the null/residual deviances, so how can I tell if my model fits better with dispersion 1 or the given dispersion in the output, 0.68?