Learn R Programming

highfrequency (version 1.0.1)

rAVGCov: Realized covariances via subsample averaging

Description

Calculates realized variances via averaging across partially overlapping grids, first introduced by Zhang et al. (2005). This estimator is basically an average across different rCov estimates that start at different points in time, see details below.

Usage

rAVGCov(
  rData,
  cor = FALSE,
  alignBy = "minutes",
  alignPeriod = 5,
  k = 1,
  makeReturns = FALSE,
  ...
)

Value

in case the input is and contains data from one day, an \(N\) by \(N\) matrix is returned. If the data is a univariate xts object with multiple days, an xts is returned. If the data is multivariate and contains multiple days (xts or data.table), the function returns a list containing \(N\) by \(N\) matrices. Each item in the list has a name which corresponds to the date for the matrix.

Arguments

rData

an xts or data.table object containing returns or prices, possibly for multiple assets over multiple days.

cor

boolean, in case it is TRUE, and the input data is multivariate, the correlation is returned instead of the covariance matrix. FALSE by default.

alignBy

character, indicating the time scale in which alignPeriod is expressed. Possible values are: "ticks", "secs", "seconds", "mins", "minutes", "hours"

alignPeriod

positive numeric, indicating the number of periods to aggregate over. For example, to aggregate based on a 5-minute frequency, set alignPeriod = 5 and alignBy = "minutes".

k

numeric denoting which horizon to use for the subsambles. This can be a fraction as long as \(k\) is a divisor of alignPeriod default is 1.

makeReturns

boolean, should be TRUE when rData contains prices instead of returns. FALSE by default.

...

used internally, do not change.

Author

Scott Payseur, Onno Kleen, and Emil Sjoerup.

Details

Suppose that in period \(t\), there are \(N\) equispaced returns \(r_{i,t}\) and let \(\Delta\) be equal to alignPeriod. For \(\ i \geq \Delta\), we define the subsampled \(\Delta\)-period return as $$ \tilde r_{t,i} = \sum_{k = 0}^{\Delta - 1} r_{t,i-k}, . $$ Now define \(N^*(j) = N/\Delta\) if \(j = 0\) and \(N^*(j) = N/\Delta - 1\) otherwise. The \(j\)-th component of the rAVGCov estimator is given by $$ RV_t^j = \sum_{i = 1}^{N^*(j)} \tilde r_{t, j + i \cdot \Delta}^2. $$ Now taking the average across the different \(RV_t^j, \ j = 0, \dots, \Delta-1,\) defines the rAVGCov estimator. The multivariate version follows analogously.

Note that Liu et al. (2015) show that rAVGCov is not only theoretically but also empirically a more reliable estimator than rCov.

References

Liu, L. Y., Patton, A. J., Sheppard, K. (2015). Does anything beat 5-minute RV? A comparison of realized measures across multiple asset classes. Journal of Econometrics, 187, 293-311.

Zhang, L., Mykland, P. A. , and Ait-Sahalia, Y. (2005). A tale of two time scales: Determining integrated volatility with noisy high-frequency data. Journal of the American Statistical Association, 100, 1394-1411.

See Also

ICov for a list of implemented estimators of the integrated covariance.

Examples

Run this code
# Average subsampled realized variance/covariance aligned at one minute returns at
# 5 sub-grids (5 minutes).

# Univariate subsampled realized variance
rvAvgSub <- rAVGCov(rData = sampleTData[, list(DT, PRICE)], alignBy = "minutes",
                    makeReturns = TRUE)
rvAvgSub

# Multivariate subsampled realized variance
rvAvgCovSub <- rAVGCov(rData = sampleOneMinuteData[1:391], makeReturns = TRUE)
rvAvgCovSub

Run the code above in your browser using DataLab