The Diebold–Mariano test: are two forecasts really different?
Model A has a lower RMSE than model B in your backtest. Is that evidence that A forecasts better, or did it win because of a few lucky days? The Diebold–Mariano test compares forecasts using a sequence of loss differences and asks whether one model has lower expected loss, allowing the differences to be serially correlated.
Loss differential and test statistic
100 independent differences with standard deviation 2. Serial dependence requires a long-run variance estimate.
Compare losses, not model coefficients
Let be the outcome and be forecasts made using information available at the same origin and horizon. Choose a loss function and define
The null is equal predictive accuracy, . With squared-error loss, a negative sample mean favours A. With absolute-error loss the comparison targets a different property, so the loss function should follow the decision problem rather than convenience.
The test statistic is
where estimates the long-run variance of the loss differential. Under regularity conditions, this is asymptotically standard normal under the null. The test compares predictive accuracy; it does not test whether model parameters are equal or whether either model is correctly specified.
Why the long-run variance matters
For one-step forecasts with uncorrelated differentials, may be estimated by the sample variance of . But multi-step forecasts often overlap: a sequence of five-day returns forecast daily shares four days of realised outcomes. Even if the underlying innovations are independent, forecast errors and loss differences can then be serially correlated.
A heteroskedasticity-and-autocorrelation-consistent estimate uses
where is the lag- sample autocovariance, are kernel weights (for example, Bartlett weights), and bandwidth is chosen to capture dependence. For overlapping -step forecasts, dependence through at least lags is a natural starting point, though the exact dependence and bandwidth choice still deserve examination.
Keep the forecast experiment aligned
Forecasts must share the same target, horizon, information set, and evaluation dates. Comparing model A’s one-day forecasts with model B’s five-day forecasts does not isolate model accuracy. Any estimation or tuning must also respect the information available at each forecast origin.
Example interpretation
Suppose the average squared-error differential is , with HAC long-run standard deviation per observation , over forecasts. Then
The negative sign favours A, but a two-sided 5% test would not reject equal accuracy because . The result is not proof that the models are identical; it says the sample does not provide strong enough evidence of a nonzero mean loss differential under the test assumptions.
Practical choices and limitations
The classic test allows general loss functions and serial dependence under suitable conditions. In small samples, the normal approximation can be poor, especially with overlapping forecasts and persistent losses. Harvey, Leybourne, and Newbold proposed a finite-sample adjustment often used for this setting; alternative approaches include block bootstrap inference. State which method and bandwidth you use.
If one model nests the other, estimation uncertainty can affect the null distribution and the ordinary DM test may have low power or size distortions. Use a test designed for nested forecast comparisons, such as Clark–West in appropriate squared-error settings. If many models were screened and only the winner is reported, the p-value also ignores selection; adjust the research design for multiple comparisons or reserve a final untouched holdout.
Common mistakes
- Using the variance of as if observations were independent when multi-step losses overlap.
- Reading a non-significant result as proof of equal performance.
- Choosing the loss function after seeing which model wins.
- Comparing forecasts that use different information sets or target definitions.
- Reporting a DM p-value after extensive model search as if the winner had been specified in advance.
Practice
SignWith dₜ = loss(A) − loss(B), a significantly negative mean differential favours which model?Show answer
Model A, because its average loss is lower than B’s under the chosen scoring rule.
OverlapWhy can five-day-ahead daily forecasts produce autocorrelated loss differentials?Show answer
Their target periods overlap: adjacent forecasts share four of the five realised daily returns. This induces serial dependence even when daily shocks are independent.
InferenceA test gives p = 0.18. Can you conclude the models have equal expected loss?Show answer
No. You fail to reject equal accuracy at conventional levels, but the data may be too noisy or the test may have low power. Report the estimate and uncertainty, not an equivalence claim.
Further reading: Diebold and Mariano (1995), “Comparing Predictive Accuracy,” Journal of Business & Economic Statistics 13(3), 253–263. Journal article.