Learn R Programming

highfrequency (version 0.7.0.1)

intradayJumpTest: Intraday jump tests

Description

This function can be used to test for jumps in intraday price paths. The tests are of the form \(L(t) = (R(t) - mu(t))/sigma(t)\).

Usage

intradayJumpTest(
  pData,
  volEstimator = "RM",
  driftEstimator = "none",
  alpha = 0.95,
  ...,
  on = "minutes",
  k = 5,
  marketOpen = "09:30:00",
  marketClose = "16:00:00",
  tz = "GMT"
)

Arguments

pData

xts or data.table of the price data in levels. This data can (and should in some cases) be tick-level data. The data can span more than one day.

volEstimator

character denoting which volatility estimator to use for the tests. See spotVol. Default = "RM" denoting realized measures.

driftEstimator

character denoting which drift estimator to use for the tests. See spotDrift. Default = "none" denoting no drift estimation.

alpha

numeric of length one determining what confidence level to use when constructing the critical values.

...

extra arguments passed on to spotVol for the volatility estimation, and to spotDrift.

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

The null hypothesis of the tests in this function is that there are no jumps in the price series

Examples

Run this code
# NOT RUN {
# We can easily make a Lee-Mykland jump test.
LMtest <- intradayJumpTest(pData = sampleTDataMicroseconds[, list(DT, PRICE)], 
                           volEstimator = "RM", driftEstimator = "none",
                           RM = "bipower", lookBackPeriod = 20,
                           on = "minutes", k = 5, marketOpen = "09:30:00", 
                           marketClose = "16:00:00")
plot(LMtest)

# We can just as easily use the pre-averaged version from the "Fact or Friction" paper
FoFtest <- intradayJumpTest(pData = sampleTDataMicroseconds[, list(DT, PRICE)], 
                            volEstimator = "PARM", driftEstimator = "none",
                            RM = "bipower", lookBackPeriod = 20, theta = 1.2,
                            marketOpen = "09:30:00", marketClose = "16:00:00")
plot(FoFtest)

# }
# NOT RUN {
# }

Run the code above in your browser using DataLab