Learn R Programming

highfrequency (version 0.7.0.1)

rCov: Realized Covariance

Description

Function returns the Realized Covariation (rCov). Let \(r_{t,i}\) be an intraday \(N x 1\) return vector and \(i=1,...,M\) the number of intraday returns.

Then, the rCov is given by $$ \mbox{rCov}_{t}=\sum_{i=1}^{M}r_{t,i}r'_{t,i}. $$

Usage

rCov(
  rData,
  cor = FALSE,
  alignBy = NULL,
  alignPeriod = NULL,
  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\). In case of a matrix, no multi-day adjustment is possible.

cor

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

alignBy

a string, align the tick data to "seconds"|"minutes"|"hours".

alignPeriod

an integer, align the tick data to this many [seconds|minutes|hours].

makeReturns

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

Value

an \(N x N\) matrix

Examples

Run this code
# NOT RUN {
# Realized Variance/Covariance for prices aligned   
# at 5 minutes.
data(sampleTData)
data(sample5MinPricesJumps)

# Univariate: 
rv = rCov(rData = sampleTData$PRICE, alignBy = "minutes", 
                   alignPeriod = 5, makeReturns = TRUE)
rv 

# Multivariate: 
rc = rCov(rData = sample5MinPricesJumps['2010-01-04'], makeReturns=TRUE)
rc
# }

Run the code above in your browser using DataLab