############################################ # running mean filter. The basics ############################################ source("scripts/rmean.R") # generate a white noise process n<-100 t<-seq(1,n,1)+1899 x<-rnorm(n) # window width x11<-rmean(x,w=11) x5<-rmean(x,w=3) t11<-rmean(t,w=11) t5<-rmean(t,w=5) plot(t,x,typ='l',col='green') # running means is a low-pass filter lines(t11,x11,col=1) # the residuals are the high-frequency components hf11<-x-x11 lines(t,hf11,col=4)