Evaluate a Spline Basis

This function evaluates a predefined spline basis at (new) given values.

# S3 method for bSpline2
predict(object, newx, ...)

# S3 method for ibs predict(object, newx, ...)

# S3 method for dbs predict(object, newx, ...)

# S3 method for mSpline predict(object, newx, ...)

# S3 method for iSpline predict(object, newx, ...)

# S3 method for cSpline predict(object, newx, ...)


Objects of class bSpline2, ibs, mSpline, iSpline, or cSpline having attributes describing knots, degree, etc.


The x values at which evaluations are required.


Optional argument for future usage.


These are methods for the generic function predict for objects inheriting from class bSpline2, ibs, mSpline, iSpline, or cSpline. If newx is not given, the function returns the input object. For object returned by function cSpline, the mSpline and iSpline objects shipped in attributes should not be evaluated by this function if rescale is TRUE. See cSpline for details.


An object just like the object input, except evaluated at the new values of x.

See Also

bSpline for B-splines; ibs for integral of B-splines; dbs for derivative of B-splines; mSpline for M-splines; iSpline for I-splines; cSpline for C-splines.

  • predict
  • predict.bSpline2
  • predict.ibs
  • predict.dbs
  • predict.mSpline
  • predict.iSpline
  • predict.cSpline
x <-, 1, 0.2)
knots <- c(0.3, 0.5, 0.6)
newX <-, 0.9, 0.2)

## for B-splines
bsMat <- bSpline(x, knots = knots, degree = 2)
predict(bsMat, newX)

## for integral of B-splines
ibsMat <- ibs(x, knots = knots, degree = 2)
predict(ibsMat, newX)

## for derivative of B-splines
dbsMat <- dbs(x, knots = knots, degree = 2)
predict(dbsMat, newX)

## for M-spline
msMat <- mSpline(x, knots = knots, degree = 2)
predict(msMat, newX)

## for I-spline
isMat <- iSpline(x, knots = knots, degree = 2)
predict(isMat, newX)

## for C-spline
csMat <- cSpline(x, knots = knots, degree = 2)
predict(csMat, newX)
# }
Documentation reproduced from package splines2, version 0.2.5, License: GPL (>= 3)

Community examples

Looks like there are no examples yet.