Because you need to calculate derivatives, I think, the best way for
you is to look at Numerical Differentiation. I would recommend part
20.7-1 (c) of the "Mathematical handbook for scientists and
engineers: definitions, theorems, and formulas for reference and
review" by Granino A. Korn and Theresa M. Korn.
The part, I mentioned, has several formulas for numerical
differentiation after smoothing (formulas are based on differentiation
of smoothed polynomial approximation).
y' = [1/(12*d)]*[(y - y ) - 8*(y - y );
k k-2 k+2 k-1 k+1
where d=x - x = x -x =...
k+2 k+1 k+1 k
I implemented some of this in SAS, but I did it using IML.
William Turner wrote:
> I'm trying to find data step code that would perform smoothing of an X,Y
> series of data via cubic spline interpolation (or a similar spline
> interpolation). I'm trying to replicate the smoothing done by
> the "INTERPOL=SM<0-99>" option to the SYMBOL statement in SAS graph. I
> know there are a couple of procedures that can do this, but I want to
> perform the smoothing in a data step, continuously re-evaluating the y=f(x)
> function as each new record (i.e., set of X,Y values) is input. I would
> take a crack at writing it myself, but I must admit that I don't completely
> understand the mechanics of this procedure. My goal is to smooth the data
> sufficiently in order to identify local min and max values (where the first
> derivative is zero) and points of inflection (where the second derivative
> is zero).
> The data series are a fixed period counter (X) ranging from 1 to n, where
> it's always true that (0 < x1 < x2 < ... < xn), and an oscillating
> indicator that ranges between 0 and 15 (Y). The Y values are very noisy
> (which is why I'm looking for a good smoothing function). I want to find a
> solution that doesn't lag significantly, as a moving average approach would
> do. At the lowest level of X represented in the data, there can only be
> one value of Y.
> Any and all help or suggestions will be greatly appreciated. Thank you.