I am trying to create a B-spline basis of order 4 for a data set of 106 with 40 internal knots. All the plotted basis functions I've seen so far consists of very smooth and nicely spread out curves, whereas mine is pointy and generally pretty ugly looking. Is this a property of having such a low ratio of data points compared to knots or am I doing something horribly wrong?
And if it is a property, should I generate more data before creating the spline basis?
require(splines)
set.seed(100)
x = sort(runif(106, 91.78525, 123))
equidistant.knots = seq(min(x) + 0.761, max(x) - 0.761, length=40)
equidistant.ret = bs(x, knots = equidistant.knots, degree = 4, intercept = FALSE, Boundary.knots = range(x))
plot(equidistant.ret[,1]~x, ylim=c(0,max(equidistant.ret)), type='l', lwd=2, col=1,
xlab="Cubic B-spline basis", ylab="")
for (j in 2:ncol(equidistant.ret)) lines(equidistant.ret[,j]~x, lwd=2, col=j)