rCov: Realized Covariance

Description Usage Arguments Value Author(s) Examples

View source: R/realized.R

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}=āˆ‘_{i=1}^{M}r_{t,i}r'_{t,i}.

Usage

1
2
 
rCov(rdata,cor = FALSE, align.by = NULL, align.period = 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.

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.

...

additional arguments.

Value

an N x N matrix

Author(s)

Jonathan Cornelissen and Kris Boudt

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
 # Realized Variance/Covariance for CTS aligned   
 # at 5 minutes.
 data(sample_tdata); 
 data(sample_5minprices_jumps);
 
 # Univariate: 
 rv = rCov( rdata = sample_tdata$PRICE, align.by ="minutes", 
                    align.period =5, makeReturns=TRUE); 
 rv 
 
 # Multivariate: 
 rc = rCov( rdata = sample_5minprices_jumps['2010-01-04'], makeReturns=TRUE); 
 rc

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.0004543674
             rdata.1     rdata.2     rdata.3     rdata.4     rdata.5
rdata.1  0.010924507 0.006417440 0.010902222 0.010637283 0.007641477
rdata.2  0.006417440 0.004854752 0.007497488 0.006908535 0.004988165
rdata.3  0.010902222 0.007497488 0.025470413 0.013370373 0.008256313
rdata.4  0.010637283 0.006908535 0.013370373 0.013558307 0.008462553
rdata.5  0.007641477 0.004988165 0.008256313 0.008462553 0.007135684
rdata.6  0.006621664 0.004459963 0.007165239 0.007058942 0.005222064
rdata.7  0.006564232 0.004320079 0.006898855 0.007011920 0.005077752
rdata.8  0.008844032 0.006354244 0.010140831 0.008384299 0.007287717
rdata.9  0.005432923 0.003587660 0.006949304 0.005752133 0.004657362
rdata.10 0.007333314 0.004901717 0.008748716 0.007959900 0.005735400
             rdata.6     rdata.7     rdata.8     rdata.9    rdata.10
rdata.1  0.006621664 0.006564232 0.008844032 0.005432923 0.007333314
rdata.2  0.004459963 0.004320079 0.006354244 0.003587660 0.004901717
rdata.3  0.007165239 0.006898855 0.010140831 0.006949304 0.008748716
rdata.4  0.007058942 0.007011920 0.008384299 0.005752133 0.007959900
rdata.5  0.005222064 0.005077752 0.007287717 0.004657362 0.005735400
rdata.6  0.005182243 0.004543131 0.006212021 0.004063073 0.004901623
rdata.7  0.004543131 0.005057454 0.007206312 0.004114702 0.004916568
rdata.8  0.006212021 0.007206312 0.025892047 0.006320008 0.007654978
rdata.9  0.004063073 0.004114702 0.006320008 0.009120387 0.004383184
rdata.10 0.004901623 0.004916568 0.007654978 0.004383184 0.006411112

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