FunctionalVAR._bspline_basis#

FunctionalVAR._bspline_basis()[source]#

Build the clamped B-spline design on the grid.

The df - degree - 1 interior knots sit at equally spaced quantiles of the grid, and the boundary knots are repeated degree + 1 times so the basis is clamped and sums to one at every grid point.

Return type:

NDArray[double]

Returns:

The (n_points, df) design matrix.

Example

>>> import numpy as np
>>> curves = np.random.default_rng(0).standard_normal((40, 25))
>>> grid = np.linspace(0.0, 1.0, 25)
>>> design = FunctionalVAR(curves, grid, order=1, df=6)._bspline_basis()
>>> design.shape, bool(np.allclose(design.sum(axis=1), 1.0))
((25, 6), True)