On Sat, Jul 25, 2009 at 5:07 AM, Dieter Menne<dieter.me...@menne-biomed.de> wrote: > > > > losemind wrote: >> >> If I use a moving average, it will smooth the choppy time series, but >> it will lead to lagging... >> > > The lagging can only be removed if you look into the future, otherwise you > run into causality problems. > So the easiest way is to center your output data on half the window width. > Not using a rectangular weighting is recommended. >
Note that rollmean/rollmax/rollmedian/rollapply in the zoo package centers by default and whether its centered or left and or right aligned is controlled by the align= argument. ______________________________________________ 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.