splineDesigncpp {trtswitch} | R Documentation |
B-Spline Design Matrix
Description
Computes the design matrix for B-splines based on the
specified knots
and evaluated at the values in x
.
Usage
splineDesigncpp(
knots = NA_real_,
x = NA_real_,
ord = 4L,
derivs = as.integer(c(0))
)
Arguments
knots |
A numeric vector specifying the positions of the knots, including both boundary and internal knots. |
x |
A numeric vector of values where the B-spline functions
or their derivatives will be evaluated. The values of |
ord |
A positive integer indicating the order of the B-spline.
This corresponds to the number of coefficients in each piecewise
polynomial segment, where |
derivs |
An integer vector specifying the order of derivatives
to be evaluated at the corresponding |
Value
A matrix with dimensions
c(length(x), length(knots) - ord)
. Each row corresponds
to a value in x
and contains the coefficients of the
B-splines, or the specified derivatives, as defined by the
knots
and evaluated at that particular value of x
.
The total number of B-splines is length(knots) - ord
,
with each B-spline defined by a set of ord
consecutive knots.
Author(s)
Kaifeng Lu, kaifenglu@gmail.com
Examples
splineDesigncpp(knots = 1:10, x = 4:7)
splineDesigncpp(knots = 1:10, x = 4:7, derivs = 1)