# NOT RUN {
# Generate basis functions
set.seed(1)
x = seq(0, 1, length = 256)
knots = sort(c(0, runif(10), 1))
basis = dbspline(x, knots)
# Plot basis functions
plot(x, basis[1, ], type = "l", ylim = c(min(basis), max(basis)),
ylab = expression(b[3](x)), main = "Cubic B-spline Density Basis Functions")
for (i in 2:nrow(basis)) lines(x, basis[i, ], col = i)
# }
Run the code above in your browser using DataLab