splines() — Regression splines

Joins smooth cubic pieces to bend flexibly through data.

splines(knots, x, y)

Key idea

Definition

the knots (join points)
a cubic that switches on past the knot
how much the curve bends at knot k

In plain words

Rather than one stiff curve for the whole range, bend several smooth pieces and glue them together seamlessly.

Where you'd use it

Frequently asked questions

What are splines for?
Flexible curve-fitting using piecewise polynomials joined smoothly at knots.