Learn R Programming

highfrequency (version 1.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)\).

See spotVol and spotDrift for Estimators for \(\sigma(t)\) and \(\mu(t)\), respectively.

Usage

intradayJumpTest(
  pData,
  volEstimator = "RM",
  driftEstimator = "none",
  alpha = 0.95,
  alignBy = "minutes",
  alignPeriod = 5,
  marketOpen = "09:30:00",
  marketClose = "16:00:00",
  tz = NULL,
  n = NULL,
  ...
)

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. Should only contain a sinlge SYMBOL

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.

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

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"

n

number of observation to use in the calculation of the critical values of the test statistic. If this is left as NULL we fall back to the total number of observations in the sample.

...

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

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

Author

Emil Sjoerup

References

Christensen, K., Oomen, R. C. A., Podolskij, M. (2014): Fact or Friction: Jumps at ultra high frequency. Journal of Financial Economics, 144, 576-599

Examples

Run this code
if (FALSE) {
# We can easily make a Lee-Mykland jump test.
LMtest <- intradayJumpTest(pData = sampleTData[, list(DT, PRICE)], 
                           volEstimator = "RM", driftEstimator = "none",
                           RM = "rBPCov", lookBackPeriod = 20,
                           alignBy = "minutes", alignPeriod = 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 = sampleTData[, list(DT, PRICE)], 
                            volEstimator = "PARM", driftEstimator = "none",
                            RM = "rBPCov", lookBackPeriod = 20, theta = 1.2,
                            marketOpen = "09:30:00", marketClose = "16:00:00")
plot(FoFtest)

}

Run the code above in your browser using DataLab