필터 지우기
필터 지우기

Compute the p-value of Diebold-Mariano Test

조회 수: 15 (최근 30일)
Astrik
Astrik 2017년 1월 22일
댓글: yl x 2021년 11월 1일
I am using Diebold-Mariano Test for testing the equal predictive accuracy. The use the code written by Semin Ibisevic (2011) 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? The null hypothesis is rejected every time the DM is outside the range [-1,96 1,96]

채택된 답변

Star Strider
Star Strider 2017년 1월 22일
If it’s normally distributed, you can use either:
P = @(z) erfc(-z/sqrt(2))/2; % Equivalent to ‘normcdf’
or if you have the Statistics and Machine Learning Toolbox, the normcdf function to compute the p-value.
However, it’s probably easier to compare it to the ±1.96 criteria and be done with it.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Hypothesis Tests에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by