12-step ahead point forecasts for panel data

For questions regarding programming in the EViews programming language.

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

Jess1303
Posts: 1
Joined: Mon Jun 30, 2014 7:53 am

12-step ahead point forecasts for panel data

Postby Jess1303 » Mon Jun 30, 2014 8:27 am

Dear Eviews team,

I need to estimate 12-step ahead point forecasts for panel data using an expanding window (window size to start with =60). My workfile ranges from 1987:01 to 2014:05 (IS: 1987:01 to 2009:12 and OOS: 2010:01 to 2014:05). I want to analyse analyst estimates for stocks and they publish 12-months ahead forecasts so my idea is to forecast 1992:12 using 1987:01 to 1991:12, then forecast 1993:01 using 1987:01 to 1992:01 and so on.

I found a code in this forum and tried to adjust it to my data, however, I get an error message saying "Date does not uniquely define observation in panels in "IF@DTOO ("LAST") < @DTOO("") THEN". In the eviews Command and Programming Reference I found that using DTOO in panel data will always cause an error message. How can I then specify the observation that my code will work?

Code: Select all

'Set window size !window=60 'set step size !step=12 'get size of workfile !length=@obsrange 'declare equation for estimation equation eq_dy_eps 'calculate number of rolls !nrolls=@floor((!length-!window)/!step) 'matrix to store coefficient estimates matrix (3,!nrolls) coefmat ' where 3 is the number of coefficients 'series to store forecast estimates series fcast 'redundant series for catching start and end points %start="@first" 'otod(@ifirst(ser)) %end="@last" 'otod(@ilast(ser)) 'variable keeping track of how many rolls we've done !j=0 'move sample !step obs at a time for !j=1 to !length-!window+1-!step step !step !j=!j+1 'set sample for estimation period %first=@otod(@dtoo(%start)+!j-1) %last=@otod(@dtoo(%start)+!j+!window-2) smpl {%first} {%last} 'estimate equation - where the equation is LS eq_dy_eps.ls dl_ri c dy_act(-12) eps_act(-12) 'store coefficients colplace(coefmat,eq_dy_eps.@coefs,!j) '12-period-ahead forecast %12pers=@otod(@dtoo(%start)+!j+!window-1) 'start point %12pere=@otod(@dtoo(%start)+!j+!window+2) 'end point: %12pere-%12pers+1=12 if @dtoo (%end) < @dtoo(%12pere) then 'check whether the forecast end point is greater than the workfile end point exitloop endif 'set smpl for foreasting period smpl {%12pers} {%12pere} 'forecast with command *forecast* (see also *fit*) eq_dy_eps.forecast(f=na) yf 'set smpl to obtain the 12th period observation smpl {%12pere} {%12pere} 'store forecasts fcast=fceq next smpl @all show coefmat show fcast.line d(noerr) ser
Many thanks in advance!

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

Re: 12-step ahead point forecasts for panel data

Postby EViews Gareth » Mon Jun 30, 2014 8:34 am

Rather than:

Code: Select all

%first=@otod(@dtoo(%start)+!j-1) %last=@otod(@dtoo(%start)+!j+!window-2) smpl {%first} {%last}
You could try something like:

Code: Select all

smpl @first+!j-1 @first+!j+!window-2


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 2 guests