Skip to contents

Create a default M-spline model structure

Usage

mspline_init(
  df = 10,
  degree = 3,
  bsmooth = TRUE,
  knots = NULL,
  bknot = 10,
  obstimes = NULL
)

Arguments

df

Desired number of basis terms, or "degrees of freedom" in the spline. If knots is not supplied, the number of knots is then chosen to satisfy this.

degree

Spline polynomial degree. Can only be changed from the default of 3 if bsmooth is FALSE.

bsmooth

If TRUE then the function is constrained to also have zero derivative and second derivative at the boundary.

knots

Vector of knot locations. If not supplied, df has to be specified. One of two rules is then used to choose the knot locations. If bknot is specified, a set of equally spaced knots between zero and bknot is used. Otherwise if obstimes is supplied, the knots are chosen as equally spaced quantiles of obstimes.

The number of knots (excluding zero) is df - degree + 1 if bsmooth is TRUE, or df - degree - 1 otherwise.

bknot

Location of the final spline knot.

obstimes

Vector of observation times whose quantiles will be used to choose knot locations

Value

A list with fundamental components knots, degree, and bsmooth, as documented above.

The component df is also included, and derived as a consequence of the fundamental components.