Page 1 of 1

Diebold-Mariano test

Posted: Tue Mar 10, 2015 5:43 am
by Pudas
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.

Re: Diebold-Mariano test

Posted: Tue Mar 10, 2015 7:53 am
by EViews Gareth
How can you detect whether a forecast in March lines up with one made in April?

Re: Diebold-Mariano test

Posted: Tue Mar 10, 2015 8:28 am
by Pudas
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!

Re: Diebold-Mariano test

Posted: Tue Mar 10, 2015 8:39 am
by EViews Gareth
How does EViews know when the forecast was made?

Re: Diebold-Mariano test

Posted: Wed Mar 11, 2015 12:47 am
by Pudas
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!

Re: Diebold-Mariano test

Posted: Wed Mar 11, 2015 1:15 am
by trubador
Then use lags/leads. For instance, forecaster_1(-1) and forecaster_2 would match as of April.

Re: Diebold-Mariano test

Posted: Wed Mar 11, 2015 2:39 am
by Pudas
Thanks Trubadur! I am afraid though that will not work on occasions when both forecasters publish the same month. Thanks again!

Re: Diebold-Mariano test

Posted: Wed Mar 11, 2015 2:53 am
by trubador
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.