dbsp {bspline}R Documentation

Derivative of B-spline

Description

Derivative of B-spline

Usage

dbsp(f, nderiv = 1L, same_xk = FALSE)

Arguments

f

Function, B-spline such as returned by smbsp() or par2bsp()

nderiv

Integer scalar >= 0, order of derivative to calculate (1 by default)

same_xk

Logical scalar, if TRUE, indicates to calculate derivative on the same knot grid as original function. In this case, coefficient number will be incremented by 2. Otherwise, extreme knots are removed on each side of the grid and coefficient number is maintained (FALSE by default).

Value

Function calculating requested derivative

Examples

  x=seq(0., 1., length.out=11L)
  y=sin(2*pi*x)
  f=smbsp(x, y, nki=2L)
  d_f=dbsp(f)
  xf=seq(0., 1., length.out=101) # fine grid for plotting
  plot(xf, d_f(xf)) # derivative estimated by B-splines
  lines(xf, 2.*pi*cos(2*pi*xf), col="blue") # true derivative
  xk=bsppar(d_f)$xk
  points(xk, d_f(xk), pch="x", col="red") # knot positions

[Package bspline version 2.2.2 Index]