help for dmariano                            (StataList distribution 27jun2006)

Diebold-Mariano comparison of predictive accuracy

dmariano actual pred1 pred2 [if exp] [in range] [,maxlag(lags) crit(criterion) kernel(kernel) ]

dmariano is for use with time-series data. You must tsset your data before using dmariano; see help tsset.

actual, pred1, pred2 may contain time-series operators; see help varlist.


dmariano calculates a measure of predictive accuracy proposed by Diebold and Mariano (DM, 1995). Given an actual series and two competing predictions, one may apply a loss criterion (such as squared error or absolute error) and then calculate a number of measures of predictive accuracy that allow the null hypothesis of equal accuracy to be tested. The S(1) measure, calculated in this routine, tests that the mean difference between the loss criteria for the two predictions is zero, using a long-run estimate of the variance of the difference series.


maxlag specifies the maximum order of the lag to be used in calculating the long-run variance of the difference series from its autocovariance function. If it is not provided, the maximum lag order will be calculated from the Schwert criterion as a function of the sample size.

crit specifies the loss criterion to be used. It currently may take on values MSE, MAE and MAPE. If not specified, MSE is assumed.

kernel specifies the kernel to be used in calculating the long-run variance. It currently may take on values uniform and bartlett. As in the case of Newey-West standard errors, the weights of the Bartlett kernel guarantee that variance estimates will be positive definite. If not specified, the uniform kernel is employed.


. use http://fmwww.bc.edu/ec-p/data/macro/barclaymonthly.dta,clear

. dmariano bbjpysp bbjpy1f bbjpy2f, max(6)

. dmariano bbjpysp bbjpy1f bbjpy2f, crit(MAE) kernel(bartlett)

. dmariano D.bbjpysp D.bbjpy1f D.bbjpy2f if tin(1987m12,1996m12), max(2) crit(MAPE)


Diebold, Francis and Roberto Mariano, "Comparing Predictive Accuracy," Journal of Business and Economic Statistics, 13:3, 253-263, 1995.


Christopher F Baum, Boston College, USA, baum@bc.edu

Acknowledgements Thanks to Oliver Jones for suggesting the addition of the MAPE loss criterion. Thanks to Somchai Amornthum for pointing out a flaw in the calculation of the long-run variance component of the test statistic.

Also see

On-line: help for predict