Page 1 of 1

Diebold_Mariano Test

Posted: Wed Mar 30, 2011 5:07 am
by donihue
Hello,

Would anyone have an EViews code to produce the Diebold-Mariano Predictive Accuracy Test (Diebold, F.X. and R. S. Mariano, "Comparing Predictive Accuracy", J. Bus and Ec Stat, Vol. 13, No. 3, July 1995)?

Regards
Donihue

Re: Diebold_Mariano Test

Posted: Fri Apr 01, 2011 2:13 am
by Savy
Hi donihue

In its simple form, the DM test can be calculated by regressing the difference of the loss functions (squared or absolute error) on a constant using Newey-West standard errors

Code: Select all

'fc1: Forecast 1 'fc2: Forecast 2 'r: Realised Data ' MSE es_fc1 = (fc1 - r)^2 es_fc2 = (fc2 - r)^2 genr d_squaredloss = es_fc1 - es_fc2 ' MAE ea_fc1 = @abs(fc1 - r) ea_fc2 = @abs(fc2 - r) genr d_absloss = ea_fc1 - ea_fc2 ' DM test equation dm_squaredloss.ls(n) d_squaredloss c equation dm_abs.ls(n) d_absloss c
However, be aware of certain limits of the DM test. For the small sample bias correction, check
Harvey, Leybourne and Newbold, "Testing the equality of prediction mean squared errors", 1998
and for a more general discussion, check e.g.
Giacomini and White, "Tests of Conditional Predictive Ability", 2006

Best
Savy

Re: Diebold_Mariano Test

Posted: Fri Apr 01, 2011 2:38 am
by donihue
Many thanks, Savy. That is very helpful indeed.

Regards
Donihue

Re: Diebold_Mariano Test

Posted: Mon Sep 12, 2011 9:00 am
by stasibab
I am trying to use this code for the DM test but I get the error as in the image...
Could you help me?

Re: Diebold_Mariano Test

Posted: Mon Sep 12, 2011 9:15 am
by EViews Gareth
Put a genr in front of the line that sets them.

Re: Diebold_Mariano Test

Posted: Mon Sep 12, 2011 9:36 am
by stasibab
Thanx Gareth,

I 've done what you said, I pressed run without having any errors but I do not get any results...

Do I have to do something else to see the results?

Re: Diebold_Mariano Test

Posted: Mon Sep 12, 2011 10:07 am
by EViews Gareth
I don't know enough about the test to say what the results should be. The code generates an equation object, which will be in your workfile. Which of the equation results you need to look at though, I don't know. I'm sure you can figure that bit out though.

Re: Diebold_Mariano Test

Posted: Mon Sep 12, 2011 10:19 am
by stasibab
Dear Gareth, the problem is that I do not get the workfile either...
any ideas why? this is my data

when I press run and I get a new box 'run program' I should just press 'ok' right?

Sorry if the questions are stupid, I am quite a rookie...

Re: Diebold_Mariano Test

Posted: Mon Sep 12, 2011 11:36 am
by EViews Gareth
Your screenshot clearly indicates that you have a workfile open.

Re: Diebold_Mariano Test

Posted: Mon Sep 12, 2011 11:39 am
by stasibab
Excuse me bad writing, I meant I do not get the new object into the workfile!

Re: Diebold_Mariano Test

Posted: Mon Sep 12, 2011 11:41 am
by EViews Gareth
You should have an equation object called dm_squaredloss and one called dm_abs

Re: Diebold_Mariano Test

Posted: Mon Sep 12, 2011 11:44 am
by stasibab
Sorry I run it, I do not get any errors but nothing is added in my workfile... Strange?

Re: Diebold_Mariano Test

Posted: Tue Sep 30, 2014 8:11 am
by Abdelrazzaq
I did run the test and had the results. I think the result is not valid enough . t statistic. please find attached.

Re: Diebold_Mariano Test

Posted: Wed Oct 01, 2014 1:42 am
by Abdelrazzaq
please give me some attention