bs_deriv: Nth derivative of spline basis

View source: R/bs_deriv.R

bs_derivR Documentation

Nth derivative of spline basis

Description

This function gets derivative of a spline basis. Adapted from bs() function in splines package.

Usage

bs_deriv(
  x,
  knots,
  degree = 3L,
  Boundary.knots = range(x),
  derivative = 1,
  intercept = TRUE
)

Arguments

x

a numeric vector of values at which to evaluate the B-spline functions or derivatives.

knots

the internal breakpoints that define the spline.

degree

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

Boundary.knots

boundary points at which to anchor the B-spline basis. Set to [0,1] if you want this to be your domain.

derivative

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.

intercept

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

Value

A matrix containing:

basis

A B-spline basis that can be used to approximate the derivative of a function.

Author(s)

Julia Wrobel julia.wrobel@cuanschutz.edu


registr documentation built on Oct. 3, 2022, 1:05 a.m.