bspline | R Documentation |
Generate the B-spline basis matrix for a cubic spline with the first and last columns dropped.
bspline(x, df=NULL, knots=NULL, Boundary.knots = range(x))
x |
the predictor variable. Missing values are allowed. |
df |
degrees of freedom; one can specify |
knots |
the internal breakpoints that define the spline. The default is |
Boundary.knots |
boundary points at which to anchor the B-spline basis (default the range of the non-NA data). |
Haiming Zhou and Timothy Hanson
Hastie, T. J. (1992) Generalized additive models. Chapter 7 of Statistical Models in S eds J. M. Chambers and T. J. Hastie, Wadsworth & Brooks/Cole.
predict.bspline
require(stats)
basis <- bspline(women$height, df = 5)
newX <- seq(58, 72, length.out = 51)
# evaluate the basis at the new data
predict(basis, newX)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.