bbasis function

Function for creating B-spline basis functions (Eilers & Marx, 2010)

Function for creating B-spline basis functions (Eilers & Marx, 2010)

Construct a B-spline basis of degree deg

with ndx-1 equally-spaced internal knots (ndx segments) on range [x1,xr]. Code copied from Eilers & Marx 2010, WIR: Comp Stat 2, 637-653.

bbasis(x, xl, xr, ndx, deg)

Arguments

  • x: A vector. Data values for spline.
  • xl: A numeric value. Lower bound for data (lower external knot).
  • xr: A numeric value. Upper bound for data (upper external knot).
  • ndx: A numeric value. Number of divisions for x range (equal to number of segments = number of internal knots + 1)
  • deg: A numeric value. Degree of the polynomial spline.

Returns

A matrix with columns holding the P-spline for each value of x. Matrix has ndx+deg columns and length(x) rows.

Details

Not yet amended to coerce values that should be zero to zero!

  • Maintainer: Giovanny Covarrubias-Pazaran
  • License: GPL (>= 2)
  • Last published: 2025-01-18

Useful links