Skip to contents

Evaluate an M-spline basis matrix at the specified times. Extrapolation beyond the boundary knots is done by assuming that each basis term is constant beyond the boundary.

Usage

mspline_basis(times, knots, degree = 3, integrate = FALSE, bsmooth = TRUE)

Arguments

times

A numeric vector of times at which to evaluate the basis.

knots

Spline knots

degree

Spline degree

integrate

If TRUE, then the integrated M-spline (I-spline) basis is returned.

bsmooth

If TRUE then the function is constrained to also have zero derivative and second derivative at the boundary, which improves smoothness at the boundary (experimental feature).

Value

A two-dimensional array. Rows are the times, and columns are the basis terms.

Details

The lower boundary is fixed to zero, and each basis term is assumed to be zero at times less than zero, since these models are used for hazard functions in survival data.

References

The splines2 package is used.