spbase {JOPS} | R Documentation |
Compute a sparse B-spline basis on evenly spaced knots
Description
Constructs a sparse B-spline basis on evenly spaced knots.
Usage
spbase(x, xl = min(x), xr = max(x), nseg = 10, bdeg = 3)
Arguments
x |
a vector of argument values, at which the B-spline basis functions are to be evaluated. |
xl |
the lower limit of the domain of |
xr |
the upper limit of the domain of |
nseg |
the number of evenly spaced segments between |
bdeg |
the degree of the basis, usually 1, 2, or 3 (default). |
Value
A sparse matrix (in spam
format) with length(x)
of rows= and nseg + bdeg
columns.
Author(s)
Paul Eilers
References
Eilers, P.H.C. and Marx, B.D. (1996). Flexible smoothing with B-splines and penalties (with comments and rejoinder), Statistical Science, 11: 89-121.
Eilers, P.H.C. and Marx, B.D. (2021). Practical Smoothing, The Joys of P-splines. Cambridge University Press.
Examples
library(JOPS)
# Basis on grid
x = seq(0, 4, length = 1000)
B = spbase(x, 0, 4, nseg = 50, bdeg = 3)
nb1 = ncol(B)
matplot(x, B, type = 'l', lty = 1, lwd = 1, xlab = 'x', ylab = '')
cat('Dimensions of B:', nrow(B), 'by', ncol(B), 'with', length(B@entries), 'non-zero elements' )
[Package JOPS version 0.1.19 Index]