Why Use Piecewise-Linear Effects?
A continuous rating predictor may have a relationship with expected loss that changes gradually but not at a constant rate. For example, the log of a hypothetical vehicle’s expected claim cost might rise more quickly with annual mileage up to a threshold and more slowly above it. A single straight-line effect cannot represent that change in slope, while assigning a separate factor to each mileage band can create abrupt jumps at the band boundaries.
A piecewise-linear effect offers a middle ground: the fitted relationship is linear within each interval, its slope can change at specified thresholds, and the fitted effect remains continuous at those thresholds. Under a log link, the change in the predictor’s effect translates into a continuous change in the fitted mean and its relativities.
Model Form and Interval Slopes
Suppose \(x\) is a continuous rating predictor and \(\kappa_1<\kappa_2<\cdots<\kappa_K\) are specified thresholds. With a log link, a model for a positive mean rate \(\mu\), conditional on other predictors \(z\), can be written as
Here, \(\alpha\) is the intercept, \(z^\mathsf{T}\beta\) represents the contribution of other predictors, \(\beta_1\) is the slope in the first interval, and \(\gamma_j\) is the change in slope at threshold \(\kappa_j\). If the modeled response is a total expected loss for exposure \(e\), the corresponding log-mean model typically includes the offset \(\log e\). When comparing rates, that common exposure offset is not part of the rating effect.
The coefficient \(\gamma_j\) is not the slope above its threshold by itself. It adds to the slope already in effect. Thus, below the first threshold the slope is \(\beta_1\); after crossing the first threshold it is \(\beta_1+\gamma_1\); and after crossing the first two it is \(\beta_1+\gamma_1+\gamma_2\). In general, between \(\kappa_m\) and \(\kappa_{m+1}\), the slope is \(\beta_1+\sum_{j=1}^{m}\gamma_j\), with the first interval’s slope equal to \(\beta_1\).
At a threshold, the left and right slopes can differ, so the derivative need not exist there. But the fitted effect itself does not jump: the hinge term is exactly zero at its threshold and approaches zero as \(x\) approaches it from either side. The model therefore changes direction or steepness without imposing an abrupt relativity change.
Calculating a Relativity Across Thresholds
For two risks with the same values of all other predictors, their fitted mean ratio depends on the difference in their log means. If \(x_a\) and \(x_b\) are their predictor values, then
Equivalently, calculate the log-mean change interval by interval: multiply each interval’s slope by the distance traveled within that interval, add those changes, and exponentiate. The resulting ratio is a fitted relativity for \(x_b\) versus \(x_a\), conditional on the other predictors being held fixed. It is not automatically a causal effect or a comparison of observed averages.
Start with \(\beta_1\) and add each hinge coefficient once its threshold has been crossed.
Break the range from \(x_a\) to \(x_b\) at every threshold lying between them.
Multiply each interval’s slope by the distance traveled in that interval and sum.
The exponential of the total log-mean change is the fitted mean ratio.
Worked Applications
Worked Example: One Threshold and a Relativity Across It
A hypothetical rating model has log-mean effect \(\eta(x)=\beta_0+0.014x-0.004(x-20)_+\), where \(x\) is measured in the stated units and all other predictors are held fixed. Find the slopes below and above 20, then calculate the fitted mean relativity at \(x=30\) versus \(x=10\).
Method. Read the hinge coefficient as a slope change, then accumulate the log-mean change on each side of the threshold. This avoids treating the hinge coefficient as the entire post-threshold slope.
For \(x\leq20\), the hinge is zero, so the slope is \(0.014\). For \(x>20\), the slope is \(0.014-0.004=0.010\).
From \(x=10\) to \(x=20\), the predictor travels 10 units at slope \(0.014\), giving a log-mean change of \(0.014(10)=0.140\). From \(x=20\) to \(x=30\), it travels 10 units at slope \(0.010\), giving \(0.010(10)=0.100\). The total change is \(0.140+0.100=0.240\).
The fitted mean relativity is \(\exp(0.240)=1.271249\ldots\), or 1.2712 to four decimal places. Thus, the fitted mean at 30 is about 1.2712 times the fitted mean at 10, with other predictors held fixed.
Check. The total distance is \(10+10=20\) units, and the log change includes both intervals. The result is greater than 1 because both interval slopes are positive.
Worked Example: Two Thresholds and Three Slopes
For a hypothetical risk classification, suppose the log-mean effect is \(\eta(x)=\beta_0+0.010x+0.012(x-15)_+-0.014(x-35)_+\). Determine the slope in each interval and the fitted mean relativity at \(x=40\) versus \(x=10\).
Method. Add hinge coefficients cumulatively to obtain each interval’s slope, then calculate the log change across each portion of the comparison.
Below 15, neither hinge is active, so the slope is \(0.010\). From 15 to 35, the first hinge is active and the second is not; the slope is \(0.010+0.012=0.022\). Above 35, both hinges are active, so the slope is \(0.010+0.012-0.014=0.008\).
From 10 to 15, the log-mean change is \(0.010(5)=0.050\). From 15 to 35, it is \(0.022(20)=0.440\). From 35 to 40, it is \(0.008(5)=0.040\). Therefore, the total log-mean change is \(0.050+0.440+0.040=0.530\).
The fitted mean relativity is \(\exp(0.530)=1.698930\ldots\), or 1.6989 to four decimal places. The fitted mean at 40 is about 1.6989 times the fitted mean at 10, all other predictors held fixed.
Check. The three traveled distances sum to \(5+20+5=30\), matching \(40-10\). The final slope is positive, so the last five units add to the log mean even though the slope has decreased.
Worked Example: Predictor Units and a Rate Relativity
A hypothetical model uses annual mileage \(x\) measured in thousands of miles, with log-rate effect \(\eta(x)=\beta_0+0.025x-0.010(x-8)_+\). A vehicle with \(x=4\) has a fitted annual rate of \$240. Find the model’s slopes on either side of 8 and the fitted annual rate at \(x=12\), holding all other rating variables fixed.
Method. Keep the predictor’s stated units throughout, calculate the rate relativity from the log-mean change, and multiply by the given fitted rate.
Below 8, the slope is \(0.025\) per thousand miles. Above 8, it is \(0.025-0.010=0.015\) per thousand miles. From 4 to 8, the log-rate change is \(0.025(8-4)=0.100\). From 8 to 12, it is \(0.015(12-8)=0.060\). The total is \(0.100+0.060=0.160\).
The rate relativity is \(\exp(0.160)=1.1735109\ldots\). The fitted rate at 12 is therefore \(\$240(1.1735109\ldots)=\$281.6426\ldots\), or \$281.64 to the nearest cent.
Check. The mileage difference is 8 thousand miles, not 8 individual miles. The fitted rate rises because both interval slopes are positive; the rate ratio is greater than 1.
Why the Effect Is Continuous
The hinge construction works because each term activates from zero rather than switching on at a positive value. To see this for one threshold \(\kappa\), consider the effect \(g(x)=\beta_1x+\gamma(x-\kappa)_+\). If \(x\leq\kappa\), then \(g(x)=\beta_1x\). If \(x>\kappa\), then \(g(x)=\beta_1x+\gamma(x-\kappa)\). At the threshold, the value from the first expression is \(\beta_1\kappa\), while the value from the second expression is \(\beta_1\kappa+\gamma(\kappa-\kappa)=\beta_1\kappa\). The two pieces therefore meet at the same value.
The slope changes from \(\beta_1\) to \(\beta_1+\gamma\), but the fitted log mean has no jump. Since the exponential function is continuous, exponentiating the log mean also preserves continuity in the fitted mean. With several thresholds, each added hinge is zero at its own threshold, so the same reasoning applies at every knot.
Common Exam Trap: Confusing a Hinge Coefficient with a Slope
A frequent error is to report \(\gamma\) as the slope above a threshold. In the first worked example, that would give a post-threshold slope of \(-0.004\), which is wrong: \(-0.004\) is only the change from the original slope. The correct post-threshold slope is \(0.014-0.004=0.010\).
Another trap is to use only the last interval’s change when comparing predictor values that lie on opposite sides of a threshold. For the comparison from 10 to 30 in that example, the incorrect calculation \(0.010(10)=0.100\) omits the segment from 10 to 20. The correct log change is \(0.014(10)+0.010(10)=0.240\), and the correct relativity is \(\exp(0.240)=1.2712\) to four decimal places.
Also check units before calculating. If \(x\) is measured in thousands of miles, a change from 4 to 12 represents 8 thousand miles in the model’s units. Substituting an unconverted mileage value would multiply the modeled change by 1,000 and produce a meaningless result.
Check Your Understanding
For each problem, hold other predictors fixed. Relativities are rounded to four decimal places.
- A log-mean effect is \(\eta(x)=\beta_0+0.018x-0.006(x-25)_+\). Find the slopes below and above 25, then find the fitted mean relativity at 35 versus 15. (Answer: slopes \(0.018\) and \(0.012\); log change \(0.300\); relativity \(1.3499\).)
- A model has effect \(\eta(x)=\beta_0+0.012x+0.009(x-10)_+-0.015(x-30)_+\). Find all three interval slopes and the relativity at 40 versus 5. (Answer: slopes \(0.012\), \(0.021\), and \(0.006\); log change \(0.540\); relativity \(1.7160\).)
- A fitted effect is \(\eta(x)=\beta_0+0.004x+0.008(x-50)_+-0.003(x-100)_+\). Find the slopes in all intervals and the relativity at 120 versus 40. (Answer: slopes \(0.004\), \(0.012\), and \(0.009\); log change \(0.820\); relativity \(2.2705\).)
- A model uses \(\eta(x)=\beta_0+b_1x+b_2(x-20)_++b_3(x-50)_+\). Its desired interval slopes are \(0.015\), \(0.009\), and \(0.014\). Find the three coefficients and the fitted mean relativity at 60 versus 10. (Answer: \(b_1=0.015\), \(b_2=-0.006\), \(b_3=0.005\); log change \(0.560\); relativity \(1.7507\).)
- A hypothetical model has effect \(\eta(x)=\beta_0+0.020x-0.010(x-20)_+\). Calculate the fitted mean relativity at 45 versus 5, showing the contribution from each interval. (Answer: log change \(0.550\), from \(0.020(15)+0.010(25)\); relativity \(1.7333\).)
Piecewise-linear effects are a flexible way to express different gradual trends across ranges of a continuous rating predictor while maintaining a continuous fitted rating curve. Their interpretation is most reliable when coefficient changes, predictor units, and all crossed thresholds are handled explicitly.