Description Usage Arguments Value Examples
The function applies discrete moving window to a price series. Each window is divided into lookback period and holding period. The returns in the lookback period and holding period are calculated with each window. The correlation between the associated p value on a returns in the lookback period and holding period discrete rolling window basis. The rolling step size is the minimum of the lookback period and holding period.
1 2 | LookbackHoldCorr(price, lookback, holddays, Sign = TRUE,
return_method = c("arithmetic", "log"))
|
price |
an object of time serise representing a price series. |
lookback |
length of lookback period. |
holddays |
length of holding period. |
Sign |
whether the returns or signs of returns are used to calculate correlation, default is TRUE. |
return_method |
method of calculating returns. |
a 1 by 4 matrix with lookback period, holding period, return correlation estimate and p value.
1 2 3 4 5 6 | getSymbols("^GSPC", from = 2010, to = Sys.Date())
price <- GSPC[, 6]
LookbackHoldCorr(price, 200, 20, TRUE, "log")
LookbackHoldCorr(price, 200, 20, FALSE, "log")
LookbackHoldCorr(price, 200, 20, TRUE, "arithmetic")
LookbackHoldCorr(price, 200, 20, FALSE, "arithmetic")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.