# Compute the p-value of Diebold-Mariano Test

I am using Diebold-Mariano Test for testing the equal predictive accuracy of two models. I use the code written by Semin Ibisevic (2011) in MATLAB to compute it

function DM = dmtest(e1, e2, h)
% Initialization
T = size(e1,1);
% Define the loss differential
d = e1.^2 - e2.^2;
% Ralculate the variance of the loss differential, taking into account
% autocorrelation.
dMean = mean(d);
gamma0 = var(d);
if h > 1
gamma = zeros(h-1,1);
for i = 1:h-1
sampleCov = cov(d(1+i:T),d(1:T-i));
gamma(i) = sampleCov(2);
end
varD = gamma0 + 2*sum(gamma);
else
varD = gamma0;
end
% Retrieve the diebold mariano statistic DM ~N(0,1)
DM = dMean / sqrt ( (1/T)*varD );


Now, as we see the DM statistic is standard normally distributed.

My question is how can I calculate the p-value of this statistic? I do not have a hypothesized value for its mean.

The null hypothesis is rejected every time the DM is outside the range [-1,96 1,96]

## 1 Answer

The null hypothesis of the Diebold-Mariano test is equal predictive accuracy or equal expected loss. The statistic is the standardized loss differential, so its mean under the null is zero.