Why Use a Spline for Price Response?
An insurance demand model need not imply that each additional dollar of premium has the same effect on demand at every price. A price increase may have little effect in one range and a stronger effect in another. A polynomial can represent curvature, but its shape is controlled across the entire price range by its powers and coefficients. A spline offers a different approach: it allows the response to change slope at specified price values, called knots, while keeping the fitted mean continuous when that is the intended model.
This tutorial develops piecewise-linear splines for a conditional mean on its original scale and for the logarithm of a conditional mean. The distinction matters: the first has a piecewise-constant marginal effect, while the second has a piecewise-constant effect on log mean and therefore a price-range-specific elasticity. These are mean-model specifications; their use does not by itself determine the distribution of the outcome.
Hinge Terms and Continuity
For a knot \(k\), define the hinge term \((p-k)_+=\max(p-k,0)\), where \(p\) is price. It is zero at and below the knot, and increases linearly above it. With knots \(k_1<\cdots<k_J\), a continuous piecewise-linear response on its original scale can be written as
Below the first knot, the slope is \(\beta_1\). Above knot \(k_r\) but below \(k_{r+1}\), it is \(\beta_1+\gamma_1+\cdots+\gamma_r\). Each \(\gamma_j\) is therefore a change in slope at its knot, not the slope of the segment that begins there. Because the hinge term equals zero at the knot, each term changes the slope without creating a jump in the fitted value.
An anchored version is often easier to construct from segment slopes. If \(m(p_0)=m_0\), the first segment slope is \(s_1\), and the slope changes at knots \(k_1,\ldots,k_J\) are \(\Delta_1,\ldots,\Delta_J\), then
This representation is continuous at every knot. To see why, consider a knot \(k_r\). Its own hinge term is zero at \(p=k_r\), and all later hinge terms are also zero there. Just below the knot, the \(r\)th hinge is zero; just above it, the term \(\Delta_r(p-k_r)\) tends to zero as \(p\) approaches \(k_r\). Thus the values from the two sides agree. The new term changes the slope above the knot by \(\Delta_r\), which proves the slope-change interpretation.
Continuity is a modeling choice, not a universal requirement. If crossing a contractual threshold is expected to cause an actual jump in demand, a model may include an indicator term such as \(\delta I(p>k)\) in addition to any spline terms. That term changes the fitted value at the threshold; it should not be added merely because the slope changes. The analyst should specify how the threshold equality is coded and have a substantive reason for allowing a jump.
Marginal Effects and Local Elasticity
Within an interval that does not include a knot, the derivative \(m'(p)\) is the local marginal effect: the change in the modeled conditional mean for a small one-dollar increase in price. At a knot where the slope changes, the ordinary two-sided derivative does not exist unless the slopes on both sides agree. One-sided marginal effects can still be reported.
The formula follows directly from the chain rule: \(d\ln m/d\ln p=(d\ln m/dp)/(d\ln p/dp)\). Since \(d\ln m/dp=m'(p)/m(p)\) and \(d\ln p/dp=1/p\), their ratio is \(pm'(p)/m(p)\). This explains why the same marginal effect can imply different elasticities at different prices or mean levels.
A log-mean spline instead specifies \(\ln m(p)=\eta(p)\) as a piecewise-linear function. Then \(m(p)=\exp(\eta(p))\), so \(m'(p)=m(p)\eta'(p)\), and the point elasticity simplifies to \(p\eta'(p)\). The slope of \(\eta\) is not the marginal change in the original mean; it is the marginal change in log mean. The exponential link keeps the modeled mean positive, but does not make the elasticity constant unless the model is linear in log price.
Worked Example: Build an Anchored Spline and Correctly Evaluate Its Upper Segment
A hypothetical insurer models expected policies purchased, \(m(p)\), as a function of annual premium \(p\) in dollars. The fitted mean at \(p=\$50\) is 40 policies. The intended continuous piecewise-linear model has knots at \(\$50\) and \(\$100\), with segment slopes \(-0.20\), \(-0.60\), and \(0.10\) policies per dollar, respectively. Write the anchored model and find the mean and elasticity at \(p=\$120\). Treat the given values and slopes as fixed model inputs; no probability distribution for the policy count is needed to evaluate this conditional-mean model.
Method. Anchor at \(p_0=50\), with \(m_0=40\) and first slope \(s_1=-0.20\). At the first knot, the slope change is \(\Delta_1=-0.60-(-0.20)=-0.40\). At the second knot, it is \(\Delta_2=0.10-(-0.60)=0.70\). Therefore,
At \(p=120\), the two hinge terms are \((120-50)_+=70\) and \((120-100)_+=20\). Substitution gives
As a check, the mean is 40 at \(p=50\). From \(\$50\) to \(\$100\), it falls by \(0.60(50)=30\), giving \(m(100)=10\). From \(\$100\) to \(\$120\), it rises by \(0.10(20)=2\), giving \(m(120)=12\), consistent with the hinge calculation.
The applicable slope above \(\$100\) is \(0.10\). Hence the point elasticity at \(\$120\) is
The elasticity is positive because this model’s fitted mean increases in that upper price range. This may be unexpected for demand and deserves substantive scrutiny, but the sign must not be changed to match an expectation. Common mistake avoided: treating \(-0.40\) and \(0.70\) as the slopes of the later segments. They are slope changes; the segment slopes are \(-0.20\), \(-0.20-0.40=-0.60\), and \(-0.20-0.40+0.70=0.10\).
Reading a Spline Across Price Ranges
Once a spline is specified, a reliable calculation proceeds by identifying the price interval first. Then determine the mean at that price, determine the slope in that interval, and only then calculate the elasticity. The order prevents using a correct slope with a mean from the wrong segment. It also makes clear whether a reported marginal effect is measured in policies per dollar, purchases per dollar, or another outcome unit.
Worked Example: Calculate the Marginal Effect and Elasticity Below a Knot
For a hypothetical rating product, suppose expected purchases follow a continuous level-mean spline anchored at \(m(40)=60\) policies per rating period. Its slope is \(-0.40\) policies per dollar through \(p=\$70\), and \(-0.20\) policies per dollar above \(\$70\). Evaluate the model at \(p=\$80\) and calculate its local marginal effect and elasticity. These are stipulated parameters of a fitted mean model, not observations from an actual insurer.
Method. The first slope is \(-0.40\). The change in slope at \(\$70\) is \(-0.20-(-0.40)=0.20\). Thus the continuous model is
Since \(\$80\) is above the knot, \((80-70)_+=10\). The mean is
Above \(\$70\), the slope is \(-0.40+0.20=-0.20\) policies per dollar. Therefore the marginal effect at \(\$80\) is \(-0.20\), and the point elasticity is
As a continuity check, \(m(70)=60-0.40(30)=48\). The mean at \(\$80\) is 10 dollars farther into the next segment, so \(48-0.20(10)=46\), agreeing with the hinge model. The elasticity is negative, as expected for a decreasing mean in this interval. Common mistake avoided: using the first-segment slope \(-0.40\) at \(\$80\). The slope change at \(\$70\) makes the applicable slope \(-0.20\).
Log-Mean Splines
A level-mean spline can predict a negative mean if extended far enough, even though a conditional mean such as expected purchases must be nonnegative. A log-mean spline avoids negative predictions by modeling \(\eta(p)=\ln m(p)\) and setting \(m(p)=\exp(\eta(p))\). Its hinge construction is continuous in \(\eta\), and therefore also continuous in \(m\), because the exponential function is continuous. The segment slopes of \(\eta\) determine elasticities directly.
Worked Example: Calculate Elasticity From a Log-Mean Spline
A hypothetical portfolio models the expected number of purchase events per eligible account, \(m(p)\), with a log link. The fitted model is
where price is in dollars. Find the fitted mean and elasticity at \(\$90\) and \(\$110\). Treat this as a specified conditional-mean model; the calculation does not require an assumption that the event count has a Poisson distribution.
Method. Below \(\$80\), the log-mean slope is \(-0.010\). Between \(\$80\) and \(\$100\), it is \(-0.010+0.006=-0.004\). Above \(\$100\), it is \(-0.010+0.006-0.004=-0.008\).
At \(\$90\), the hinge terms are \((90-80)_+=10\) and \((90-100)_+=0\). Thus
so \(m(90)=4e^{-0.24}\approx3.1465\) events per account. The log-mean slope in this interval is \(-0.004\), giving
At \(\$110\), the hinge terms are 30 and 10. Therefore,
so \(m(110)=4e^{-0.36}\approx2.7907\) events per account. The log-mean slope above \(\$100\) is \(-0.008\), so
The upper-range elasticity is more negative even though the model remains continuous at \(\$100\); continuity does not require equal slopes. Common mistake avoided: treating \(-0.008\) as the marginal effect on the original mean. It is the slope of log mean; the original-scale marginal effect is \(m(p)\eta'(p)\).
Modeling Choices and Common Exam Traps
A spline makes the response more flexible, but its flexibility is local to the chosen knots and intervals. A knot should correspond to a planned modeling choice or a plausible change in response, not be interpreted as proof that customer behavior changes abruptly at that exact price. The fitted curve should also be interpreted over the price range for which there is relevant data: a linear segment continues indefinitely in the algebra, but that does not make far-out extrapolation credible.
- Do not confuse a slope change with a segment slope. In a hinge model, add the active changes in slope to the initial slope.
- Use the correct mean in the elasticity denominator. Elasticity depends on both the local slope and the fitted mean at the price being evaluated.
- Check the scale of the model. A level-mean slope is an original-scale marginal effect. A log-mean slope gives elasticity only after multiplication by price.
- Handle knots explicitly. If the slopes differ, the derivative at the knot is not unique. Report one-sided effects or state a convention; do not imply the ordinary derivative exists.
- Do not force continuity when the application calls for a jump. Conversely, an ordinary hinge spline already enforces continuity and does not need separate segment intercepts.
Check Your Understanding
For each question, identify the applicable segment before calculating. Answers are provided at the end of each problem.
- A hypothetical level-mean demand model has \(m(40)=30\), slope \(-0.25\) through \(\$70\), slope \(-0.10\) from \(\$70\) through \(\$100\), and slope \(0.05\) above \(\$100\). Write its anchored hinge form and calculate \(m(120)\) and the elasticity at \(\$120\). (Answer: \(m(p)=30-0.25(p-40)+0.15(p-70)_++0.15(p-100)_+\); \(m(120)=20.5\); elasticity \(=0.2927\).)
- A continuous level-mean spline has \(m(30)=50\), slope \(-0.50\) through \(\$50\), and slope \(-0.20\) above \(\$50\). Find its mean and elasticity at \(\$45\). (Answer: \(m(45)=42.5\); elasticity \(=-0.5294\).)
- A log-mean model is \(\ln m(p)=\ln 5-0.008(p-50)+0.005(p-80)_+\), with price in dollars. Find \(m(90)\) and its elasticity. (Answer: \(m(90)=5e^{-0.27}\approx3.8169\); elasticity \(=-0.2700\).)
- A level-mean spline is \(m(p)=70-0.30(p-40)+0.10(p-60)_+\). Find the left- and right-hand slopes at the \(\$60\) knot and determine whether there is a jump in fitted mean there. (Answer: left slope \(=-0.30\), right slope \(=-0.20\); no jump; \(m(60)=64\) from both sides.)
- A level-mean spline has \(m(50)=36\), slope \(-0.40\) below \(\$80\), and slope \(0.10\) above \(\$80\). Find the mean and the left- and right-hand elasticities at \(\$80\). (Answer: \(m(80)=24\); left elasticity \(=-1.3333\); right elasticity \(=0.3333\).)