dm.test: Diebold-Mariano-Test

View source: R/dm.test.R

dm.testR Documentation

Diebold-Mariano-Test

Description

This function performs the Diebold-Mariano-Test for equal predictive performance of two forecasts with respect to a scoring rule. This test computes p-values from the normal distribution instead of the student-t distribution, as in dm.test.

Usage

dm.test(
  s1,
  s2,
  alternative = c("two.sided", "less", "greater"),
  h = 1,
  na.action = na.omit
)

Arguments

s1

vector of scores from method 1

s2

vector of scores from method 2

alternative

character; the alternative hypothesis and must be one of "two.sided", "greater" or "less"; default: "two.sided"

h

integer; forecast horizon used in calculating s1 and s2; default: 1

na.action

function to handle the NA's. Default: na.omit.

The null hypothesis is that the difference s1 - s2 has zero mean. The alternative "less" is that s1 - s2 has negative mean. The alternative "greater" is that s1 - s2 has positive mean. The alternative "two.sided" is that s1 - s2 has mean unequal zero.

The difference s1 - s2 may contain missing values, in which case complete cases are used and a warning is given.

Value

An object of class htest.

Note

The function dm.test is inspired by the function dm_test from the R-package ensAR by J. Gross and A. Moeller.

Author(s)

David Jobst

References

Diebold, F. and Mariano, R. (1995). Comparing predictive accuracy. Journal of Business & Economic Statistics, 13, 253-263.

Gneiting, T. and Katzfuss, M. (2014). Probabilistic forecasting. Annual Review of Statistics and Its Application, 1, 125-151.

Examples

# simulated data
s1 <- arima.sim(list(ar = 0.7), sd = 0.5, 100)
s2 <- arima.sim(list(ar = 0.7), sd = 0.5, 100) - 0.2

# Diebold-Mariano-Test
dm.test(s1, s2)



jobstdavid/eppverification documentation built on May 13, 2024, 5:20 p.m.