<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

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to