cm.spline {ftsa} | R Documentation |
Performs cubic spline monotonic interpolation of given data points, returning either a list of points obtained by the interpolation or a function performing the interpolation. The splines are constrained to be monotonically increasing (i.e., the slope is never negative).
cm.spline(x, y = NULL, n = 3 * length(x), method = "fmm", xmin = min(x), xmax = max(x), gulim = 0)
x,y |
Vectors giving the coordinates of the points to be interpolated. Alternatively a single plotting structure can be specified: see xy.coords . |
method |
Specifies the type of spline to be used. Possible values are “fmm”, “natural” and “periodic”. |
n |
Interpolation takes place at n equally spaced points spanning the interval [xmin , xmax ]. |
xmin |
Left-hand endpoint of the interpolation interval. |
xmax |
Right-hand endpoint of the interpolation interval. |
gulim |
If gulim!=0 then it is taken as the upper limit on the gradient, and the interpolant is limited gradient rather than monotonic. |
Results are identical to splinefun
except that Hyman Filtering is used to produce co-monotonic
interpolation.
spline |
Returns a list containing components x and y which give the coordinates where interpolation took place, and the interpolated values. |
splinefun |
Returns a function which will perform cubic spline interpolation of the given data points. This is often more useful than spline . |
Simon N Wood, Rob J Hyndman
G. E. Forsythe and M. A. Malcolm and C. B. Moler (1977) Computer Methods for Mathematical Computations, Englewood Cliffs, New Jersey: Prentice-Hall.
J. M. Hyman (1983) "Accurate monotonicity preserving cubic interpolation", SIAM Journal on Scientific Computing, 4(4), 645-654.
R. L. Dougherty and A. Edelman and J. M. Hyman (1989) "Nonnegativity, monotonicity, or convexity-preserving cubic and quintic Hermit interpolation", Mathematics of Computation, 52(186), 471-494.
x <- seq(0, 4, l = 20) y <- sort(rnorm(20)) plot(x,y) lines(spline(x = x, y = y, n = 201), col = 2) # Not necessarily monotonic lines(cm.spline(x = x, y = y, n = 201), col = 3) # Monotonic