[R] interpolation and numerical differentiation in R ?

Douglas Bates bates at stat.wisc.edu
Sun Sep 2 00:38:46 CEST 2001


"Robert D. Merithew" <merithew at ccmr.cornell.edu> writes:

> Hi,
> 
> I'm trying to determine if R is useful to me.  I've browsed 'The Basics of
> S and S-Plus' (Krause & Olson), and like the logic of the language.  
> However, I don't see an easy way to do things like this:
> 
> 
> * given a set of observations (x,y) (x and y equal-length vectors), and a
> 2nd set of abscissas x2, interpolate y at the new abscissas x2.  (for now,
> I don't really care what kind of interpolation -- linear, some type of
> spline, etc.)

See interpSpline in the splines library.

> * given observations (x,y), (with unequally-spaced x), create vector z
> with the numerical derivative of y with respect to x (eg evaluated at the
> values x).

When evaluating the interpolating spline produced by interpSpline you
can specify that you want derivatives instead of the function value.
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list