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

后端 未结 3 1929
太阳男子
太阳男子 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:32

    I'm not sure if this is precisely what you are looking for, but you could try Tps() in the R package fields. It's meant for doing thin-plate splines interpolations (2D equivalent of cubic splines) for spatial data, but will take up to four covariates, although it will expect them to be euclidean x,y,z + time, so you need to be clear that you are selecting the correct options for your particular case. If you want to interpolate, set the smoothing parameter lambda to zero. You might also try the function polymars() in the R package polspline.

    0 讨论(0)
  • 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.

    0 讨论(0)
  • 2020-12-10 21:56

    Have a look at the DiceKriging package which was developed to undertake tasks like this. http://cran.r-project.org/web/packages/DiceKriging/index.html

    I've provided an example application at https://stats.stackexchange.com/questions/13510/fitting-multivariate-natural-cubic-spline/65012#65012

    0 讨论(0)
提交回复
热议问题