Page 1 of 1

MIDAS Rolling Window Forecast

Posted: Mon Jan 02, 2017 11:23 am
by robertvjanssen
Hi guys,

I am trying to perform a rolling window forecast using a MIDAS equation to estimate the coefficients. I've been trying to use the basic rolling regression programming posted on this forum (http://forums.eviews.com/viewtopic.php?t=878) to first establish if I was able to retrieve these rolling regression coefficients before forecasting.
The MIDAS regression is an Almon PDL with polynomial degree 2, where I try to estimate gcpi with c cpi(-1) and 30 lags of bpp.

At the moment I have the following;

Code: Select all

!window = 67 ' set window size !step = 1 ' set step size !length = @obsrange ' get size of workfile equation midas ' declare equation for estimation !nrolls = @round((!length-!window)/!step) 'calculate number of rolls matrix(4,!nrolls) coefmat 'matrix to store coefficient estimates where 4 is the number of coefficients 2 low frequency and 2 high frequency coef. !j=0 'variable keeping track of how many rolls we've done for !i = 1 to !length-!window+1-!step step !step ' move sample !step obs at a time !j=!j+1 smpl @first+!i-1 @first+!i+!window-2 ' set sample to estimation period ' estimate equation MIDAS(fixedlag=30, midwgt=step, steps=2) GCPI C CPI(-1) @ 12bpp\gbpp(-30) 'store coefficients colplace(coefmat,midas.@coefs,!j) next show coefmat
When I run this code I get: Equation estimates are invalid or nonexistent in
"COLPLACE(COEFMAT, MIDAS.@COEFS,1)".

Could someone explain me if I've made an mistake and/or tell me if it is even possible to do a MIDAS rolling regression in Eviews 9.5 at the moment?
*I added my program and wf if needed!
Thanks and anything is welcome!

Kind Regards,

Robert

Re: MIDAS Rolling Window Forecast

Posted: Mon Jan 02, 2017 1:51 pm
by EViews Gareth
I am on my phone only, so can't test, but it looks like you are not estimating using your equation object.

Since you called your equation "midas" (which will be a confusing name by the way), you need to change the estimation command to:

Midas.midas(options etc...)

Re: MIDAS Rolling Window Forecast

Posted: Tue Jan 03, 2017 4:58 am
by robertvjanssen
Hi Gareth,

Thanks for your quick and useful reply, these small tips help my out a lot!
I continued with my program and I was able to execute a succesful rolling regression for the various MIDAS weighting methods.
However, now I am trying to perform the rolling window static forecasting, but sofar I've been unsuccesful. Do I have to implement another rolling and step function to achieve this or do I have to store the forecasting results differently?
Because when I run my program like this, my forecasting evaluation (and therefore the forecast) is based on the last window of my sample in stead of all windows.

Code: Select all

!window = 64 ' set window size !step = 1 ' set step size !length = @obsrange ' get size of workfile equation midasbetafor ' declare equation for estimation midasbeta equation midaspdlfor ' declare equation for estimation midaspdl equation midasstepfor ' declare equation for estimation midasstep equation midasexpfor ' declare equation for estimation midasexp !nrolls = @round((!length-!window)/!step) 'calculate number of rolls matrix(5,!nrolls) coefbeta 'matrix to store coefficient estimates where 5 is the number of coefficients 2 low frequency and 3 high frequency coef. matrix(5,!nrolls) coefexp 'matrix to store coefficient estimates where 5 is the number of coefficients 2 low frequency and 3 high frequency coef. matrix(4,!nrolls) coefpdl 'matrix to store coefficient estimates where 4 is the number of coefficients 2 low frequency and 2 high frequency coef. matrix(17,!nrolls) coefstep 'matrix to store coefficient estimates where 17 is the number of coefficients 2 low frequency and 15 high frequency coef. series midasbetafits 'series to store forecasting results beta series midasstepfits 'series to store forecasting results step series midasexpfits 'series to store forecasting results exp series midaspdlfits 'series to store forecasting results pdl !j=0 'variable keeping track of how many rolls we've done for !i = 1 to !length-!window+1-!step step !step ' move sample !step obs at a time !j=!j+1 smpl @first+!i-1 @first+!i+!window-2 ' set sample to estimation period ' estimate equation Midasbetafor.MIDAS(fixedlag=30, midwgt=beta, beta=endpoint) GCPI C CPI(-1) @ 12bpp\gbpp(-30) 'Equation MIDAS Beta weighting midaspdlfor.MIDAS(fixedlag=30, polynomial=2) GCPI C CPI(-1) @ 12bpp\gbpp(-30) 'Equation MIDAS PDL weighting midasstepfor.MIDAS(fixedlag=30, midwgt=step, steps=2) GCPI C CPI(-1) @ 12bpp\gbpp(-30) 'Equation Step Weighting midasexpfor.MIDAS(fixedlag=30, midwgt=expalmon) GCPI C CPI(-1) @ 12bpp\gbpp(-30) 'Equation MIDAS Exponential weighting 'forecast commands midasbetafor.fit(na) midasbetafits 'Static Forecasting equation Beta midaspdlfor.fit(na) midaspdlfits 'Static Forecasting equation PDL midasexpfor.fit(na) midasexpfits 'Static Forecasting equation Exp midasstepfor.fit(na) midasstepfits 'Static Forecasting equation Step 'store coefficients colplace(coefbeta,midasbetafor.@coef,!j) colplace(coefexp,midasexpfor.@coef,!j) colplace(coefpdl,midaspdlfor.@coef,!j) colplace(coefstep,midasstepfor.@coef,!j) next 'Forecast Evaluation w.r.t. gcpi to retrieve and compare RMSFE. gcpi.fcasteval(evalsmpl="2009m07 2015m08", trim=5) midasbetafits midaspdlfits midasexpfits midasstepfits
Once again, Thanks up front and anyhelp would be useful!

Kind Regards,

Robert

Re: MIDAS Rolling Window Forecast

Posted: Tue Jan 03, 2017 8:32 am
by EViews Gareth
Each time through the loop you're overwriting the forecast values. Save them into another series.