This function generates the integral of B-spline basis matrix
for a polynomial spline. The arguments are exactly the same with function
`bs`

in package `splines`

.

ibs(x, df = NULL, knots = NULL, degree = 3, intercept = FALSE, Boundary.knots = range(x, na.rm = TRUE), ...)

x | The predictor variable. Missing values are allowed and will be returned as they were. |
---|---|

df | Degrees of freedom of the B-spline basis to be integrated. One
can specify |

knots | The internal breakpoints that define the B-spline basis to be
integrated. The default is |

degree | Non-negative integer degree of the piecewise polynomial to be integrated. The default value is 3 for the integral of cubic B-splines. |

intercept | If |

Boundary.knots | Boundary points at which to anchor the B-spline basis
to be integrated. By default, they are the range of the non- |

... | Optional arguments for future usage. |

A matrix of dimension `length(x)`

by
`df = degree + length(knots)`

(plus on if intercept is included).
Attributes that correspond to the arguments specified are returned
for usage of other functions in this package.

It is an implementation of the close form integral of B-spline basis based
on recursion relation. Internally, it calls `bSpline`

and
generates a basis matrix for representing the family of piecewise
polynomials and their corresponding integrals with the specified interior
knots and degree, evaluated at the values of `x`

.

De Boor, Carl. (1978). *A practical guide to splines*.
Vol. 27. New York: Springer-Verlag.

`predict.ibs`

for evaluation at given (new) values;
`deriv.ibs`

for derivative method.
`bSpline`

for B-splines;
`dbs`

for derivatives of B-splines;

library(splines2) x <- seq.int(0, 1, 0.01) knots <- c(0.2, 0.4, 0.7, 0.9) ibsMat <- ibs(x, knots = knots, degree = 1, intercept = TRUE) ## the B-spline bases integrated by function bSpline (same arguments) bsMat0 <- bSpline(x, knots = knots, degree = 1, intercept = TRUE) ## or by function deriv (recommended) that directly extracts the existing ## result from the attribute of ibsMat and thus is much more efficient. bsMat <- deriv(ibsMat) stopifnot(all.equal(bsMat0, bsMat, check.attributes = FALSE)) # equivalent ## plot B-spline basis with their corresponding integrals library(graphics) par(mfrow = c(1, 2)) matplot(x, bsMat, type = "l", ylab = "B-spline basis") abline(v = knots, lty = 2, col = "gray") matplot(x, ibsMat, type = "l", ylab = "Integral of B-spline basis")