Why the Coding of Ordered Categories Matters
Many rating variables have categories with a natural order: for example, a hypothetical device could be rated as having low, moderate, high, or very high usage. The order is meaningful, but it does not by itself tell us how far apart the levels are or how the expected loss changes between them. A model’s coding choice determines what patterns of relativities it can represent.
Two common approaches are to represent the levels with separate indicators or to assign each level a numeric score and fit one score effect. Indicator coding allows each level to have its own fitted effect. Numeric-score coding is more compact, but it imposes a particular pattern: with a log link and a linear score effect, equal score increments have equal multiplicative effects. Choosing between the approaches is therefore a modeling decision, not merely a data-formatting choice.
Two Model Specifications
Consider a GLM with a log link, one ordered rating factor, and other predictors held fixed. Let \(\mu_j\) denote the modeled mean for level \(j\). It might be an expected frequency, severity, or other response mean, depending on the model. Any offset and the contributions of other predictors are held constant in the comparisons below.
With indicator coding, let level 1 be the reference. The model can be written as:
There are \(K-1\) freely estimated level effects. Relative to level 1, the fitted relativity for level \(j\) is \(\exp(\beta_j)\). Because the effects are separately estimated, the model does not require adjacent level relativities to have any particular pattern.
With numeric-score coding, each level is assigned a score \(s_j\), and the model is:
Here \(\gamma\) is one coefficient for the factor. For any two levels \(j\) and \(k\), the fitted relativity of level \(j\) to level \(k\) is:
If scores are consecutive integers, every one-unit step has the same multiplicative effect, \(\exp(\gamma)\). The model does not require that the mean itself increase by a constant dollar amount or frequency amount at each step. Instead, it requires a constant change in the log mean per score unit.
Why Score Coding Imposes a Constant Ratio
The restriction follows directly from the model, rather than from a special property of a particular dataset. Under the numeric-score model, take two levels whose scores differ by one:
If \(s_{j+1}-s_j=1\), this ratio is \(\exp(\gamma)\) for every adjacent pair. The intercept cancels, and the same slope applies at every point on the score scale. More generally, if the score gap is \(c\), the ratio across that gap is \(\exp(\gamma c)\). Thus the spacing of the assigned scores matters: coding levels as 0, 1, 2 assumes equal score steps, while coding them as 0, 1, 3 makes the modeled change from score 1 to score 3 twice the log change from score 0 to score 1.
With \(K\) levels and the same remaining predictors, the indicator specification has \(K-1\) factor parameters, while a one-score model has one. For \(K\geq 3\), the score model is a restricted case of the indicator model when the score values are fixed: its level effects must lie on a straight line as a function of score. With two levels, either coding can represent the same single contrast, provided the score difference is nonzero.
This restriction can be useful when the pattern is genuinely close to a common multiplicative step. It can also be misleading if the relationship bends, reverses, or changes abruptly. Fewer coefficients do not guarantee a better rating model; the fit and the intended use of the model still matter.
Worked Example: Reading Two Sets of Fitted Relativities
A hypothetical property program classifies equipment usage as low, standard, elevated, or intensive. A log-link model uses low as the reference. One fitted indicator model gives coefficients \(0\), \(0.12\), \(0.41\), and \(0.78\), in that order. A separately fitted score model assigns scores 0, 1, 2, and 3 and gives a score coefficient of \(0.25\). Calculate the relativities under both models and identify the restriction imposed by the score model.
Method. Exponentiate each indicator coefficient to obtain its relativity to low usage. For score coding, exponentiate \(0.25\) times the score difference from low usage.
Indicator model. Low usage is the reference, so its relativity is \(\exp(0)=1.000\). The other relativities are:
Score model. The relativities to score 0 are:
The score model has the same adjacent factor at each step: \(\exp(0.25)=1.284\). For example, its score-2 to score-1 relativity is \(\exp(0.25(2-1))=1.284\). The indicator model instead gives an elevated-to-standard ratio of \(\exp(0.41-0.12)=\exp(0.29)=1.336\), which need not equal the other adjacent ratios.
Check. The score-3 relativity is also \(1.284^3\), approximately \(2.117\), matching the direct calculation. Relativities are rounded to three decimals. The common mistake is to assume the score model reproduces all the indicator estimates: it does not, unless those estimates satisfy the imposed linear pattern on the log scale.
Choosing Scores and Checking the Restriction
A score must represent the intended structure of the predictor. If levels are merely ordered, consecutive scores such as 0, 1, 2, and 3 express an additional assumption: each adjacent transition is one equal unit. If the underlying category boundaries or exposure increments differ, equal integer steps may not be appropriate. Alternative scores can represent different spacings, but those spacings should have a defensible interpretation and should be chosen with care.
A practical comparison is to fit the indicator and score specifications using the same response definition, observations, offset, link, and other predictors. Then examine the fitted pattern and the model fit. Since the score specification is a restriction of the indicator specification when the scores are fixed, a likelihood-ratio comparison can be used under the usual GLM conditions for comparing nested models. The difference in parameter counts is \(K-2\) for \(K\geq 2\). For example, with four levels, the indicator model has three factor coefficients and the score model has one, so the difference is two degrees of freedom.
A formal comparison is not a substitute for judgment. A small dataset may not reveal meaningful departures from the score trend, and a statistically detectable departure may not matter for the intended rating use. Review the estimated level effects, their uncertainty, the data support at each level, and whether the imposed pattern is sensible in context. Do not interpret a failure to detect lack of fit as proof that equal adjacent relativities are true.
Worked Example: Calculating Effects With Unequal Scores
A hypothetical fleet program groups annual distance into three ordered bands. The model assigns scores 0, 1, and 3 to the bands and estimates \(\gamma=0.08\) in a log-link model. Calculate the relativity of the highest band to the middle band and the highest band to the lowest band. Explain why these are not the same as applying one adjacent multiplier twice.
Method. Use the score difference in the exponent, rather than the number of category labels crossed.
The highest-to-middle score difference is \(3-1=2\), so:
The highest-to-lowest score difference is \(3-0=3\), so:
For comparison, the lowest-to-middle score increment is one, giving \(\exp(0.08)=1.083\), while the middle-to-highest increment is two, giving \(\exp(0.16)=1.174\). The high-to-low ratio is the product \(1.083\times1.174\), approximately \(1.271\). It would be incorrect to apply the same one-step multiplier twice: the specified score gap from the middle to the highest band is two, not one.
Check. The high-to-low exponent is the sum of the two score gaps, \(1+2=3\), so multiplying the corresponding factors gives \(\exp(0.08)\exp(0.16)=\exp(0.24)\). Relativities are rounded to three decimals. The common mistake is to count category transitions without checking the assigned score differences.
Worked Example: Assessing a Linear Score Pattern
For a hypothetical coverage, an indicator model uses the lowest deductible band as reference and estimates log effects \(0\), \(0.18\), \(0.36\), and \(0.83\) for four ordered bands. The bands are assigned scores 0, 1, 2, and 3. Describe whether the fitted indicator effects follow the exact score pattern and calculate the first and last adjacent relativities.
Method. With equal unit scores, an exact numeric-score pattern requires equal adjacent differences in the log effects. Compare those differences before exponentiating.
The successive differences are:
The first two steps match, but the last is larger. Therefore, these fitted indicator effects do not lie exactly on a straight line in score. The first adjacent relativity is \(\exp(0.18)=1.197\). The last adjacent relativity is \(\exp(0.47)=1.600\).
If a one-slope score model were used, it could not reproduce all four indicator effects exactly. Its fitted slope would be estimated from the full data; it is not obtained just by selecting the first difference or the last difference. The comparison here identifies the restriction, not the score model’s estimated coefficient.
Check. Taking the log of the first and last adjacent ratios returns \(0.18\) and \(0.47\), respectively, confirming they are not equal. Relativities are rounded to three decimals. The common mistake is to compare the raw relativities as though equal additive changes were required; the score model requires equal changes in log means for equal score steps.
Common Mistakes and Practical Implications
- Assuming an order proves equal spacing. Labels such as “low,” “medium,” and “high” establish an order, not equal numerical distances. The score assignment must be justified.
- Confusing equal log changes with equal dollar changes. Under a log link, a constant score effect gives a constant ratio for equal score increments, not a constant addition to the mean.
- Using the category number without checking its meaning. Coding levels 1, 2, 3, and 4 as a numeric predictor imposes a one-unit trend. It does not automatically produce the same result as indicator coding.
- Ignoring score gaps. For scores 0, 1, and 3, the last category is two score units above the middle one. Its ratio is based on that gap.
- Treating a more compact model as automatically superior. A one-coefficient score effect can be more stable when its trend is appropriate, but can obscure genuine differences between levels when it is not.
The distinction matters because a fitted rating factor may be used to compare risks or form indications. Indicator coding preserves level-specific patterns at the cost of more parameters. Numeric-score coding gives a concise, structured trend at the cost of a restriction. Both can be useful; the choice should reflect the predictor’s meaning, the available information, and the observed fit.
Check Your Understanding
For each problem, distinguish the coding assumption from the arithmetic used to obtain the relativity.
- A log-link score model assigns levels scores 0, 1, 2 and estimates a coefficient of \(-0.10\). What is the level-2 to level-0 relativity, and what adjacent relativity does the model impose? (Answer: \(\exp(-0.20)=0.819\); each one-score-unit step has relativity \(\exp(-0.10)=0.905\).)
- An indicator model for three ordered levels has log effects \(0\), \(0.15\), and \(0.50\), with the first level as reference. Find the second-to-first and third-to-second relativities. Do they match a constant adjacent ratio? (Answer: \(\exp(0.15)=1.162\) and \(\exp(0.35)=1.419\); no.)
- A score model assigns scores 2, 5, and 8 to three levels and estimates \(\gamma=0.04\). Calculate the highest-to-lowest relativity. (Answer: \(\exp(0.04(8-2))=\exp(0.24)=1.271\).)
- A factor has five ordered levels. How many factor coefficients are estimated under reference indicator coding and under a one-score model? If the scores are fixed and nonzero-spaced, how many degrees of freedom separate the nested specifications? (Answer: four under indicator coding and one under score coding; the difference is three degrees of freedom.)
- With equal scores 0, 1, 2, and 3, an indicator model has log effects \(0\), \(0.20\), \(0.42\), and \(0.60\). Is the pattern exactly representable by one numeric-score slope? Give the adjacent ratios to support your answer. (Answer: No; the log increments are \(0.20\), \(0.22\), and \(0.18\), giving adjacent ratios \(\exp(0.20)=1.221\), \(\exp(0.22)=1.246\), and \(\exp(0.18)=1.197\).)