### B-Spline Basis

A B-spline basis can be built by starting with a set of Haar basis functions, which are functions that are 1 between adjacent knots and zero elsewhere, and then applying a simple linear recursion relationship times, yielding the needed basis functions. For the purpose of building the B-spline basis, the prespecified knots are referred to as internal knots. This construction requires additional knots, known as boundary knots, to be positioned to the left of the internal knots, and boundary knots to be positioned to the right of the internal knots. The actual values of these boundary knots can be arbitrary. The EFFECT statement provides several methods for placing the needed boundary knots, including the common method of using repeated values of the data extremes as the boundary knots. The boundary knot placement affects the precise form of the basis functions generated but not the following two desirable properties:

The B-spline basis functions are nonzero over an interval spanning at most knots. This yields design matrix columns each of whose rows contain at most adjacent nonzero entries.

The computation of the basis functions at any value is numerically stable and does not require evaluating powers of this value.

The following figures show the B-spline bases defined on with 4 equally spaced internal knots at 0.2, 0.4, 0.6, and 0.8.

Figure 18.2 shows a linear B-spline basis. Note that this basis consists of 6 functions each of which is nonzero over an interval spanning at most 3 knots.

**
Figure 18.2
Linear B-Spline Basis with Four Equally Spaced Interior Knots**

Figure 18.3 shows a cubic B-spline basis where the needed boundary knots are positioned at and . Note that this basis consists of 8 functions, each of which is nonzero over an interval spanning at most 5 knots.

**
Figure 18.3
Cubic B-Spline Basis with Four Equally Spaced Interior Knots**

Figure 18.4 shows a different cubic B-spline basis where the needed left-side boundary knots are positioned at , , , and . The right-side boundary knots are positioned at , , , and . Note that, as in the basis shown in Figure 18.3, this basis consists of 8 functions, each of which is nonzero over an interval spanning at most 5 knots. The different positioning of the boundary knots has merely changed the shape of the individual basis functions.

**
Figure 18.4
Cubic B-Spline Basis with Equally Spaced Boundary and Interior Knots**

You can find details about this construction in Hastie, Tibshirani, and Friedman (2001).