Smoothing Spline Basis Matrix
Close, but not quite. Your design matrix is: H <- bs(X, knots=spl$fit$knot, intercept=TRUE) So long as you have data in all of the inter-knot regions, you should be ok. A good book to check out about this sort of thing is Ruppert, Wand and Carroll's Semiparametric Regression book. I can't recommend that book highly enough. Derek
pinkdd wrote:
Thank you. D Sonderegger.
Did you mean use
bs <- bs(X, knots = spl$fit$knot)
H <- predict(bs, X)
Then H should be the matrix for the original data under the smoothing
spline basis?
However, another problem arises, since I need to use H to estimate the
coefficient beta, which involves (H'H)^{-1}. But my matrix (H'H) is
singular, which might be caused by the duplicated data in X. Do you know
how to fix this problem?
Thanks!
D Sonderegger wrote:
I believe that smooth.spline fits a cubic B-spline to the data. So you just need to know the knot points (which are returned by smooth.spline as spl$fit$knot) and then use the bs() function in the splines library.
View this message in context: http://n4.nabble.com/Smoothing-Spline-Basis-Matrix-tp1573131p1574236.html Sent from the R help mailing list archive at Nabble.com.