Learn R Programming

rugarch (version 1.4-2)

DACTest: Directional Accuracy Test

Description

Implements the Directional Accuracy Test of Pesaran and Timmerman and Excess Profitability Test of Anatolyev and Gerko.

Usage

DACTest(forecast, actual, test = c("PT", "AG"), conf.level = 0.95)

Arguments

forecast

A numeric vector of the forecasted values.

actual

A numeric vector of the actual (realized) values.

test

Choice of Pesaran and Timmermann (‘PT’) or Anatolyev and Gerko (‘AG’) tests.

conf.level

The confidence level at which the Null Hypothesis is evaluated.

Value

A list with the following items:

Test

The type of test performed.

Stat

The test statistic.

p-value

The p-value of the test statistic.

H0

The Null Hypothesis.

Decision

Whether to reject or not the Null given the conf.level.

DirAcc

The directional accuracy of the forecast.

Details

See the references for details on the tests. The Null is effectively that of independence, and distributed as N(0,1).

References

Anatolyev, S. and Gerko, A. 2005, A trading approach to testing for predictability, Journal of Business and Economic Statistics, 23(4), 455--461. Pesaran, M.H. and Timmermann, A. 1992, A simple nonparametric test of predictive performance, Journal of Business and Economic Statistics, 10(4), 461--465.

Examples

Run this code
# NOT RUN {
data(dji30ret)
spec = ugarchspec(mean.model = list(armaOrder = c(6,1), include.mean = TRUE),
variance.model = list(model = "gjrGARCH"), distribution.model = "nig")
fit = ugarchfit(spec, data = dji30ret[, 1, drop = FALSE], out.sample = 1000)
pred = ugarchforecast(fit, n.ahead = 1, n.roll = 999)
# Get Realized (Oberved) Data
obsx = tail(dji30ret[,1], 1000)
forc = as.numeric(as.data.frame(pred,rollframe="all",align=FALSE,which="series"))
print(DACTest(forc, obsx, test = "PT", conf.level = 0.95))
print(DACTest(forc, obsx, test = "AG", conf.level = 0.95))
# }

Run the code above in your browser using DataLab