Learn R Programming

highfrequency (version 0.7.0.1)

rBPCov: Realized BiPower Covariance

Description

Function returns the Realized BiPower Covariance (rBPCov), defined in Barndorff-Nielsen and Shephard (2004).

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

The rBPCov is defined as the process whose value at time \(t\) is the \(N\)-dimensional square matrix with \(k,q\)-th element equal to $$ \mbox{rBPCov}[k,q]_t = \frac{\pi}{8} \bigg( \sum_{i=2}^{M} \left| r_{(k)t,i} + r_{(q)t,i} \right| \ \left| r_{(k)t,i-1} + r_{(q)t,i-1} \right| \\ - \left| r_{(k)t,i} - r_{(q)t,i} \right| \ \left| r_{(k)t,i-1} - r_{(q)t,i-1} \right| \bigg), $$ where \(r_{(k)t,i}\) is the \(k\)-th component of the return vector \(r_{i,t}\).

Usage

rBPCov(
  rData,
  cor = FALSE,
  alignBy = NULL,
  alignPeriod = NULL,
  makeReturns = FALSE,
  makePsd = 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

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.

makePsd

boolean, in case it is TRUE, the positive definite version of rBPCov is returned. FALSE by default.

Value

an \(N x N\) matrix or a list of matrices if the time period spans multiple days

References

Barndorff-Nielsen, O. and N. Shephard (2004). Measuring the impact of jumps in multivariate price processes using bipower covariation. Discussion paper, Nuffield College, Oxford University.

Examples

Run this code
# NOT RUN {
# Realized Bipower Variance/Covariance for a price series aligned   
# at 5 minutes.
 
# Univariate: 
rbpv <- rBPCov(rData = sampleTData$PRICE, alignBy ="minutes", 
               alignPeriod = 5, makeReturns = TRUE) 
rbpv 
 
# Multivariate: 
rbpc <- rBPCov(rData = sample5MinPricesJumps['2010-01-04'], makeReturns = TRUE, makePsd = TRUE)
rbpc
 
# }

Run the code above in your browser using DataLab