bsx: Polynomial B-splines with eXtensions

bsxR Documentation

Polynomial B-splines with eXtensions


Generate the B-spline basis matrix for a polynomial spline with derivative restrictions at the boundary knots.


  df = NULL,
  knots = NULL,
  degree = 3,
  intercept = FALSE,
  Boundary.knots = range(x),
  deriv = NULL



the predictor variable. Missing values are allowed.


degrees of freedom; one can specify df rather than knots; bs() then chooses df-degree (minus one if there is an intercept) knots at suitable quantiles of x (which will ignore missing values). The default, NULL, corresponds to no inner knots, i.e., degree-intercept.


the internal breakpoints that define the spline. The default is NULL, which results in a basis for ordinary polynomial regression. Typical values are the mean or median for one knot, quantiles for more knots. See also Boundary.knots.


degree of the piecewise polynomial—default is 3 for cubic splines.


if TRUE, an intercept is included in the basis; default is FALSE.


boundary points at which to anchor the B-spline basis (default the range of the non-NA data). If both knots and Boundary.knots are supplied, the basis parameters do not depend on x. Data can extend beyond Boundary.knots.


an integer vector of length 2 with values between 0 and degree + 1 giving the derivative constraint order at the left and right boundary knots; an order of 2 constrains the second derivative to zero (f”(x)=0); an order of 1 constrains the first and second derivatives to zero (f'(x)=f”(x)=0); an order of 0 constrains the zero, first and second derivatives to zero (f(x)=f'(x)=f”(x)=0) An order of degree + 1 computes the basis matrix similarly to bs.


A matrix with containing the basis functions evaluated in x.

cuRe documentation built on May 17, 2022, 1:05 a.m.

Related to bsx in cuRe...