This function generates the I-spline (integral of M-spline) basis matrix for a polynomial spline or its derivatives of given order..
iSpline(x, df = NULL, knots = NULL, degree = 3L, intercept = FALSE, Boundary.knots = range(x, na.rm = TRUE), derivs = 0L, ...)
The predictor variable. Missing values are allowed and will be returned as they were.
Degrees of freedom. One can specify
The internal breakpoints that define the spline. The default
Non-negative integer degree of the piecewise polynomial. The default value is 3 for cubic splines. Note that the degree of I-spline is defined to be the degree of the associated M-spline instead of actual polynomial degree. In other words, I-spline basis of degree 2 is defined as the integral of associated M-spline basis of degree 2.
Boundary points at which to anchor the I-spline basis.
By default, they are the range of the non-
A non-negative integer specifying the order of derivatives of I-splines.
Optional arguments for future usage.
A matrix of dimension
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 I-spline basis based on the
recursion formula of B-spline basis. 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
Ramsay, J. O. (1988). Monotone regression splines in action. Statistical science, 3(4), 425--441.
## Example given in the reference paper by Ramsay (1988) library(splines2) x <- seq.int(0, 1, by = 0.01) knots <- c(0.3, 0.5, 0.6) isMat <- iSpline(x, knots = knots, degree = 2, intercept = TRUE) library(graphics) matplot(x, isMat, type = "l", ylab = "I-spline basis")abline(v = knots, lty = 2, col = "gray")## the derivative of I-splines is M-spline msMat1 <- iSpline(x, knots = knots, degree = 2, derivs = 1) msMat2 <- mSpline(x, knots = knots, degree = 2) stopifnot(all.equal(msMat1, msMat2))