[R] smooth function advice

Dieter Menne dieter.menne at menne-biomed.de
Thu Oct 30 16:59:43 CET 2008


 <tolga.i.uzuner <at> jpmorgan.com> writes:

> I am looking for a smoothing function with the following characteristics 
> for a time series of data:
> - at each date, should only use data up to that date (so, right aligned 
> and not centered)
> - should return a smoothed series of length equal to the original time 
> series:
>         - for a one-day time series, just returns that day
>         - this means the front part of the series will not be as smooth... 
> that's  ok
>         - if the original time series has length 10, the returned smoothed 
> time series has length 10 
> - there should be some control over smoothness

First order recursive smoother, no package needed 

y(0) = x(0)
y(n) = alpha*y(n-1)+(1-alpha)x(n)

Use alpha = 0.95 for a starter; must be < 1.

Dieter



More information about the R-help mailing list