Attachment 'DieboldMariano.m'
Download 1 function [DB] = DieboldMariano(Err1,Err2)
2 % Antoine Devulder 30 octobre 2007
3 % Si la statistique de Diebold Mariano est positive > 1.96, alors le modèle
4 % correspondant aux séries d'erreurs entrées en premier est significativement moins performant.
5
6 horizon=size(Err1,2);
7 taille = size(Err1,1);
8 nb_var = size(Err1,3);
9 DB=zeros(nb_var,horizon);
10
11 for variable=1:nb_var
12 for h=1:horizon
13 Serie1=Err1(:,h,variable);
14 Serie2=Err2(:,h,variable);
15 Ecart=Serie1.^2-Serie2.^2;
16 EcartCentre=Ecart-mean(Ecart)*ones(taille,1);
17 varcum=EcartCentre'*EcartCentre/taille;
18 for i=1:floor(4*(taille/100)^(2/9))
19 Gamma=1/(taille-i)*EcartCentre(1+i:taille)'*EcartCentre(1:taille-i);
20 varcum=varcum+2*(1-i/horizon)*Gamma;
21 end
22 if varcum<0
23 DB(variable,h)=1000;
24 else
25 DB(variable,h)=mean(Ecart)/sqrt(varcum/taille);
26 end
27 end
28 end
Attached Files
To refer to attachments on a page, use attachment:filename, as shown below in the list of files. Do NOT use the URL of the [get] link, since this is subject to change and can break easily.You are not allowed to attach a file to this page.