[R] Extracting the knots of a natural cubic spline fit

Rajat Tayal rajat at igidr.ac.in
Tue Mar 12 20:59:35 CET 2013


Dear list members,

I am trying to fit a natural cubic spline to my dataset using the ns
function in the splines package.
Specifically, I do:

library(splines)
lm(y ~ ns(x, df=3), data =data)

How do I extract the values of the interior knots of the fitted spline ?

Thanks,

Rajat

-------------------------------------------------------------------------
Rajat Tayal
Ph.D Research Scholar
Indira Gandhi Institute of Development Research,
Gen A.K.Vaidya Marg, Goregaon (East)
Mumbai



More information about the R-help mailing list