Learn R Programming

highfrequency (version 0.7.0.1)

rankJumpTest: Rank jump test

Description

Rank jump test

Usage

rankJumpTest(
  marketPrice,
  stockPrices,
  alpha = c(5, 3),
  coarseFreq = 10,
  localWindow = 30,
  rank = 1,
  BoxCox = 1,
  nBoot = 1000,
  dontTestAtBoundaries = TRUE,
  on = "minutes",
  k = 5,
  marketOpen = "09:30:00",
  marketClose = "16:00:00",
  tz = "GMT"
)

Arguments

marketPrice

data.table or xts containing the market prices in levels

stockPrices

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

alpha

signicance 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

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

on

string indicating the time scale in which k is expressed. Possible values are: "secs", "seconds", "mins", "minutes", "hours".

k

positive integer, indicating the number of periods to aggregate over. E.g. to aggregate an xts object to the 5 minute frequency, set k = 5 and on = "minutes".

marketOpen

the market opening time. This should be in the time zone specified by tz. By default, marketOpen = "09:30:00".

marketClose

the market closing time. This should be in the time zone specified by tz. By default, marketClose = "16:00:00".

tz

string specifying the time zone to which the times in data and/or marketOpen/ marketClose belong. Default = "GMT". This parameter will also help determine the testing times as the test is done on non-overlapping pre-averaged returns.

Value

A list containing "criticalValues" which are the bootstrapped critcal 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.

Examples

Run this code
# NOT RUN {
#Rank jump test using simulated sample data that includes jumps
## pretend that the marketPrice is the first asset in the data:
marketPrice <- sample5MinPricesJumps[,1] 
## construct stockPrice as a list:
stockPrice <- list() 
for (i in 1:(ncol(sample5MinPricesJumps)-1)) {
  stockPrice[[i]] <- sample5MinPricesJumps[,i+1]
}
## This can take a long time due to the bootstrapping
rankTest <- rankJumpTest(marketPrice, stockPrice, coarseFreq = 10, k = 1, alpha = c(5,3), 
                         tz = "GMT", marketOpen = "09:30:00", marketClose = "16:00:00")
# Plot the detected stock jump detections
plot(rankTest$stockJumpDetections)
# }
# NOT RUN {
# }

Run the code above in your browser using DataLab