Multivariate apply.rolling()

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Multivariate apply.rolling()

Cren
# I've read that rollapply, and its wrapper apply.rolling()
# from PerformanceAnalytics package, do not work with multivariate
# time series neither their output can be a multivariate time series.

# Then I was wondering if any other function like those exists, or
# if I need to write my own function to perform multivariate
# time serie rolling analysis.

# Something like this:

# Let 'X' be your multivariate time series:
# output <- matrix(NA, ncol = ncol(X), nrow = nrow(X))
# width <- 199
# for(i in 1:(nrow(output) - width) {
#     data <- X[i:(i + width),]  
#     output[i,] <- function(data)
#}
# rownames(output) <- rownames(as.timeSeries(X))

# ...and this should be a (probably not efficient) way to do it.
# Any better idea?

# Thanks,