bbase | R Documentation |
Compute a B-spline basis matrix using evenly spaced knots.
bbase(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 x; default is |
xr |
the upper limit of the domain of x; default is |
nseg |
the number of equally sized segments between xl and xr; default is 10. |
bdeg |
the degree of the splines, usually 1, 2, or 3 (default). |
If xl
is larger than min(x)
, it will be adjusted to min(x)
and a warning wil be given.
If xr
is smaller than max(x)
, it will be adjusted to max(x)
and a warning wil be given.
The values of the design parameters x, xl, xr, ndeg, bdeg
and type = 'bbase'
are added to the list of attributes of the matrix.
A matrix with length(x)
rows and nseg + bdeg
columns.
Paul Eilers and Brian Marx
Eilers, P.H.C. and Marx, B.D. (2021). Practical Smoothing, The Joys of P-splines. Cambridge University Press.
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 B.D. Marx (2010). Splines, knots and penalties. Wiley Interdisciplinary Reviews: Computational Statistics. Wiley: NY. DOI: 10.1002/wics.125
# Compute and plot a B-spline basis matrix
x = seq(0, 360, by = 2)
B = bbase(x, 0, 360, nseg = 8, bdeg = 3)
matplot(x, B, type = 'l', lty = 1, lwd = 2, xlab = 'x', ylab = '')
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.