Description Usage Arguments Details Value
Runs rollapplyr multiple times on an xts matrix to apply a function using a set of different rolling window sizes.
1 |
data |
A single column xts matrix containing prices or returns. |
FUN |
The name of the function that will be applied. |
windows |
A vector of window sizes from which to loop over and pass to the rollapplyr function at each iteration. |
... |
additional arguments passed to FUN (this is fixed for all iterations). |
The data argument is assumed to be an xts matrix. The function is any function that can be used with rollapplyr. The windows argument is a vector corresponding to the rolling window size passed to FUN and rollapplyr during each iteration.
For example, if windows == c(20, 40, 100), then there will be three iterations as follows: the window size will be 20 periods for the first iteration, 40 for the second iteration, and 100 periods for the third iteration.
Since rollapplyr is used, the leading rows will contain NAs up to the window size + 1. Use the zoo:na.locf function to remove the leading NAs.
An xts matrix with the same number of columns as the length of the windows parameter, where each column corresponds to one of the window sizes i.e. a column is associated with an iteration.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.