Statistics - (Linear spline|Piecewise linear function)

Thomas Bayes


A linear spline, or piecewise linear function has a degree zero Statistics - Piecewise polynomials and is:

  • linear in the left and the right.
  • forced to be continuous at the knot.

Linear Spline

Definition / Representation

Just like the global polynomials and the piecewise constant functions, we can represent this as a linear expansion in basis functions that are transformations of the variables.

A linear spline with knots at <math>\xi_k</math> with <math>k = 1, \dots, K</math> is a piecewise linear polynomial continuous at each knot.

This model can be represented as:

<MATH> y_i = \beta_0 + \beta_1.b_1(x_i) + \beta_2.b_2(x_i) + \dots + \beta_{K+3}b_{K+3}(x_i) + \epsilon_i </MATH>

where the <math>b_k</math> are basis functions and are:

  • the variable itself. One of these basis functions is just the variable itself

<MATH> \begin{array}{rll} b_1(x_i) & = & x_i \\ \end{array} </MATH>

  • and additional variables that are a collection of truncated basis transformation functions at each of the knots. They are called truncated power functions, but this one is to power 1.

<MATH> \begin{array}{rll} b_{k+1}(xi) & = & (xi - \xi_k)_+ \text{ where } k = 1, \dots, K \\ \text{where the ()+ means positive part. i.e. } (xi - \xi_k) & = & \left\{ \begin{matrix} xi - \xi_k & \text{ if } x_i > \xi_k & \\ 0 & \text{Otherwise} & \text{It's not allowed to go negative.} \end{matrix} \right. \end{array} </MATH>


There is one knot in these pictures, but we can put down multiple knots.

When we fit a linear model with a global linear function plus one of the basis function and their respective coefficient, we get a function that's allowed to change its slope at the knot.

Linear Spline With Basis Function

Discover More
Card Puncher Data Processing
R - Spline

Fitting splines in R is easy: bs(x, ...) for any degree splines (one: linear spline, three: cubic spline and ns(x, ...) for natural cubic splines, in package splines.
Piecewise Polynomial Cubic Spline
Statistics - Cubic spline

Cubic splines is a step cubic piecewise polynomial in the left and the right and continuous at the knot. There's the following constraints: The first derivatives continues at the knot, and the...
Piecewise Cubic Polynomial Non Continu
Statistics - Piecewise polynomials

Piecewise polynomials generalize the idea of piecewise constants. The idea try to get rid of the global polynomial because it's global and not local. Instead of having asingle polynomial over the whole...
Data System Architecture
Statistics - Splines

A spline is a piecewise polynomial model: Splines have the “maximum” amount of continuity over all knots function.

Share this page:
Follow us:
Task Runner