spbase | R Documentation |
Constructs a sparse B-spline basis on evenly spaced knots.
spbase(x, xl = min(x), xr = max(x), nseg = 10, bdeg = 3)
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). |
A sparse matrix (in spam
format) with length(x)
of rows= and nseg + bdeg
columns.
Paul Eilers
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.
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' )
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.