an integer width of the rolling window. Must be odd for
rollMedian.
FUN
the function to be rolled.
na.pad
a logical flag. Should NA padding be added at beginning?
By default FALSE.
align
a character string specifying whether the index of the
result should be left- or right-aligned or centered
compared to the rolling window of observations. The
default choice is set to align="center".
...
optional arguments to be passed.
Value
returns an object of class 'timeSeries'.
Details
The code in the core of the functions rollMean, rollMin,
rollMax, and rollMedian was borrowed from the package
zoo authored by Achim Zeileis, Gabor Grothendieck and
Felix Andrews.
## Use Swiss Pension Fund Data Set of Returns - head(LPP2005REC)
SPI <- LPP2005REC[, "SPI"]
head(SPI)
## Plot Drawdowns - rmean <- rollMean(SPI, k = 10)
plot(rmean)