2
$\begingroup$

I ran a log-linked gamma glm and noticed that the estimated coefficients and AIC did not change when I update the model with a dispersion parameter. However, I did noticed that the standard error of the estimated did change. This brings me to question what other results does the dispersion parameter affects. Does it affects likelihoods, pseudo R square and etc.?

> mod=glm(y~offset(log(years))+as.factor(gender)+age,family=Gamma(link="log"),
+         data=pm,control = glm.control(maxit = 50))
> shape=gamma.shape(mod)
> summary(mod,dispersion = 1/shape$alpha)

Call:
glm(formula = y ~ offset(log(years)) + as.factor(gender) + age, 
    family = Gamma(link = "log"), data = pm, control = glm.control(maxit = 50))

Deviance Residuals: 
    Min       1Q   Median       3Q      Max  
-3.8207  -1.2145  -0.5334   0.1910  15.1410  

Coefficients:
                    Estimate Std. Error z value Pr(>|z|)    
(Intercept)        4.6730931  0.0134128   348.4   <2e-16 ***
as.factor(gender)M 0.7806667  0.0024625   317.0   <2e-16 ***
age                0.0642592  0.0001908   336.8   <2e-16 ***
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

(Dispersion parameter for Gamma family taken to be 1.238619)

    Null deviance: 1519880  on 852449  degrees of freedom
Residual deviance: 1251784  on 852447  degrees of freedom
AIC: 20497381

Number of Fisher Scoring iterations: 8

> summary(mod)

Call:
glm(formula = y ~ offset(log(years)) + as.factor(gender) + age, 
    family = Gamma(link = "log"), data = pm, control = glm.control(maxit = 50))

Deviance Residuals: 
    Min       1Q   Median       3Q      Max  
-3.8207  -1.2145  -0.5334   0.1910  15.1410  

Coefficients:
                    Estimate Std. Error t value Pr(>|t|)    
(Intercept)        4.6730931  0.0200320   233.3   <2e-16 ***
as.factor(gender)M 0.7806667  0.0036777   212.3   <2e-16 ***
age                0.0642592  0.0002849   225.5   <2e-16 ***
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

(Dispersion parameter for Gamma family taken to be 2.762759)

    Null deviance: 1519880  on 852449  degrees of freedom
Residual deviance: 1251784  on 852447  degrees of freedom
AIC: 20497381

Number of Fisher Scoring iterations: 8

> pscl::pR2(mod)
          llh       llhNull            G2      McFadden          r2ML          r2CU 
-1.024869e+07 -1.034377e+07  1.901660e+05  9.192299e-03  1.999506e-01  1.999506e-01 
> drop1(mod)
Single term deletions

Model:
y ~ offset(log(years)) + as.factor(gender) + age
                  Df Deviance      AIC
<none>                1251784 20497381
as.factor(gender)  1  1367517 20539269
age                1  1383277 20544973
> exp(confint(mod))
Waiting for profiling to be done...
                        2.5 %     97.5 %
(Intercept)        103.423488 110.819024
as.factor(gender)M   2.167202   2.198753
age                  1.065840   1.066889

The confidence interval from confint is definitely not correct. I will need to recalculate based on the new standard erorrs.

Edit: I also noticed that the deviance stayed the same in two summary results. As deviance and pseudo R2 are based likelihood, then wouldn't this mean likelihood are not affected by the dispersion parameter? Or was the effect of dispersion cancelled out?

Edit2: I am looking for a more detailed answer with references and perhaps formula.

Edit3: I realized there is no way to adjusted for MLE dispersion when I used drop1 to get likelihood p.

$\endgroup$
3
$\begingroup$

Short answer (I hope to come back and expand on this): dispersion parameter definitely affects likelihood, deviance, confidence intervals, p-values, pseudo-R^2. (Not coefficients. Log-likelihood, deviance, Wald CI width are directly proportional to dispersion parameters.)

With 850,000 observations I would strongly encourage you to try a more complex model (e.g. an additive model on age crossed with gender)?

$\endgroup$
  • $\begingroup$ Thanks. The model was created just to explore the relationship between the dispersion parameter and other measures of fit. Would having the interaction help you with explain the relationship between dispersion and loglikehood etc.? I have added a comment regarding your answer to the question. $\endgroup$ – tatami Oct 20 '17 at 2:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.