runMean: Running Means

View source: R/runMean.R

runMeanR Documentation

Running Means

Description

Extracts the running means by sliding a window comprised of wsize time points, and in each window, the mean for each variable is computed. Each time the window is slid, the oldest time point is discarded and the latest time point is added.

Usage

runMean(data, wsize = 25)

Arguments

data

N x v dataframe where N is the no. of time points and v the no. of variables

wsize

Window size

Value

Running means time series

Examples

phase1=cbind(rnorm(50,0,1),rnorm(50,0,1)) #phase1: Means=0
phase2=cbind(rnorm(50,1,1),rnorm(50,1,1)) #phase2: Means=1
X=rbind(phase1,phase2)
RS=runMean(data=X,wsize=25)
ts.plot(RS, gpars=list(xlab="Window", ylab="Means", col=1:2,lwd=2))


kcpRS documentation built on Oct. 25, 2023, 5:07 p.m.