- Introduced by
- Francis Diebold & Roberto Mariano
- Year
- 1995
- Type
- Non-parametric forecast comparison test
- Family
- Forecast evaluation
What does it do?
The Diebold-Mariano (DM) test, introduced by Diebold and Mariano in 1995, formally tests whether two competing forecasts have equal predictive accuracy.
It works on the series of out-of-sample loss differences between the two forecasts and does not require a parametric model of the forecast errors. Its inference rests on a large-sample normal approximation, so its reliability depends on the number of forecasts evaluated and on how the comparison is designed.
The intuition behind the method
Suppose two models both try to predict next quarter's GDP growth. One model consistently makes smaller errors than the other, but is that difference real or just random variation? The DM test answers this by constructing a loss differential series — the gap in forecast errors between the two models at each point in time — and testing whether its average is significantly different from zero. If it is, one model genuinely outperforms the other; if not, the accuracy difference is statistically indistinguishable from noise.
History
Diebold and Mariano published the test in 1995 in the Journal of Business & Economic Statistics. The article proposed explicit tests of the null of no difference in accuracy between two competing forecasts, with asymptotic and exact finite-sample versions, and allowed general loss functions and non-Gaussian, serially correlated forecast errors. The original article does not focus on nested-model comparisons, which are treated separately in later work.
When to use it
Use the DM test to compare the out-of-sample forecasts of two models for the same target variable over the same evaluation period, when the question concerns predictive accuracy rather than in-sample fit. It requires a sequence of genuine out-of-sample forecast errors, a loss function chosen in advance, and enough observations for the normal approximation to be credible. Do not apply it to in-sample residuals. Do not apply the unmodified test when one model nests the other, since the normal approximation is then not valid and tests designed for nested comparisons are needed. When more than two models are compared at once, a multiple-model procedure such as the Model Confidence Set is more appropriate than many pairwise DM tests.
Limitations and considerations
- Inference relies on a large-sample normal approximation. In small samples the asymptotic test can over-reject, so its actual size may exceed the nominal level; the original article also proposed exact finite-sample tests, and small-sample modifications such as that of Harvey, Leybourne and Newbold (1997), used by default in the R forecast package, are common
- The normal limit is not valid when one model nests the other: the two forecasts can coincide under the null, so the loss differential is degenerate and the asymptotic normal distribution does not apply. Comparisons between nested models need tests designed for that case
- The ranking of two forecasts can change with the loss function; a conclusion under squared error does not automatically carry over to absolute error
- The test compares the forecasts as given and does not explicitly model the uncertainty from estimating the parameters of the forecasting models
Source conditions do not replace independent scientific review or validation by an analysis engine.
Strengths
- No parametric model of the forecast errors is required: the original article allows non-Gaussian, non-zero-mean, serially correlated and contemporaneously correlated errors, with inference based on a large-sample normal approximation
- The loss function need not be quadratic or symmetric, so forecasts can be judged under the criterion that matters for the application, such as absolute error or an asymmetric penalty
- The variance estimator accounts for serial correlation in the loss differentials of multi-step forecasts, which is the usual situation when the forecast horizon exceeds one period
- The procedure applies to any two forecast series for the same target, whatever model produced them
Applications
- Comparing competing macroeconomic forecast models such as ARIMA versus factor-augmented VAR for GDP or inflation predictions
- Evaluating point forecasts from machine learning methods against benchmark statistical models in finance
- Assessing whether central bank survey forecasts outperform model-based forecasts at various horizons
- Testing the relative accuracy of volatility models (GARCH variants) for realized variance prediction
- Ranking competing exchange rate or asset price models in international economics studies
How it works
How it works
For each period t, the loss differential d_t is the loss of forecast 1 minus the loss of forecast 2, computed from the two forecast errors e_1t and e_2t. The loss function is chosen by the researcher; the original article does not require it to be quadratic or symmetric, so squared error, absolute error or an asymmetric loss can be used. Fixing the loss before inspecting the results keeps the comparison tied to the decision it is meant to inform.
Formula
d_t = L(e_{1t}) - L(e_{2t}), \quad t = 1, \dots, TForecast errors for horizons longer than one step are typically serially correlated, so the variance of the mean loss differential must include autocovariances of d_t. The formula sums the sample autocovariances up to lag h-1, where h is the forecast horizon. Unlike a Bartlett-weighted Newey-West estimator, the formula gives equal weight to every lag up to h-1, so the choice of h directly controls the variance estimate.
Formula
\hat{\sigma}^2_d = \hat{\gamma}_0 + 2\sum_{k=1}^{h-1} \hat{\gamma}_k, \quad \hat{\gamma}_k = T^{-1}\sum_{t=k+1}^{T}(d_t - \bar{d})(d_{t-k} - \bar{d})The DM statistic divides the sample mean loss differential by its estimated standard error, which is the square root of the estimated long-run variance divided by T. Under the null hypothesis that the expected loss differential is zero, the statistic is asymptotically standard normal. Because this is an asymptotic result, finite-sample behaviour is the main practical concern when interpreting the statistic.
Formula
DM = \frac{\bar{d}}{\sqrt{\hat{\sigma}^2_d / T}} \xrightarrow{d} N(0,1) \text{ under } H_0: E[d_t] = 0The null of equal predictive accuracy is rejected at significance level alpha when |DM| exceeds the standard normal critical value z_(alpha/2), which is equivalent to a two-sided p-value 2Φ(-|DM|) below alpha. A one-sided version can test whether a specific model is more accurate, but the direction of the test should be fixed before the comparison is run.
Formula
\text{Reject } H_0 \text{ if } |DM| > z_{\alpha/2}; \quad p\text{-value} = 2\Phi(-|DM|)Common pitfalls
- Applying the test to in-sample residuals rather than genuine out-of-sample forecast errors invalidates the comparison, because in-sample errors are not the errors the forecasts make in practice
- For h-step forecasts, summing autocovariances only up to a lag shorter than h-1 underestimates the long-run variance, which inflates |DM| and makes the test reject too often
- Treating a significant DM statistic as evidence of structural superiority without checking whether the loss function reflects the actual decision cost
- Running many pairwise DM tests across a model set without adjusting for multiple comparisons increases the chance of spurious 'significant' differences
Frequently asked questions
Can the DM test be used for nested model comparisons?
The original Diebold-Mariano test is not designed for nested models, where one model contains the other as a special case. In that setting the two forecasts can coincide under the null, so the loss differential is degenerate and the standard normal approximation does not apply. Tests developed specifically for nested comparisons should be used when nesting is present.
How many out-of-sample observations are needed?
There is no universal minimum. The test relies on an asymptotic normal approximation, and with a short evaluation sample its size can be distorted. Small-sample modifications, such as the Harvey, Leybourne and Newbold (1997) version implemented by default in R's forecast::dm.test, adjust the statistic and use t-based critical values; they are worth considering when the evaluation window is short. The adequate sample size depends on the application, so it is sensible to check the test's behaviour for the sample at hand.
Does the choice of loss function affect the result?
Yes, and this is intentional. The DM test evaluates predictive accuracy relative to a specific loss function specified by the researcher. Squared-error loss penalizes large errors more heavily, while absolute-error loss is more robust to outliers. If the two loss functions lead to conflicting conclusions about which model is better, this reveals that the ranking of models is loss-function-dependent and the researcher should choose the criterion that best reflects the actual forecasting objective.
Related methods
Sources
Diebold, F. X., & Mariano, R. S. (1995). Comparing predictive accuracy. Journal of Business & Economic Statistics, 13(3), 253–263.
Open DOI reference