basis and penalty matrices for natural cubic splines
I am trying to get the basis matrix and penalty matrix
for natural cubic splines. I found R function "ns" can
generate the B-spline basis matrix for a natural cubic
spline; and "bsplinepen"
can compute the penalty matrix for functions expressed
in terms of a B-spline basis. However, these two
functions seem not compatible. I could not get the
penalty matrix by "bsplinepen" using the basis matrix
generated from "ns".
Anyone knows any compatible functions to give the
matrix and penalty matrix for natural cubic splines?
Thanks a lot!