This function gets derivative of a spline basis. Adapted from bs()
function in splines
package.
bs_deriv(
x,
knots,
degree = 3L,
Boundary.knots = range(x),
derivative = 1,
intercept = TRUE
)
A matrix containing:
A B-spline basis that can be used to approximate the derivative of a function.
a numeric vector of values at which to evaluate the B-spline functions or derivatives.
the internal breakpoints that define the spline.
degree of the piecewise polynomial—default is 3 for cubic splines.
boundary points at which to anchor the B-spline basis. Set to [0,1] if you want this to be your domain.
a positive integer value that specifies which derivative to take. Defaults to 1 for 1st derivative. Value of 0 returns the original set of b-spline basis functions.
if TRUE, an intercept is included in the basis; default is TRUE
Julia Wrobel jw3134@cumc.columbia.edu