search for: rollinganalysis

Displaying 2 results from an estimated 2 matches for "rollinganalysis".

2005 Mar 02
2
apply a function to a rolling subset of a vector
Try this: > ?convolve > x<-rnorm(1000) > y<-rep(1,20) > z<-convolve(x,y,type="filter") > plot(x,type="l") > str(z) num [1:981] 6.31 7.28 8.16 7.39 4.65 ... > lines(c(rep(0,10),z,rep(0,10)),col="yellow",lwd=3) > lines(c(rep(0,10),z,rep(0,10))/length(y),col="red",lwd=3) #running mean You wrote: Does anyone know an easy way
2004 Dec 13
3
Moving standard deviation?
Is there a simple function in R to get a moving standard deviation (i.e. for the last x samples)? My goal is to plot bollinger bands around a moving average for price data. I use kernel smoothing for the moving average. cheers and thanks! over and out -- doktora