
Last chance! 50% off unlimited learning
Sale ends in
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.
rAVGCov(
rData,
cor = FALSE,
alignBy = "minutes",
alignPeriod = 5,
k = 1,
makeReturns = FALSE,
...
)
in case the input is and contains data from one day, an 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
an xts
or data.table
object containing returns or prices, possibly for multiple assets over multiple days.
boolean, in case it is TRUE
, and the input data is multivariate, the correlation is returned instead of the covariance matrix. FALSE
by default.
character, indicating the time scale in which alignPeriod
is expressed.
Possible values are: "ticks"
, "secs"
, "seconds"
, "mins"
, "minutes"
, "hours"
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"
.
numeric denoting which horizon to use for the subsambles. This can be a fraction as long as alignPeriod
default is 1
.
boolean, should be TRUE
when rData
contains prices instead of returns. FALSE
by default.
used internally, do not change.
Scott Payseur, Onno Kleen, and Emil Sjoerup.
Suppose that in period alignPeriod
. For rAVGCov
estimator is given by
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.
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.
ICov
for a list of implemented estimators of the integrated covariance.
# 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