Skip to content
Prev 319333 / 398506 Next

Extracting the knots of a natural cubic spline fit

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