Computes the design matrix for B-splines based on the specified knots and evaluated at the values in x.
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 x
must lie within the range of the "inner" knots, i.e., between knots[ord] and knots[length(knots) - (ord - 1)].
ord: A positive integer indicating the order of the B-spline. This corresponds to the number of coefficients in each piecewise polynomial segment, where ord = degree + 1.
derivs: An integer vector specifying the order of derivatives to be evaluated at the corresponding x values. Each value must be between 0 and ord - 1, and the vector is conceptually recycled to match the length of x. The default is 0, meaning the B-spline functions themselves are evaluated.
Returns
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.
Examples
splineDesigncpp(knots =1:10, x =4:7)splineDesigncpp(knots =1:10, x =4:7, derivs =1)