rBPCov {highfrequency}R Documentation

Realized bipower covariance

Description

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

Let rt,ir_{t,i} be an intraday Nx1N x 1 return vector and i=1,...,Mi=1,...,M the number of intraday returns.

The rBPCov is defined as the process whose value at time tt is the NN-dimensional square matrix with k,qk,q-th element equal to

\mboxrBPCov[k,q]t=π8(i=2Mr(k)t,i+r(q)t,i r(k)t,i1+r(q)t,i1r(k)t,ir(q)t,i r(k)t,i1r(q)t,i1), \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,ir_{(k)t,i} is the kk-th component of the return vector ri,tr_{i,t}.

Usage

rBPCov(
  rData,
  cor = FALSE,
  alignBy = NULL,
  alignPeriod = NULL,
  makeReturns = FALSE,
  makePsd = FALSE,
  ...
)

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. E.g. to aggregate based on a 5-minute frequency, set alignPeriod to 5 and alignBy to "minutes".

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.

...

used internally, do not change.

Value

in case the input is and contains data from one day, an NN by NN 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 NN by NN matrices. Each item in the list has a name which corresponds to the date for the matrix.

Author(s)

Jonathan Cornelissen, Kris Boudt, and Emil Sjoerup.

References

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

See Also

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

Examples

# Realized Bipower Variance/Covariance for a price series aligned
# at 5 minutes.

# Univariate:
rbpv <- rBPCov(rData = sampleTData[, list(DT, PRICE)], alignBy ="minutes",
               alignPeriod = 5, makeReturns = TRUE)
# Multivariate:
rbpc <- rBPCov(rData = sampleOneMinuteData, makeReturns = TRUE, makePsd = TRUE)
rbpc

[Package highfrequency version 1.0.1 Index]