Diebold-Mariano test

For questions regarding programming in the EViews programming language.

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

Pudas
Posts: 4
Joined: Tue Mar 10, 2015 5:05 am

Diebold-Mariano test

Postby Pudas » Tue Mar 10, 2015 5:43 am

Hi,
I am trying to perform the Diebold-Mariano (DM) test on monthly data for several different forecasters. The problem is that the forecasters publish their forecasts at different times each year. I want to calulate the DM-statistic for the forecasts made in, say, March and April and also include the situations where one forecaster publish in March and the other in April. In the following code the DM-statistic is only calculated between same months (March vs March and April vs April).

Smpl 2000 2014 If @Month=3 Or @Month=4
%z="y x z" 'A list of different forecasters
For %z1 {%z}
For %z2 {%z}
If %z1 <> %z2 Then
Equation dm_{%z1}_{%z2}_gdp.ls(n) gdp{%z1}t0_diff_quad-gdp{%z2}t0_diff_quad c
!d_{%z1}_{%z2}=dm_{%z1}_{%z2}_gdp.@Pval(1)
!d_{%z1}_{%z2}_c=dm_{%z1}_{%z2}_gdp.@coefs(1)
EndIf
Next
Next

Any ideas on how to match forecasts made at different months is gratefully acknowledged.

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

Re: Diebold-Mariano test

Postby EViews Gareth » Tue Mar 10, 2015 7:53 am

How can you detect whether a forecast in March lines up with one made in April?

Pudas
Posts: 4
Joined: Tue Mar 10, 2015 5:05 am

Re: Diebold-Mariano test

Postby Pudas » Tue Mar 10, 2015 8:28 am

Well, that is really my question. I have a workfile with forecast errors for different months I want EViews to treat forecasts made at, say March and April, as equal so that a DM-test can be carried out (without a bunch of NA´s). Thanks!

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

Re: Diebold-Mariano test

Postby EViews Gareth » Tue Mar 10, 2015 8:39 am

How does EViews know when the forecast was made?

Pudas
Posts: 4
Joined: Tue Mar 10, 2015 5:05 am

Re: Diebold-Mariano test

Postby Pudas » Wed Mar 11, 2015 12:47 am

Hi again,
I enclose a sample of the workfile, here containing squared forecast errors of two different forecasters. Forecaster 1 published the first forecast in March 1997 and Forecaster 2 in April 1997. I want Eviews to match them together, i.e. so that it does not matter whether they publish in March or April. The null hypothesis is that the forecasting ability in March and April of the two forecasters is equal.
Thanks again for your help!
Attachments
DM_test.wf1
(1.86 MiB) Downloaded 301 times

trubador
Did you use forum search?
Posts: 1520
Joined: Thu Nov 20, 2008 12:04 pm

Re: Diebold-Mariano test

Postby trubador » Wed Mar 11, 2015 1:15 am

Then use lags/leads. For instance, forecaster_1(-1) and forecaster_2 would match as of April.

Pudas
Posts: 4
Joined: Tue Mar 10, 2015 5:05 am

Re: Diebold-Mariano test

Postby Pudas » Wed Mar 11, 2015 2:39 am

Thanks Trubadur! I am afraid though that will not work on occasions when both forecasters publish the same month. Thanks again!

trubador
Did you use forum search?
Posts: 1520
Joined: Thu Nov 20, 2008 12:04 pm

Re: Diebold-Mariano test

Postby trubador » Wed Mar 11, 2015 2:53 am

Yes, that may be. But you can use if statements in that cases. I really did not think this thorough, but there may not be a general solution after all.


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 1 guest