← Back to Blog
Exam Guides2027-02-276 min read

Link Functions and Deviance in Generalized Linear Models

Understand the role of link functions and deviance in GLM fitting and diagnostics for Exam MAS-I.

The Role of Link Functions

In a generalized linear model (GLM), the link function g connects the expected value of the response to the linear predictor. The relationship is g(mu_i) = eta_i = x_i' * beta, where mu_i = E[Y_i] is the expected response for observation i and eta_i is the linear predictor. The link function determines how changes in the covariates translate into changes in the expected response. Choosing the right link function is essential for model interpretability and for ensuring that fitted values fall within the valid range for the response distribution.

Without a link function, a linear model would predict E[Y] = x'*beta, which can take any real value. But if Y is a count (which must be non-negative) or a probability (which must be between 0 and 1), unrestricted linear prediction produces impossible fitted values. The link function constrains the fitted values to the appropriate range while maintaining the convenience of a linear predictor.

Common Link Functions

The identity link g(mu) = mu is used for Normal responses where the expected value can be any real number. It provides the simplest interpretation: a one-unit increase in x_j changes E[Y] by beta_j units. This is standard linear regression.

The log link g(mu) = ln(mu), equivalently mu = exp(eta), ensures that fitted values are always positive. It is the canonical link for the Poisson distribution and is also widely used with Gamma severity models. With the log link, a one-unit increase in x_j multiplies E[Y] by exp(beta_j). If beta_j = 0.10, the multiplicative factor is exp(0.10) = 1.105, representing a 10.5% increase. This multiplicative interpretation is natural for insurance rating factors.

The logit link g(mu) = ln(mu/(1-mu)), equivalently mu = exp(eta)/(1+exp(eta)), maps probabilities from (0, 1) to the entire real line. It is the canonical link for the Binomial distribution. With the logit link, beta_j represents the change in log-odds for a one-unit increase in x_j. The odds ratio exp(beta_j) is a commonly reported effect size in logistic regression.

Canonical vs. Non-Canonical Links

Each exponential family distribution has a canonical link function that corresponds to its natural parameter. Using the canonical link simplifies the sufficient statistics and ensures certain desirable properties of the maximum likelihood estimator. However, the canonical link is not always the best practical choice.

The Gamma distribution's canonical link is the reciprocal: g(mu) = 1/mu. This link is rarely used in practice because it makes coefficient interpretation difficult and can produce negative fitted values for mu. Instead, the log link is almost universally used with Gamma severity models in insurance pricing. The log link guarantees positive fitted values and provides multiplicative rating factors that are intuitive for actuaries. The trade-off is a slight loss of theoretical simplicity in the estimation equations.

Link Function and Coefficient Interpretation

The link function directly affects how coefficients are interpreted. With an identity link, beta_j is an additive effect: changing x_j by one unit adds beta_j to E[Y]. With a log link, exp(beta_j) is a multiplicative effect: changing x_j by one unit multiplies E[Y] by exp(beta_j). With a logit link, exp(beta_j) is an odds ratio.

For example, in a Poisson GLM for claim frequency with a log link, suppose the coefficient for "young driver" is beta = 0.50. Then exp(0.50) = 1.649, meaning young drivers have 64.9% higher expected claim frequency than the reference group, holding other factors constant. In a Gamma GLM for claim severity with a log link, a coefficient of beta = 0.30 for "urban territory" means exp(0.30) = 1.350, indicating 35.0% higher expected severity in urban areas.

Understanding Deviance

The deviance measures the discrepancy between the fitted model and a saturated model (one with as many parameters as observations, fitting the data perfectly). It is defined as D = 2 * (ln(L_saturated) - ln(L_model)), where L denotes the maximized likelihood. The deviance plays a role in GLMs analogous to the residual sum of squares in ordinary linear regression.

For different distributions, the deviance takes specific forms. For the Normal distribution, D = sum((y_i - mu_hat_i)^2), the familiar residual sum of squares. For the Poisson distribution, D = 2 * sum(y_i * ln(y_i / mu_hat_i) - (y_i - mu_hat_i)), where the convention 0 * ln(0) = 0 handles zero counts. For the Gamma distribution, D = 2 * sum(-ln(y_i / mu_hat_i) + (y_i - mu_hat_i) / mu_hat_i). Each formula reflects the specific likelihood structure of the distribution.

Using Deviance for Model Comparison

The scaled deviance D/phi follows approximately a chi-squared distribution with n - p degrees of freedom under the fitted model, where n is the number of observations and p is the number of estimated parameters. A large deviance relative to its degrees of freedom suggests poor model fit.

To compare nested models, compute the difference in deviances: Delta_D = D_reduced - D_full. Under the null hypothesis that the reduced model is correct, Delta_D / phi follows approximately a chi-squared distribution with degrees of freedom equal to the difference in the number of parameters. This is the GLM analog of the F-test in linear regression. For Poisson and Binomial models where phi = 1, the test is exact (up to the chi-squared approximation). For Gamma and Normal models, phi must be estimated, and the test uses an F-distribution instead.

Deviance Residuals

Deviance residuals are defined as r_i^D = sign(y_i - mu_hat_i) * sqrt(d_i), where d_i is the individual contribution of observation i to the total deviance (D = sum(d_i)). Deviance residuals are approximately standard normal for a well-fitting model, making them useful for diagnostic plots. Plots of deviance residuals against fitted values, covariates, or observation order help identify model misspecification, outliers, and non-linear effects.

Pearson residuals r_i^P = (y_i - mu_hat_i) / sqrt(V(mu_hat_i) * phi) provide an alternative. For Normal models, Pearson and deviance residuals are identical. For Poisson and Gamma models, they differ; deviance residuals are generally preferred because they tend to be more normally distributed, making diagnostic plots easier to interpret.

Common Pitfalls

A frequent mistake is interpreting coefficients without considering the link function. A coefficient of 0.5 means very different things under identity (additive), log (multiplicative: exp(0.5) = 1.65), and logit (odds ratio: exp(0.5) = 1.65) links. Always state the link function when reporting coefficient interpretations.

Another error is comparing deviances across models with different response distributions. Deviance values are meaningful only for comparing models within the same distributional family. Comparing the deviance of a Poisson model to that of a Gamma model is not valid because the saturated model likelihoods differ.

Study Tips

Exam MAS-I tests link function selection, deviance computation, and model comparison using deviance differences. Memorize the deviance formulas for Normal, Poisson, and Gamma distributions. Know the canonical link for each distribution and understand when a non-canonical link is preferred. Practice interpreting coefficients under different link functions, especially the log link (multiplicative effects) and logit link (odds ratios). Be prepared to perform a deviance-based test for comparing nested GLMs, including computing the test statistic and determining degrees of freedom.

Ready to practice?

Put this knowledge to work with flashcards and practice exams.

Start Studying Free