LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (August 2005, week 2)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Thu, 11 Aug 2005 11:42:41 -0700
Reply-To:   Andre Bushmakin <bushmakin@MSN.COM>
Sender:   "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:   Andre Bushmakin <bushmakin@MSN.COM>
Organization:   http://groups.google.com
Subject:   Re: Data step code for smoothing via cubic spline interpolation?
Comments:   To: sas-l@uga.edu
Content-Type:   text/plain; charset="iso-8859-1"

William,

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).

For example:

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.

Andre

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. > > > Regards, > > William


Back to: Top of message | Previous page | Main SAS-L page