Learn R Programming

highfrequency (version 1.0.1)

rankJumpTest: Rank jump test

Description

Calculate the rank jump test of Li et al. (2019). The procedure tests for the rank of the jump matrix at simultaneous jump events in market returns as well as individual assets.

Usage

rankJumpTest(
  marketPrice,
  stockPrices,
  alpha = c(5, 3),
  coarseFreq = 10,
  localWindow = 30,
  rank = 1,
  BoxCox = 1,
  quantiles = c(0.9, 0.95, 0.99),
  nBoot = 1000,
  dontTestAtBoundaries = TRUE,
  alignBy = "minutes",
  alignPeriod = 5,
  marketOpen = "09:30:00",
  marketClose = "16:00:00",
  tz = NULL
)

Value

A list containing criticalValues which are the bootstrapped critical values, testStatistic the test statistic of the jump test, dimensions which are the dimensions of the jump matrix

marketJumpDetections the jumps detected in the market prices, stockJumpDetections the co-jumps detected in the individual stock prices, and jumpIndices which are the indices of the detected jumps.

Arguments

marketPrice

data.table or xtscontaining the market prices in levels

stockPrices

list containing the individual stock prices in either data.table or xtsformat. The format should be the the same as marketPrice

alpha

significance level (in standard deviations) to use for the jump detections. Default is c(5,3) for 5 and 3 in the market and stocks respectively.

coarseFreq

numeric denoting the coarse sampling frequency. Default is 10

localWindow

numeric denoting the local window for the bootstrap algorithm. Default is 30

rank

rank of the jump matrix under the null hypothesis. Default is 1

BoxCox

numeric of exponents for the Box-Cox transformation, default is 1

quantiles

numeric denoting which quantiles of the bootstrapped critical values to return and compare against. Default is c(0.9, 0.95, 0.99)

nBoot

numeric denoting how many replications to be used for the bootstrap algorithm. Default is 1000

dontTestAtBoundaries

logical determining whether to exclude data across different days. Default is TRUE

alignBy

character, indicating the time scale in which alignPeriod is expressed. Possible values are: "secs", "seconds", "mins", "minutes","hours", and "ticks". To aggregate based on a 5 minute frequency, set alignPeriod to 5 and alignBy to "minutes".

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".

marketOpen

the market opening time, by default: marketOpen = "09:30:00".

marketClose

the market closing time, by default: marketClose = "16:00:00".

tz

fallback time zone used in case we we are unable to identify the timezone of the data, by default: tz = NULL. We attempt to extract the timezone from the DT column (or index) of the data, which may fail. In case of failure we use tz if specified, and if it is not specified, we use "UTC"

Author

Emil Sjoerup, based on Matlab code provided by Li et al. (2019)

Details

Let the jump times be defined as: $$ {\cal I}_{n} = \left\{ i:\left|\Delta_{i}^{n}Z\right|>u_{n}\right\} $$

Then the estimated jump matrix is: $$ \hat{\boldsymbol{J}_{n}}=\left[\Delta_{i,k}^{n}\boldsymbol{X}\right]_{i\in{\cal I}_{n}} $$

Let \(\hat{\lambda}_{n,1}^{2}\geq\hat{\lambda}_{n,2}^{2}\geq\cdots\geq\hat{\lambda}_{n,d}^{2}\) be the ordered eigenvalues of \(\hat{\boldsymbol{J}}_{n}\hat{\boldsymbol{J}}_{n}^{\prime}\), then test statistic is $$ \hat{S}_{n,t}=\sum_{j=r+1}^{d}\hat{\lambda}_{n,j}^{2}. $$

The critical values are computed by applying a bootstrapping method

The singular value decomposition of the jump matrix \(\hat{\boldsymbol{J}}_{n}\) is: $$ \hat{\boldsymbol{J}}=\hat{\boldsymbol{U}}_{n}\hat{\boldsymbol{D}}_{n}\hat{\boldsymbol{V}}_{n}^{\prime} $$

then \(\hat{\boldsymbol{U}}_{n}=\left[\hat{\boldsymbol{U}}_{1n}:\hat{\boldsymbol{U}}_{2n}\right]\) and \(\hat{\boldsymbol{V}}_{n}=\left[\hat{\boldsymbol{V}}_{1n}:\hat{\boldsymbol{V}}_{2n}\right]\)

\(\boldsymbol{\upsilon}_{n}=\left(\upsilon_{j,n}\right)_{1\leq j\leq d}\) such that \(\upsilon_{j,n}\asymp\Delta_{n}^{\varpi} for \varpi\in\left(0,1/2\right)\) which is used to trim jumps. The bootstrapping method is calculated by the following algorithm

  • Step 1.For each \(i\in{\cal I}_{n}\), draw \(\kappa_{i}^{\star}\sim\textrm{Uniform}\left[0,1\right]\) and draw with equal probability, $$ \boldsymbol{\xi}_{n,i-}^{\star} \textrm{from}\left\{ \min\left(\max\left(\Delta_{i-j}^{n}\boldsymbol{X},-\boldsymbol{\upsilon}_{n}\right),\boldsymbol{\upsilon}_{n}\right):1\leq j\leq k_{n}\right\}, $$ $$ \boldsymbol{\xi}_{n,i+}^{\star} \textrm{from}\left\{ \min\left(\max\left(\Delta_{i+j}^{n}\boldsymbol{X},-\boldsymbol{\upsilon}_{n}\right),\boldsymbol{\upsilon}_{n}\right):1\leq j\leq k_{n}\right\}, $$and set \(\boldsymbol{\zeta}_{n,i}^{\star}=\sqrt{\kappa_{i}^{\star}}\boldsymbol{\xi}_{n,i-}^{\star}+\sqrt{k-\kappa_{i}^{\star}}\boldsymbol{\xi}_{n,i+}^{\star}\) and \(\boldsymbol{\zeta}_{n}^{\star}=\left[\boldsymbol{\zeta}_{n,i}^{\star}\right]_{i\in{\cal I}_{n}}\)

  • Step 2.Repeat 1 for a large number of iterations. Set \(c\upsilon_{n,\alpha}\) as as the \(1-\alpha\) quantile of \(\left\Vert \hat{\boldsymbol{U}}_{2n}^{\prime}\boldsymbol{\xi}_{n}^{\star}\hat{\boldsymbol{V}}_{2n}\right\Vert ^{2}\) in the simulated sample.

References

Li, j., Todorov, V., Tauchen, G., and Lin, H. (2019). Rank Tests at Jump Events. Journal of Business & Economic Statistics, 37, 312-321.