Various functions to analyze data over a moving window of periods.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22  runSum(x, n = 10, cumulative = FALSE)
runMin(x, n = 10, cumulative = FALSE)
runMax(x, n = 10, cumulative = FALSE)
runMean(x, n = 10, cumulative = FALSE)
runMedian(x, n = 10, non.unique = "mean", cumulative = FALSE)
runCov(x, y, n = 10, use = "all.obs", sample = TRUE, cumulative = FALSE)
runCor(x, y, n = 10, use = "all.obs", sample = TRUE, cumulative = FALSE)
runVar(x, y = NULL, n = 10, sample = TRUE, cumulative = FALSE)
runSD(x, n = 10, sample = TRUE, cumulative = FALSE)
runMAD(x, n = 10, center = NULL, stat = "median", constant = 1.4826,
non.unique = "mean", cumulative = FALSE)
wilderSum(x, n = 10)

x 
Object coercible to xts or matrix. 
n 
Number of periods to use in the window or, if

cumulative 
Logical, use frominception calculation? 
non.unique 
One of 'mean', 'max', or 'min'; which compute their respective statistics for the two middle values of evensized samples. 
y 
Object coercible to xts or matrix. 
use 
Only 
sample 
Logical, sample covariance if 
center 
The values to use as the measure of central tendency, around
which to calculate deviations. The default ( 
stat 
Statistic to calculate, one of 'median' or 'mean' (e.g. median absolute deviation or mean absolute deviation, respectively.) 
constant 
Scale factor applied to approximate the standard deviation. 
A object of the same class as x
and y
or a vector (if
try.xts
fails).
returns sums over a nperiod moving window.
returns minimums over a nperiod moving window.
returns maximums over a nperiod moving window.
returns means over a nperiod moving window.
returns medians over a nperiod moving window.
returns covariances over a nperiod moving window.
returns correlations over a nperiod moving window.
returns variances over a nperiod moving window.
returns standard deviations over a nperiod moving window.
returns median/mean absolute deviations over a nperiod moving window.
retuns a Welles Wilder style weighted sum over a nperiod moving window.
Joshua Ulrich
Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.
All documentation is copyright its authors; we didn't write any of that.