# NOT RUN {
library(splines2)
x <- seq.int(0, 1, 0.2)
knots <- c(0.3, 0.5, 0.6)
newX <- seq.int(0.1, 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)
# }
Run the code above in your browser using DataLab