cb: Restricted cubic splines

View source: R/cb.R

cbR Documentation

Restricted cubic splines

Description

Function for computing the basis matrix for restricted cubic splines

Usage

cb(x, df = NULL, knots = NULL, ortho = FALSE, R.inv = NULL, intercept = FALSE)

Arguments

x

Values to evaluate the basis functions in.

df

Degrees of freedom. One can supply df rather than knots; cb then chooses df + 1 knots at suitably chosen quantiles of x (which will ignore missing values).

knots

Chosen knots for the spline.

ortho

Logical. If TRUE orthogonalization of the basis matrix is carried out.

R.inv

Matrix or vector containing the values of the R matrix from the QR decomposition of the basis matrix. This is used for making new predictions based on the initial orthogonalization. Therefore the default is NULL.

intercept

Logical. If FALSE, the intercept of the restricted cubic spline is removed.

Value

A matrix with containing the basis functions evaluated in x.

References

Royston P. and Parmar M.K. (2002) Flexible parametric proportional-hazards and proportional-odds models for censored survival data, with application to prognostic modelling and estimation of treatment effects. Statistics in Medicine, 21:15.


LasseHjort/cuRe documentation built on July 6, 2023, 1:08 p.m.