Learn R Programming

highfrequency (version 1.0.1)

rThresholdCov: Threshold Covariance

Description

Calculate the threshold covariance matrix proposed in Gobbi and Mancini (2009). Unlike the rOWCov, the rThresholdCov uses univariate jump detection rules to truncate the effect of jumps on the covariance estimate. As such, it remains feasible in high dimensions, but it is less robust to small cojumps.

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

Then, the \(k,q\)-th element of the threshold covariance matrix is defined as

$$ \mbox{thresholdcov}[k,q]_{t} = \sum_{i=1}^{M} r_{(k)t,i} 1_{\{r_{(k)t,i}^2 \leq TR_{M}\}} \ \ r_{(q)t,i} 1_{\{r_{(q)t,i}^2 \leq TR_{M}\}}, $$ with the threshold value \(TR_{M}\) set to \(9 \Delta^{-1}\) times the daily realized bi-power variation of asset \(k\), as suggested in Jacod and Todorov (2009).

Usage

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

Value

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

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

makeReturns

boolean, should be TRUE when rData contains prices instead of returns. FALSE by default.

...

used internally, do not change.

Author

Jonathan Cornelissen, Kris Boudt, and Emil Sjoerup.

References

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

Jacod, J. and Todorov, V. (2009). Testing for common arrival of jumps in discretely-observed multidimensional processes. Annals of Statistics, 37, 1792-1838.

Mancini, C. and Gobbi, F. (2012). Identifying the Brownian covariation from the co-jumps given discrete observations. Econometric Theory, 28, 249-273.

See Also

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

Examples

Run this code
# Realized threshold  Variance/Covariance:
# Multivariate:
if (FALSE) {
library("xts")
set.seed(123)
start <- strptime("1970-01-01", format = "%Y-%m-%d", tz = "UTC")
timestamps <- start + seq(34200, 57600, length.out = 23401)

dat <- cbind(rnorm(23401) * sqrt(1/23401), rnorm(23401) * sqrt(1/23401))

dat <- exp(cumsum(xts(dat, timestamps)))
rcThreshold <- rThresholdCov(dat, alignBy = "minutes", alignPeriod = 1, makeReturns = TRUE)
rcThreshold
}

Run the code above in your browser using DataLab