Actuarial Notes

Deviance

Study guides: Exam MAS-I, Exam PCPA

The Deviance of a Generalized Linear Model measures how far the fitted model is from the saturated model, the model with one parameter for each observation, which fits every observation exactly. The scaled deviance is twice the difference between the maximized log-likelihoods of the saturated model and the fitted model:

D^* = 2\left[\,l_{\text{sat}} - l(\hat{\boldsymbol{\beta}})\,\right]

  • l_{\text{sat}} is the maximized log-likelihood of the saturated model.
  • l(\hat{\boldsymbol{\beta}}) is the maximized log-likelihood of the fitted model.

The deviance, also called the unscaled deviance, is the scaled deviance multiplied by the dispersion parameter \phi:

D = \phi\, D^*

For the Poisson and the binomial, \phi = 1, so the two are equal. The deviance is never negative, and the saturated model has deviance 0. A smaller deviance means a fitted model closer to the saturated model, which is a better fit. As a function of the coefficients, the deviance is smallest where the log-likelihood is largest, so its minimum is at the maximum likelihood estimate.

Deviance of common distributions

For a normal response with the identity link, the deviance is the residual sum of squares:

D = \sum_{i=1}^{n} (y_i - \hat{\mu}_i)^2

For a Poisson response, the deviance is

D = 2\sum_{i=1}^{n}\left[\,y_i \ln\frac{y_i}{\hat{\mu}_i} - (y_i - \hat{\mu}_i)\right]

  • A term with y_i = 0 has y_i \ln(y_i/\hat{\mu}_i) = 0.

A Poisson GLM gives fitted means 3, 4 and 1 for observed counts 2, 5 and 1. What is its deviance?

  • The first observation contributes 2 \ln\frac{2}{3} - (2 - 3) = 0.1891.
  • The second contributes 5 \ln\frac{5}{4} - (5 - 4) = 0.1157.
  • The third has y_i = \hat{\mu}_i, so it contributes 0.
  • The deviance is 2(0.1891 + 0.1157) = 0.6096.

Comparing nested models

When a smaller model is nested in a larger one, the drop in scaled deviance tests whether the extra parameters improve the fit. When \phi is known, the test statistic is

D^*_{\text{small}} - D^*_{\text{large}}

  • Under the hypothesis that the smaller model is adequate, it has approximately a chi-squared distribution with degrees of freedom equal to the number of extra parameters in the larger model.

This is the likelihood ratio test. In the same way, the scaled deviance of one model can be compared with a chi-squared distribution with n - k degrees of freedom to test its fit, where k is the number of estimated coefficients.

A Poisson GLM with only an intercept has deviance 45.2 on 49 degrees of freedom. Adding territory, with 3 levels, gives deviance 30.8 on 47 degrees of freedom. Does territory improve the model at the 5% level?

  • For a Poisson model \phi = 1, so the statistic is 45.2 - 30.8 = 14.4.
  • Territory adds 49 - 47 = 2 parameters, so the statistic is compared with a chi-squared distribution with 2 degrees of freedom.
  • The 5% critical value is 5.991, and 14.4 > 5.991, so territory improves the model.

The F test when the dispersion is estimated

When \phi is estimated, as for a normal or a gamma response, nested models are compared with the F statistic

F = \frac{(D_{\text{small}} - D_{\text{large}})/r}{D_{\text{large}}/(n - k_{\text{large}})}

  • r is the number of extra parameters in the larger model.
  • k_{\text{large}} is the number of estimated coefficients in the larger model.
  • F has r and n - k_{\text{large}} degrees of freedom.

The denominator is the larger model's estimate of \phi, which may instead be its Pearson estimate.

A normal linear model has residual sum of squares 520 on 46 degrees of freedom. Adding an interaction with 2 coefficients lowers it to 400 on 44 degrees of freedom. Is the interaction significant at the 5% level?

  • For a normal response the deviance is the residual sum of squares, so the drop is 520 - 400 = 120.
  • The statistic is F = \frac{120 / 2}{400 / 44} = \frac{60}{9.091} = 6.6.
  • The 5% critical value of F with 2 and 44 degrees of freedom is 3.21, and 6.6 > 3.21, so the interaction is significant.

Scaled and unscaled deviance named the other way round Dobson and Barnett call 2[\,l_{\text{sat}} - l(\hat{\boldsymbol{\beta}})\,] the deviance, which is the scaled deviance D^* on this page. Check which quantity a question gives before dividing by \phi. For the Poisson and the binomial, \phi = 1 and the two are equal.

Practice questions

Actuarial Notes