%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% cty 1
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DM11_cty1=[];
DM21_cty1=[];
for T=1:8%the forcast sample
h=1;
[e1h, e2h,e3h] = forcasterror(h,T,GVARs,Actual,FRWM,FRWMD);
DM1h_cty1=dmtest(e1h,e2h,h);%this is the DM test for h=2 between GVAR and RW
DM2h_cty1=dmtest(e1h,e3h,h);%this is the DM test for h=2 between GVAR and RWD
DM11_cty1=[DM11_cty1 DM1h_cty1];
DM21_cty1=[DM21_cty1 DM2h_cty1];
end
DM12_cty1=[];
DM22_cty1=[];
for T=1:8%the forcast sample
h=2;
[e1h, e2h,e3h] = forcasterror(h,T,GVARs,Actual,FRWM,FRWMD);
DM1h_cty1=dmtest(e1h,e2h,h);%this is the DM test for h=2 between GVAR and RW
DM2h_cty1=dmtest(e1h,e3h,h);%this is the DM test for h=2 between GVAR and RWD
DM12_cty1=[DM12_cty1 DM1h_cty1];
DM22_cty1=[DM22_cty1 DM2h_cty1];
end
DM13_cty1=[];
DM23_cty1=[];
for T=1:8%the forcast sample
h=3;
[e1h, e2h,e3h] = forcasterror(h,T,GVARs,Actual,FRWM,FRWMD);
DM1h_cty1=dmtest(e1h,e2h,h);%this is the DM test for h=2 between GVAR and RW
DM2h_cty1=dmtest(e1h,e3h,h);%this is the DM test for h=2 between GVAR and RWD
DM13_cty1=[DM13_cty1 DM1h_cty1];
DM23_cty1=[DM23_cty1 DM2h_cty1];
end
DM14_cty1=[];
DM24_cty1=[];
for T=1:8%the forcast sample
h=4;
[e1h, e2h,e3h] = forcasterror(h,T,GVARs,Actual,FRWM,FRWMD);
DM1h_cty1=dmtest(e1h,e2h,h);%this is the DM test for h=2 between GVAR and RW
DM2h_cty1=dmtest(e1h,e3h,h);%this is the DM test for h=2 between GVAR and RWD
DM14_cty1=[DM14_cty1 DM1h_cty1];
DM24_cty1=[DM24_cty1 DM2h_cty1];
end
DM1_cty1=[DM11_cty1;DM12_cty1;DM13_cty1;DM14_cty1];
DM2_cty1=[DM21_cty1;DM22_cty1;DM23_cty1;DM24_cty1];
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%cty2
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DM11_cty2=[];
DM21_cty2=[];
for T=1:8%the forcast sample
h=1;
[e1h, e2h,e3h] = forcasterror(h,T,GVARs,Actual,FRWM,FRWMD);
DM1h_cty2=dmtest(e1h,e2h,h);%this is the DM test for h=2 between GVAR and RW
DM2h_cty2=dmtest(e1h,e3h,h);%this is the DM test for h=2 between GVAR and RWD
DM11_cty2=[DM11_cty2 DM1h_cty2];
DM21_cty2=[DM21_cty2 DM2h_cty2];
end
DM12_cty2=[];
DM22_cty2=[];
for T=1:8%the forcast sample
h=2;
[e1h, e2h,e3h] = forcasterror(h,T,GVARs,Actual,FRWM,FRWMD);
DM1h_cty2=dmtest(e1h,e2h,h);%this is the DM test for h=2 between GVAR and RW
DM2h_cty2=dmtest(e1h,e3h,h);%this is the DM test for h=2 between GVAR and RWD
DM12_cty2=[DM12_cty2 DM1h_cty2];
DM22_cty2=[DM22_cty2 DM2h_cty2];
end
DM13_cty2=[];
DM23_cty2=[];
for T=1:8%the forcast sample
h=3;
[e1h, e2h,e3h] = forcasterror(h,T,GVARs,Actual,FRWM,FRWMD);
DM1h_cty2=dmtest(e1h,e2h,h);%this is the DM test for h=2 between GVAR and RW
DM2h_cty2=dmtest(e1h,e3h,h);%this is the DM test for h=2 between GVAR and RWD
DM13_cty2=[DM13_cty2 DM1h_cty2];
DM23_cty2=[DM23_cty2 DM2h_cty2];
end
DM14_cty2=[];
DM24_cty2=[];
for T=1:8%the forcast sample
h=4;
[e1h, e2h,e3h] = forcasterror(h,T,GVARs,Actual,FRWM,FRWMD);
DM1h_cty2=dmtest(e1h,e2h,h);%this is the DM test for h=2 between GVAR and RW
DM2h_cty2=dmtest(e1h,e3h,h);%this is the DM test for h=2 between GVAR and RWD
DM14_cty2=[DM14_cty2 DM1h_cty2];
DM24_cty2=[DM24_cty2 DM2h_cty2];
end
DM1_cty2=[DM11_cty2;DM12_cty2;DM13_cty2;DM14_cty2];
DM2_cty2=[DM21_cty2;DM22_cty2;DM23_cty2;DM24_cty2];
2 Comments
Direct link to this comment
https://fr.mathworks.com/matlabcentral/answers/698780-how-to-make-my-code-more-concise-and-efficient#comment_1219855
Direct link to this comment
https://fr.mathworks.com/matlabcentral/answers/698780-how-to-make-my-code-more-concise-and-efficient#comment_1219855
Direct link to this comment
https://fr.mathworks.com/matlabcentral/answers/698780-how-to-make-my-code-more-concise-and-efficient#comment_1220980
Direct link to this comment
https://fr.mathworks.com/matlabcentral/answers/698780-how-to-make-my-code-more-concise-and-efficient#comment_1220980
Sign in to comment.