Learn R Programming

highfrequency (version 0.7.0.1)

rAVGCov: Realized Covariance: Average Subsample

Description

Realized Covariance using average subsample.

Usage

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

Arguments

rData

a \((M x N)\) matrix/zoo/xts object containing the \(N\) return series over period \(t\), with \(M\) observations during \(t\).

cor

boolean, in case it is TRUE, the correlation is returned. FALSE by default.

alignBy

Align the tick data to seconds|minutes|hours. Default is "minutes"

alignPeriod

Align the tick data to this many [seconds|minutes|hours]. This can be a fraction. Default is 5

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

Prices are passed make them into log returns

Value

Realized covariance using average subsample.

References

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

Michiel de Pooter, Martin Martens, and Dick van Dijk. Predicting the daily covariance matrix for S\&P100 stocks using intraday data - but which frequency to use? Econometric Reviews, 2008.

Examples

Run this code
# NOT RUN {
# Average subsampled realized variance/covariance aligned at one minute returns at 
# 5 subgrids (5 minutes).

# Univariate
rvSub <- rAVGCov(rData = sampleTData$PRICE, alignBy = "minutes",
                 alignPeriod = 5, makeReturns = TRUE) 
rvSub

# Multivariate:
rcovSub <- rAVGCov(rData = cbind(lltc, sbux, fill = 0), alignBy = "minutes", 
                   alignPeriod = 5, makeReturns = FALSE)
rcovSub

# Multivariate with a 30 second fast aggregation and a 2.5 minute slow aggregation.
rcovSub <- rAVGCov(rData = cbind(lltc, sbux, fill = 0), 
                   alignBy = "minutes", alignPeriod = 2.5, k = 0.5, makeReturns = FALSE)
rcovSub
# }

Run the code above in your browser using DataLab