next up previous
Next: About this document ... Up: cubic_spline Previous: Cubic Spline Interpolation

Cubic Spline Smoothing

When interpolating we start from reasonably exact tabulated values and require that the interpolating function pass exactly through the values. In curve fitting we generally start with a table of experimental data in which the $y_i$ values are imperfectly known, so come with a confidence interval $[y_i-\sigma_i,y_i+\sigma_i]$, and we require that the fitting function come only reasonably close to the data. The table of experimental data consists of three columns $[x_i,y_i,\sigma_i]$, with the last value specifying the confidence range (commonly one standard deviation).

In cubic spline fitting we relax the requirement that the spline pass exactly through the points and demand only that the spline and its first and second derivatives be continuous:

\begin{displaymath}
S_{i-1}(x_i) = S_i(x_i),   \
S^\prime_{i-1}(x_i) = S^\p...
...  \
S^{\prime\prime}_{i-1}(x_i) = S^{\prime\prime}_i(x_i).
\end{displaymath}

So continuity still leaves $n+3$ degrees of freedom. They are determined by balancing two opposing criteria:
  1. The spline must come reasonably close to the data.
  2. The spline must have low curvature.
We use a chi square measure to quantify how close the spline comes to the data:

\begin{displaymath}
\chi^2 = \sum_{i=0}^{n} \frac{[S(x_i) - y_i]^2}{\sigma_i^2}.
\end{displaymath}

The numerator of each term measures the discrepancy between the spline and the data point. The denominator provides a weight. The higher the uncertainty $\sigma_i$ the farther we are allowed to miss the data point. If the spline is a good representation of the data, so deviations are only caused by statistical fluctuations, the average value of each term in $\chi^2$ is expected to be about one. For reasonably large $n$ the value of $\chi^2$ is then about $n \pm
\sqrt{n}$.

To quantify the curvature we integrate the square of the second derivative, giving

\begin{displaymath}
\int\vert S^{\prime\prime}(x)\vert^2 dx
\end{displaymath}

These constraints are contradictory. Notice that to make the curvature zero, its smallest possible value, the spline would have to have zero curvature -- i.e., a straight line. But that would probably give us a high value of $\chi^2$. On the other hand, we can make $\chi^2$ equal to zero by having the spline interpolate the points exactly, but that would give a high curvature.

Putting these two constraints together, we require that the cubic spline minimize

\begin{displaymath}
W = \rho \chi^2 + \int\vert S^{\prime\prime}(x)\vert^2 dx.
\end{displaymath}

The constant $\rho$ determines the tradeoff between the two contradictory criteria. Putting $\rho = 0$ removes the constraint on $\chi^2$ altogether and allows the spline to become a straight line. Putting $\rho$ very large puts high emphasis on minimizing $\chi^2$, forcing the spline to interpolate without regard to curvature.

Minimizing subject to the continuity requirements leads again to a tridiagonal system that is easily solved to give the coefficients of the cubics.

Making $\rho$ too small allows a high value of $\chi^2$. Making it too large forces an unreasonably small value of $\chi^2$. Usually we have to experiment with the choice. The best value results in $\chi^2$ in the range $n \pm
\sqrt{n}$.

We should consider ``smoothing'' to be a poor substitute for fitting data to a decent model function that has a fundamental basis. When we fit experimental data to a model function we are actually testing our understanding of nature. When we smooth in order to fit to an arbitrary cubic spline, we are merely parameterizing an observation, but not learning something more fundamental.


next up previous
Next: About this document ... Up: cubic_spline Previous: Cubic Spline Interpolation