rolling window
Gabor Grothendieck wrote:
On 7/19/07, Jordi Molins <jordi.molins.coronado at gmail.com> wrote:
I want to do a rolling window calculation for multivariate data. In other words: rollFun in fMultivar makes univariate calculations, ie, given for example mydata[1:5], mydata[2:6], ? I get one number (the function applied to mydata[1:5]) every time. rollingFunction in PerformanceAnalytics does the same but for possibly multivariate data, but one column at a time. rapply in zoo also does rolling window for univariate data (at least, all examples are with univariate data).
rollapply (which was called rapply in old versions of zoo but was renamed to avoid collisions with a new function of the same name in the core of R) in zoo can handle multivariate zoo series either one column at a time (default) or combined (via by.column = FALSE):
the parameter '...' in rollingFunction() will allow you to pass in the by.column parameter described by Gabor. - Brian