#StackBounty: #r #splines #basis-function Number of basis functions in natural cubic spline

Bounty: 50

According to ESL, natural cubic basic spline with $K$ knots is represented by $K$ basis function.

However, the ns() function in R with knots=K generates a basis matrix with $K+2$ basis function. This representation seems to add just two and not four constraints in both the boundary regions.

Indeed the documentation says that that the resulting matrix is a $N times df$ matrix, where df = length(knots) + 1 + intercept.

(In addition to this, the resulting plot of lm(y~ns(x,knots=c(k_1,k_2,...,K_n),intercept=T))is not a linear function in the extreme regions)

My question is : is this a different definition of natural cubic spline?

Get this bounty!!!

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.