# A spline primer

A spline is a mathematical function. They are used wherever flexibility and smoothness are required, from computer-aided design and cartoon graphics, to the graduation of mortality tables (McCutcheon, 1974). There are numerous different types of spline, but the most common is the spline proposed by Schoenberg (1964). Figure 1 shows Schoenberg splines of degrees 0–3, all of which start in 2015:

Figure 1. Schoenberg (1964) splines of degree 0–3 with first non-zero value from 2015.

Figure 1 illustrates a number of properties of a single Schoenberg spline:

- The splines are local functions, and take the value zero outside their domain.
- The domain of a spline of degree $bdeg$ spans $bdeg+2$ knot points.
- The area under each spline is 1.

As Schoenberg splines are local functions, we need a basis of overlapping splines to span an interval. An example is shown in Figure 2 for cubic splines, which is the most commonly used degree. Such splines are referred to as "natural" cubic splines.

Figure 2. A basis of cubic Schoenberg (1964) splines spanning 2015–2020.

A collection of overlapping Schoenberg splines usually goes by the name of a $B$-spline basis. Such a basis has a number of additional properties:

- To span an interval there will be both splines wholly inside the interval and also splines only partly sitting in the interval. In Figure 2 the former are drawn with solid black lines, while the latter edge splines are drawn with dashed grey lines.
- At any point within the interval there will be $bdeg+1$ splines with a non-zero value. These spline values will sum to 1.
- Outside the interval there are no such guarantees.

In Figures 1 & 2 the knot spacing is equidistant and set at one year. However, neither is a necessary feature of splines:

- Currie, Durban & Eilers (2004) used a five-year knot spacing to model and forecast long-term trends in mortality rates.
- Richards (2021) used half-year knot spacing to model seasonal variation in mortality, and further used variable knot spacing to model the pandemic shock mortality of 2020 and 2021.

Further details of $B$-splines can be found in de Boor (2001). An introduction to their application in mortality modelling (with R code) can be found in Macdonald et al (2018).

**References: **

Currie, I. D., Durban, M. and Eilers, P. H. C. (2004) Smoothing and forecasting mortality rates, *Statistical Modelling*, **4**, 279-298, doi: 10.1191/1471082X04st080oa.

de Boor, C. (2001) A practical guide to splines, *Springer*, ISBN 0-387-95366-3.

Kaishev, V. K., Dimitrova, D. S., Haberman, S. and Verrall, R. J. (2016) *Geometrically designed, variable knot regression splines*, *Computational Statistics*, **31**(3), 10791105, doi: 10.1007/s00180-015-0621-7.

Macdonald, A. S., Richards. S. J. and Currie, I. D. (2018). *Modelling Mortality with Actuarial Applications*, Cambridge University Press, Cambridge.

McCutcheon, J. J. (1979) Some remarks on splines, *Transactions of the Faculty of Actuaries*, 37:421–438. doi: 10.1017/S0071368600008727.

Richards, S. J. (2021) Allowing for shocks in portfolio mortality models, *Longevitas Ltd*.

Schoenberg, I. J. (1964) Spline functions and the problem of graduation. *Proceedings of the American Mathematical Society*, **52**:947–950. doi: 10.1073/pnas.52.4.947.

## Previous posts

### Actuarial cycle time

**Tags:**Filter information matrix by tag: productivity, Filter information matrix by tag: software, Filter information matrix by tag: parallel processing

### Build versus buy

In an earlier blog I quoted extensively from "*The Mythical Man-Month*", a book by the distinguished software engineer Fred Brooks. My blog was admittedly self-interested(!) when it cited arguments made by Brooks (and others) for when it makes sense to buy software instead of writing it yourself. However in place of "buying" one could perhaps bette

**Tags:**Filter information matrix by tag: software, Filter information matrix by tag: ARIMA, Filter information matrix by tag: survival models, Filter information matrix by tag: left-truncation

## Add new comment