Is there an R library that estimates a multivariate natural cubic spline (or similar) function?

后端 未结 3 1930
太阳男子
太阳男子 2020-12-10 20:57

note: originally posted on Cross Validated (stats SE) on 07-26-2011, with no correct answers to date.

Background

I have a model,

3条回答
  •  攒了一身酷
    2020-12-10 21:46

    Actually several packages can do it. The one I use is the "rms" package which has rcs, but the survival package also has pspline and the splines package has the ns function {}. "Natural splines" (constructed with ns) are also cubic splines. You will need to form multivariate fitting function with the '*' operator in the multivariate formula creating "crossed" spline terms. that the example you offered was not sufficiently rich.

    I guess I am confused that you want exact fits. R is a statistical package. Approximate estimation is the goal. Generally exact fits are more of a problem because they lead to multicollinearity.

提交回复
热议问题