2.10 Cubic Spline Interpolation
The method of least squares provides, among other things, an alternative to ordinary interpolation that avoids the problem of overfitting. Another alternative is spline interpolation, which encompasses a range of interpolation techniques that reduce the effects of overfitting. The method of cubic spline interpolation presented here is widely used in finance. It applies only in one dimension, but is useful for modeling yield curves, forward curves, and other term structures.
A cubic spline is a function f : → constructed by piecing together cubic polynomials pk(x) on different intervals [x[k], x[k+1]]. It has the form
Consider points (x, y), (x, y), … , (x[m], y[m]), with x < x < … < x[m]. We construct a cubic spline by interpolating a cubic polynomial pk between each pair of consecutive points (x[k], y[k]) and (x[k+1], y[k+1]) according to the following constraints:
- Each polynomial passes through its respective end points:
- First derivatives match at interior points:
- Second derivatives match at interior points:
- Second derivatives vanish at the end points:
The above conditions specify a system of linear equations that can be solved for the cubic spline. In practice, it makes little sense to fit a cubic spline to fewer than five points. However, for the purpose of illustration, let’s interpolate a cubic spline between just three points.
Consider the points (x[k], y[k]) = (1, 1), (2, 5), (3, 4). We seek to fit a cubic polynomial on the interval [1, 2] and another cubic polynomial on the interval [2, 3]. These take the forms
Our first condition requires
The second condition requires
The third condition requires
Finally, the last condition requires
We have eight equations in eight unknowns. These can be expressed as
which we solve to obtain
Our two polynomials are
The cubic spline, along with the three points upon which it is based, is shown in Exhibit 2.15.
Interpolate a cubic spline between the three points (0, 1), (2, 2) and (4, 0).