LookbackHoldCorr: LookbackHoldCorr

Description Usage Arguments Value Examples

Description

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.

Usage

1
2
LookbackHoldCorr(price, lookback, holddays, Sign = TRUE,
  return_method = c("arithmetic", "log"))

Arguments

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.

Value

a 1 by 4 matrix with lookback period, holding period, return correlation estimate and p value.

Examples

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")

OUKUN0705/timeseriesmom documentation built on May 7, 2019, 8:55 p.m.