Help with final adjustment of program

For questions regarding programming in the EViews programming language.

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

RouzbehR
Posts: 12
Joined: Fri Aug 03, 2012 12:12 pm

Help with final adjustment of program

Postby RouzbehR » Wed Aug 08, 2012 4:53 am

Dear All,

I have this program and I need help with a little adjustment.

This program is suppose to first run a combination of dependent variable and independent variables and then it do a recursive regression. So when it runs the combination it saves all the rbar-squared, BIC and AIC values. it is suppose to do the same procedure again but recursively for next month and so on. And then save all the rbar-squared, BIC and AIC values. I know it should not be difficult to do it, but I have been trying to fix this program for a week now and I have not been able to fix it.

Please, can anyone who knows eviews well just adjust this for me.

Thank you so much.

Regards
Last edited by RouzbehR on Thu Aug 09, 2012 3:49 am, edited 1 time in total.

EViews Esther
EViews Developer
Posts: 149
Joined: Fri Sep 03, 2010 7:57 am

Re: Help with final adjustment of program

Postby EViews Esther » Wed Aug 08, 2012 9:49 am

The given program seems to be a sketch of your project. Without knowing exactly what you are trying to do with your data, it is uneasy to help you.

I think that I can give you one hint at this moment. As far as I understood your question correctly, you need to make the recursive procedure to be a subroutine.

RouzbehR
Posts: 12
Joined: Fri Aug 03, 2012 12:12 pm

Re: Help with final adjustment of program

Postby RouzbehR » Sun Aug 12, 2012 12:32 pm

Dear All,

Can please someone approve that the program below does what I need it to do? I need it to do a 1 period recursive regression and save all the forecasted values. My window is correct, it is just the parts with otod I need to make sure are correct.

Code: Select all

'run rolling regression

' set window size
!window = 119

' set step size
!step = 1

' get size of workfile
!length = @obsrange

' declare equation for estimation
equation eq1

'calculate number of rolls
!nrls = @floor((!length-!window)/!step)

'matrix to store coefficient estimates
matrix(9,!nrls) coefmat ' where 2 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 !i = 1  to  !length-!window+1-!step step !step
   !j=!j+1
     
   ' set sample for estimation period         
   %first = @otod(@dtoo(%start))
   %last = @otod(@dtoo(%start)+!i+!window)
   smpl {%first} {%last}     

   ' estimate equation - where the equation is y=c(1) + c(2)*x1
   eq1.ls excess_return c ep_l1 i1_l1
   
  ' 1-period-ahead forecast
%1pers = @otod(@dtoo(%start)+!window) 'start point
%1pere = @otod(@dtoo(%start)+!i+!window) 'end point

if @dtoo(%end) < @dtoo(%1pere) then   'check whether the forecast end point is greater than the workfile end point
      exitloop
   endif 
   
   ' set smpl for forecasting period
   smpl {%1pers} {%1pere}   
   
   ' forecast with command *forecast* (see also *fit*)
   eq1.forecast(f=na) yf     
   
   ' set sampl to obtain the 4th period observation
   smpl {%1pere} {%1pere}   
   
   ' store forecasts
   fcast = yf
next

smpl @all
show fcast.line

d(noerr) yf


Appreciate any help.

Best


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 32 guests