cbase | R Documentation |
Computes a circular B-spline basis matrix using evenly spaced knots.
cbase(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 B-spline segments (default 10) between xl and xr. |
bdeg |
the degree of the basis, usually 1, 2, or 3 (default). |
If xl
is larger than min(x)
, it wil be adjusted to min(x)
and a warning wil be given.
If xr
is smaller than max(x)
, it wil be adjusted to max(x)
and a warning wil be given.
The design parameters x, xl, xr, ndeg, bdeg
and type = 'cbase'
are added to the list of attributes.
In a circular basis, the B-splines are wrapped around the boundaries of the domain. Use a circular basis for data
like directions or angles. It should be combined with a circular penalty matrix, as computed by cdiff()
.
A matrix with length(x)
rows and nseg
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., Marx, B.D., and Durban, M. (2015). Twenty years of P-splines, SORT, 39(2): 149-186.
# Compute and plot a circular B-spline basis matrix
x = seq(0, 360, by = 2)
B = cbase(x, 0, 360, nseg = 8, bdeg = 3)
matplot(x, B, type = 'l', lty = 1, lwd = 2, xlab = 'x', ylab = '')
title('Note how the ends connect smoothly meet at boundaries' )
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.