Vijayakumar Ramachandran
2011-Feb-12 07:36 UTC
[R] natural cubic spline and multiple variables
I want to create natural cubic spline on my predictors and fit them to a linear model. The DF and Degree of all the splines are the same. I noticed that I can setup the lm() formula as y~ns(x1, df=5) + ns(x2, df=5). My problem is that I have a huge number of predictors (hundreds). ns however seems to take only a single set of values for creating the splines. Is there an elegant way to handle this? ThanksVijay [[alternative HTML version deleted]]