library(graphics)
x <- seq(0, 1, by = .01)
knots <- c(0.3, 0.5, 0.6)
cMat <- cSpline(x, knots = knots, degree = 2, intercept = TRUE)
matplot(x, cMat, type = "l", ylab = "C-spline basis")
abline(v = knots, lty = 2, col = "gray")
matplot(x, attr(cMat, "isMat"), type = "l", ylab = "scaled I-spline basis")
matplot(x, attr(cMat, "msMat"), type = "l", ylab = "scaled M-spline basis")
Run the code above in your browser using DataLab