Learn R Programming

highfrequency (version 0.5.3)

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, align.by = NULL, align.period = 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.

align.by

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

align.period

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.

...

additional arguments.

Value

an \(N x N\) matrix

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 CTS aligned   
 # at 5 minutes.
 data(sample_tdata); 
 data(sample_5minprices_jumps);
 
 # Univariate: 
 rbpv = rBPCov( rdata = sample_tdata$PRICE, align.by ="minutes", 
                    align.period =5, makeReturns=TRUE); 
 rbpv 
 
 # Multivariate: 
 rbpc = rBPCov( rdata = sample_5minprices_jumps['2010-01-04'], makeReturns=TRUE,makePsd=TRUE); 
 rbpc
# }

Run the code above in your browser using DataLab