Actuarial Notes

Categorical Predictor

Study guide: Exam MAS-I

A Categorical Predictor is a predictor variable whose values are a finite set of categories, called levels, such as territory or vehicle type. A categorical predictor with k levels enters a model with an intercept through k - 1 indicator variables, one for each level except a base level. With level 1 as the base level, the linear predictor of observation i is

\eta_i = \beta_0 + \beta_2 x_{i2} + \cdots + \beta_k x_{ik}

  • x_{ij} is 1 if observation i is at level j, and 0 otherwise.
  • \beta_j is the difference in the linear predictor between level j and the base level.

The base level has no indicator, so its effect is part of the intercept, and software reports its coefficient as 0, with 0 degrees of freedom. The intercept is the linear predictor of an observation at the base level of every categorical predictor. The base level is usually the level with the most exposure. Under a log link, e^{\beta_j} is the relativity of level j to the base level. Whether the predictor has any effect is tested on all k - 1 coefficients together, by comparing the models with and without it in a nested-model test based on the deviance.

Territory has levels A, B and C. A Poisson GLM with a log link uses territory A as the base level and gives \hat_B = 0.20 and \hat_C = -0.10. What are the relativities of B and C to A, and of C to B?

  • The relativity of territory B to A is e^{0.20} = 1.221.
  • The relativity of territory C to A is e^{-0.10} = 0.905.
  • The relativity of C to B is the exponential of the difference in their coefficients, e^{-0.10 - 0.20} = 0.741.

Categorical, ordinal and continuous predictors

A predictor is entered according to its type:

Type Example How it enters the model Coefficients
Categorical (nominal) Territory, vehicle type An indicator for each level except the base k - 1
Ordinal Credit tier, limit band As categorical, or as one numeric score k - 1, or 1
Continuous Vehicle age, amount of insurance One term, or banded or transformed 1

The codes of a nominal predictor, such as territory numbers, have no meaningful spacing. Entering them as one numeric predictor imposes a single slope and treats the order of the codes as meaningful, so they are entered as indicators. An ordinal predictor whose levels have unknown spacing is safest entered as indicators. It is entered as one numeric score only if its effect changes steadily from level to level. A continuous predictor is entered as one term only if its effect on the linear predictor is roughly linear. Otherwise it is banded into categories or transformed, for example by its logarithm or a polynomial.

Territories are stored as the codes 1 to 5, and an actuary enters the code as a numeric predictor. What does the model assume, and how should territory be entered?

  • A numeric predictor has one coefficient, so the model assumes the linear predictor changes by the same amount from each territory code to the next.
  • Territory 5 is not "more" than territory 1, so that assumption has no basis.
  • Territory should be entered as a categorical predictor with 4 indicator variables against a base territory.

Binning a continuous predictor

Binning a continuous predictor into ranges and entering it as a categorical predictor gives each bin its own coefficient, so the model can follow an effect that is not linear. Binning has these costs:

  1. It adds parameters, one for each bin after the first.
  2. Each bin has less data, so its estimate is less credible and less stable.
  3. It ignores the variation of the effect within a bin.
  4. Nothing keeps adjacent bins consistent, so the estimates can reverse between neighbouring bins.

Practice questions

Actuarial Notes