rBPCov: Realized BiPower Covariance

Description Usage Arguments Value Author(s) References Examples

View source: R/realized.R

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{π}{8} \bigg( ∑_{i=2}^{M} ≤ft| r_{(k)t,i} + r_{(q)t,i} \right| \ ≤ft| r_{(k)t,i-1} + r_{(q)t,i-1} \right| \\ - ≤ft| r_{(k)t,i} - r_{(q)t,i} \right| \ ≤ft| 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

1
2
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

Author(s)

Jonathan Cornelissen and Kris Boudt

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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
 # 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

Example output

Loading required package: xts
Loading required package: zoo

Attaching package: 'zoo'

The following objects are masked from 'package:base':

    as.Date, as.Date.numeric

[1] 0.0004178507
             [,1]        [,2]        [,3]        [,4]        [,5]        [,6]
 [1,] 0.011911028 0.006579688 0.010373523 0.011280509 0.007839027 0.006461952
 [2,] 0.006579688 0.004716050 0.006529181 0.007013119 0.004892785 0.004147758
 [3,] 0.010373523 0.006529181 0.011020467 0.011063430 0.007984012 0.006153050
 [4,] 0.011280509 0.007013119 0.011063430 0.013966799 0.008610967 0.006857461
 [5,] 0.007839027 0.004892785 0.007984012 0.008610967 0.007366721 0.004960283
 [6,] 0.006461952 0.004147758 0.006153050 0.006857461 0.004960283 0.004662173
 [7,] 0.006515773 0.004083339 0.005919085 0.007145569 0.004585945 0.004038282
 [8,] 0.008391074 0.006054714 0.007655080 0.008889843 0.006682064 0.005650417
 [9,] 0.007322200 0.004503411 0.007116206 0.007668197 0.005670977 0.004571320
[10,] 0.007525586 0.004444211 0.007020745 0.007704124 0.005261043 0.004353370
             [,7]        [,8]        [,9]       [,10]
 [1,] 0.006515773 0.008391074 0.007322200 0.007525586
 [2,] 0.004083339 0.006054714 0.004503411 0.004444211
 [3,] 0.005919085 0.007655080 0.007116206 0.007020745
 [4,] 0.007145569 0.008889843 0.007668197 0.007704124
 [5,] 0.004585945 0.006682064 0.005670977 0.005261043
 [6,] 0.004038282 0.005650417 0.004571320 0.004353370
 [7,] 0.004674653 0.006295962 0.004716030 0.004318852
 [8,] 0.006295962 0.010347564 0.006032211 0.006193812
 [9,] 0.004716030 0.006032211 0.007438345 0.005010901
[10,] 0.004318852 0.006193812 0.005010901 0.005838879

highfrequency documentation built on May 2, 2019, 6:09 p.m.