Skip to main content

Section 24.1 Weak points of spline interpolation

Looking closely at FigureĀ 23.2.4 we can notice that the blue curve is not quite an increasing function: there is a small interval in which it decreases. This is not really logical since the curve follows the data (cumulative number of recovered cases) which cannot decrease. A smaller example is below.

x = 1:6;
y = [0 0 1 1 2 2];
t = linspace(1, 6, 1000);
plot(t, spline(x, y, t), x, y, 'r*')

So, cubic splines do not preserve monotonicity (while piecewise linear interpolation does). Note that SU COVID dashboard later replaced splines with piecewise linear functions, which are monotone when the data values are monotone.

Another issue is that spline interpolation may produce negative values from positive data.

x = 1:6;
y = [9 9 1 1 9 9];
disp(spline(x, y, 3.5))

The result is \(-0.4\text{.}\) This becomes a serious issue if the quantity being interpolated cannot in principle be negative (mass, density, number of people) and if the way in which the data is used relies on it not being negative (maybe one takes square root or plots the data on logarithmic scale).

Note again that this is something that piecewise linear interpolation would not do. A piecewise linear function through points with \(y_k > 0\) stays positive.