ibs: Integratal of a B-spline function

Description Usage Arguments Details Value Author(s) References See Also Examples

View source: R/RcppExports.R

Description

Calculate the integral of a B-spline function.

Usage

1
ibs(x, knots, ord=4, coef = rep(1, length(knots) - ord))

Arguments

x

Numerical value or vector. The value(s) at which to evaluate the integral of the B-spline; must be in the interval bewteen the smallest knot to the (nknots-ord)th largest knot.

knots

Numerical vector. The knot positions/sites of the B-spline function to be integrated.

ord

An integer >=1. The order of the B-spline integrand function to be integrated. Equals degree plus 1.

coef

A numerical vector. The coefficients (de Boor points) defining the B-spline integrand function.

Details

The function returns the integral(s) of the B-spline function specified by knots knots, order ord, and coefficients coef, from the minimum knot position to each x value. The evaluation is based on a closed form expression of the integral in terms of higher order B-splines, given on page 128 of de Boor (2001).

Value

A numerical equal to the integral(s).

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

bspline

Examples

1
2
3
4
5
kns <- c(rep(0,4),1:4*0.2,rep(1,4))
co <- rnorm(length(kns)-3)
integrate(bspline,knots=kns,ord=3,coef=co,0,0.95)
integrate(function(x)bsbases(x,kns,3) %*% co,0,0.95)
ibs(0.95,kns,3,co)

Example output

0.3928259 with absolute error < 8.6e-05
0.3928259 with absolute error < 8.6e-05
[1] 0.3928262

ibs documentation built on May 2, 2019, 11:26 a.m.