MerQuR+Statistics Glossary

Statistics Glossary → Splines and basis dimension (k)

Splines and basis dimension (k)concept

Functions that model a variable's effect flexibly with piecewise polynomials joined smoothly at knots, and the number of basis functions that caps this flexibility.

A spline is obtained by dividing the x axis into pieces at knots, fitting a polynomial (often cubic) to each piece and joining the pieces at the knots without gaps or kinks. In practice a spline is written as a weighted sum of k basis functions, so even a nonlinear relationship can be estimated with linear regression techniques. Unlike a single high-degree polynomial, the fit in one region of the data does not distort distant regions.

Generalized additive models (GAMs) use penalized regression splines: k sets the upper limit of flexibility, while the flexibility actually used (the effective degrees of freedom) is chosen by a roughness penalty, usually via REML or GCV. As long as k is large enough, its exact value therefore changes the result little. If k is too small, the function cannot capture the true relationship; this shows up as a k-index below 1 with a small p value, and k should be increased (Wood). A very large k only adds computing time.

An everyday example

In a city, the relationship between daily temperature and electricity consumption is not a straight line: consumption rises on very cold days because of heating and on very hot days because of air conditioning, and is lowest on mild days. A spline can follow this U-shaped relationship without distorting one end in order to fit the other.

In MerQur

'Number of splines (k)' (basis functions per term) and 'Additional output: Basis dimension check (k-index)' in the Generalized Additive Model.

Analyses where this concept appears

Generalized Additive Model (GAM, Nonlinear Regression)

Related concepts

Smoothing parameter (λ, span)