cubicbs {blapsr} | R Documentation |
Construct a cubic B-spline basis.
Description
Computation of a cubic B-spline basis matrix.
Usage
cubicbs(x, lower, upper, K)
Arguments
x |
A numeric vector containing the values on which to evaluate the B-spline basis. |
lower , upper |
The lower and upper bounds of the B-spline basis domain. Must be finite with lower < upper. |
K |
A positive integer specifying the number of B-spline functions in the basis. |
Value
An object of class cubicbs for which print and plot methods are available. The cubicbs class consists of a list with the following components:
x |
A numeric vector on which the basis is evaluated. |
lower , upper |
The lower and upper bounds of the basis domain. |
K |
The number of cubic B-spline functions in the basis. |
knots |
The knot sequence to build the basis. |
nknots |
Total number of knots. |
dimbasis |
The dimension of the B-spline basis matrix. |
Bmatrix |
The B-spline basis matrix. |
The print method summarizes the B-spline basis and the plot method gives a graphical representation of the basis with dashed vertical lines indicating knot placement and blue ticks the coordinates of x.
Author(s)
Oswaldo Gressani oswaldo_gressani@hotmail.fr.
The core algorithm of the cubicbs function owes much to a code written by Phlilippe Lambert.
References
Eilers, P.H.C. and Marx, B.D. (1996). Flexible smoothing with B-splines and penalties. Statistical Science, 11(2): 89-121.
Examples
lb <- 0 # Lower bound
ub <- 1 # Upper bound
xdom <- runif(100, lb, ub) # Draw uniform values between lb and ub
Bsmat <- cubicbs(xdom, lb, ub, 25) # 100 x 25 B-spline matrix
Bsmat
plot(Bsmat) # Plot the basis