Diebold_Mariano Test

For questions regarding programming in the EViews programming language.

Moderators: EViews Gareth, EViews Jason, EViews Moderator, EViews Matt

donihue
Posts: 137
Joined: Wed Oct 07, 2009 8:51 am

Diebold_Mariano Test

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

Savy
Posts: 4
Joined: Fri Apr 01, 2011 1:15 am

Re: Diebold_Mariano Test

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' MSEes_fc1 = (fc1 - r)^2es_fc2 = (fc2 - r)^2genr d_squaredloss = es_fc1 - es_fc2 ' MAEea_fc1 = @abs(fc1 - r)ea_fc2 = @abs(fc2 - r)genr d_absloss = ea_fc1 - ea_fc2 ' DM testequation dm_squaredloss.ls(n) d_squaredloss cequation 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

donihue
Posts: 137
Joined: Wed Oct 07, 2009 8:51 am

Re: Diebold_Mariano Test

Many thanks, Savy. That is very helpful indeed.

Regards
Donihue

stasibab
Posts: 55
Joined: Sun May 08, 2011 2:20 pm

Re: Diebold_Mariano Test

I am trying to use this code for the DM test but I get the error as in the image...
Could you help me?
Attachments
dmtest.jpg (95.39 KiB) Viewed 11267 times

EViews Gareth
Fe ddaethom, fe welon, fe amcangyfrifon
Posts: 12419
Joined: Tue Sep 16, 2008 5:38 pm

Re: Diebold_Mariano Test

Put a genr in front of the line that sets them.

stasibab
Posts: 55
Joined: Sun May 08, 2011 2:20 pm

Re: Diebold_Mariano Test

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?

EViews Gareth
Fe ddaethom, fe welon, fe amcangyfrifon
Posts: 12419
Joined: Tue Sep 16, 2008 5:38 pm

Re: Diebold_Mariano Test

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.

stasibab
Posts: 55
Joined: Sun May 08, 2011 2:20 pm

Re: Diebold_Mariano Test

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...
Attachments
r.xlsx
fc2.xlsx
fc1.xlsx

EViews Gareth
Fe ddaethom, fe welon, fe amcangyfrifon
Posts: 12419
Joined: Tue Sep 16, 2008 5:38 pm

Re: Diebold_Mariano Test

Your screenshot clearly indicates that you have a workfile open.

stasibab
Posts: 55
Joined: Sun May 08, 2011 2:20 pm

Re: Diebold_Mariano Test

Excuse me bad writing, I meant I do not get the new object into the workfile!

EViews Gareth
Fe ddaethom, fe welon, fe amcangyfrifon
Posts: 12419
Joined: Tue Sep 16, 2008 5:38 pm

Re: Diebold_Mariano Test

You should have an equation object called dm_squaredloss and one called dm_abs

stasibab
Posts: 55
Joined: Sun May 08, 2011 2:20 pm

Re: Diebold_Mariano Test

Sorry I run it, I do not get any errors but nothing is added in my workfile... Strange?

Abdelrazzaq
Posts: 13
Joined: Thu Mar 27, 2014 9:17 am

Re: Diebold_Mariano Test

I did run the test and had the results. I think the result is not valid enough . t statistic. please find attached.
Attachments
aexorg.wf1

Abdelrazzaq
Posts: 13
Joined: Thu Mar 27, 2014 9:17 am