bspline {ibs} | R Documentation |
B-spline function
Description
Evaluate the value of the B-spline function with knots knots
,
order ord
, and coefficients coef
at value(s) x
.
Usage
bspline(x, knots, ord, coef = rep(1, length(knots) - ord))
Arguments
x |
Numerical value or vector. The value(s) at which to evaluate the B-spline. |
knots |
Numerical vector. The knot positions/sites of the B-spline function. |
ord |
An integer >=1. The order of the B-spline function. Equals degree plus 1. |
coef |
A numerical vector. The coefficients (de Boor points) defining the B-spline function. |
Value
A scalar or a vector of length equal to that of x
.
Note
In contrast to the implementation based on the splineDesign
function from the splines
package, this version of the B-spline
function is left-continuous at the rightmost knot site.
Author(s)
Feng Chen <feng.chen@unsw.edu.au>
References
de Boor, C. (2001) A Practical Guide to Splines. Revised Edition. Springer: New York.
See Also
Examples
kns <- c(rep(0,4),1:4*0.2,rep(1,4))
bspline(0:10/10,kns,3,rep(1,length(kns)-3))
splines::splineDesign(kns,0:10/10,3)%*%rep(1,length(kns)-3)