# Solved – Why do cubic splines need to be continuous at the first and second derivative, but discontinuous at the third

I'm working through Introduction to Statistical Learning and came upon this:

One can show that adding a term of the form $$beta_4h(x,xi)$$ to the model (7.8) $$y_i = beta_0 + beta_1x_i + beta_2x_i^2 + beta_3x_i^3 + epsilon_i$$ for a cubic polynomial will lead to a discontinuity in only the third derivative at ξ; the function will remain continuous, with continuous ﬁrst and second derivatives, at each of the knots.

How can one show this? Why is this the case?

Contents

It's because that's the basis representation of a spline. A higher degree spline actually increases the smoothness of the curve at the risk of having less dramatic directional changes (with the extreme being piecewise linear). The basis representation for a third-order spline with, say, a breakpoint at 5 is equivalent to

$$left[ begin{array}{cccc} 0 & 0 & 0 & 0 \ 1 & 1 & 1 & 0 \ 2 & 4 & 8 & 0 \ 3 & 9 & 27 & 0 \ 4 & 16 & 64 & 0 \ 5 & 25 & 126 & 0 \ 6 & 36 & 216 & 1 \ 7 & 49 & 343 & 8 \ 8 & 64 & 512 & 27 \ 9 & 81 & 729 & 64 \ 10 & 100 & 100 & 126 \ end{array}right]$$

The first column is the linear term, the second column is the quadratic term, the third column is the ordinal cubic term, the fourth column is the breakpoint which is 0 for all values less than the breakpoint and amounts to $$(x – 5)^3$$ for all positive values.

Rate this post