Skip to contents

Plot a M-spline function, showing how it is built up from its basis


  knots = NULL,
  bknot = 10,
  df = 10,
  degree = 3,
  bsmooth = TRUE,
  coefs = NULL,
  scale = 1,
  tmin = 0,
  tmax = 10



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 bknots is specified, a set of equally spaced knots between zero and bknots 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.


Location of the final spline knot.


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.


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


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


Coefficients of the spline basis terms. These are normalised internally to sum to 1, if they do not already sum to 1.


Scale parameter. After computing the standard M-spline function as a weighted sum of the basis terms, the function is multiplied by scale. The log of the scale is the parameter called alpha in the results of a survextrap model, the intercept of the linear model on the log hazard.


Minimum plotting time. Defaults to zero.


Maximum plotting time. Defaults to the highest knot.