runVar {kcpRS} | R Documentation |
Extracts the running variances by sliding a window comprised of wsize
time points, and in each window, the variance for each variable is computed.
Each time the window is slid, the oldest time point is discarded and the latest time point is added.
runVar(data, wsize = 25)
data |
N x v dataframe where N is the no. of time points and v the no. of variables |
wsize |
Window size |
Running variances time series
phase1=cbind(rnorm(50,0,1),rnorm(50,0,1)) #phase1: SD=1
phase2=cbind(rnorm(50,0,2),rnorm(50,0,2)) #phase2: SD=2
X=rbind(phase1,phase2)
RS=runVar(data=X,wsize=25)
ts.plot(RS, gpars=list(xlab="Window", ylab="Variances", col=1:2,lwd=2))