[R] Derivative of a splinefun function.
Rolf Turner
rolf at math.unb.ca
Fri Mar 17 19:13:00 CET 2006
Is there a way of calculating the derivative of a function returned
by splinefun()? Such a function is a cubic spline, whence it has a
calculable derivative, but is there a (simple) way of getting at it?
One workaround that I have thought of is to take a fine grid of
points, evaluate the function returned by splinefun() at these
points, put an interpolating spline through these points using
smooth.spline() with spar=0, and then calculate the derivative with
predict(...,deriv=1).
This seems pretty kludgy, and fraught with a certain amount of peril.
Is there a better way?
cheers,
Rolf Turner
rolf at math.unb.ca
More information about the R-help
mailing list