[R] Monotone splines
Stephen Ellner
spe2 at cornell.edu
Thu Sep 6 18:41:59 CEST 2007
Servien remi (servien.remi12 at yahoo.fr) wrote:
>I want to use splines to estimate a function but i want to force the interpolation to be monotone. Is this possible with R ?
There are a few options. You can use mono.con in mgcv (see the example code in ?pcls), or smooth.monotone in fda. In both of these you have to specify the smoothing parameter yourself. I've written (with some help from Simon Wood) a set of scripts that fit a monontone nondecreasing regression spline with smoothing parameter chosen by GCV taking account of the active constraints, the approach developed by
Wood, S.N. (1994) Monotonic smoothing splines fitted by cross validation. SIAM Journal on Scientific Computing 15:1126-1133.
You can get them at www.eeb.cornell.edu/ellner/software.html; scroll down and look for "Gradfit".
The function you need is gcv.rssM. It isn't very efficient, so you may have trouble if your data set is large.
Stephen P. Ellner (spe2 at cornell.edu)
Department of Ecology and Evolutionary Biology
Corson Hall, Cornell University, Ithaca NY 14853-2701
More information about the R-help
mailing list