nscpp | R Documentation |
Computes the B-spline basis matrix for a natural cubic spline.
nscpp(
x = NA_real_,
df = NA_integer_,
knots = NA_real_,
intercept = 0L,
boundary_knots = NA_real_
)
x |
A numeric vector representing the predictor variable. Missing values are allowed. |
df |
Degrees of freedom, specifying the number of columns in
the basis matrix. If |
knots |
A numeric vector specifying the internal breakpoints
that define the spline. If provided, the number of degrees of
freedom will be determined by the length of |
intercept |
A logical value indicating whether to include an
intercept in the basis. The default is |
boundary_knots |
A numeric vector of length 2 specifying the
boundary points where the natural boundary conditions are applied
and the B-spline basis is anchored. If not supplied, the default
is the range of non-missing values in |
A matrix with dimensions c(length(x), df)
, where
df
is either provided directly or computed as
length(knots) + 1 + intercept
when knots
are supplied.
The matrix contains attributes that correspond to the arguments
passed to the nscpp
function.
Kaifeng Lu, kaifenglu@gmail.com
nscpp(women$height, df = 5)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.