Page 1 of 1
Rolling regression
Posted: Sat May 12, 2012 4:27 pm
by rashid02
Hi
I am using the following program taken from this forum to do rolling regression of monthly stocks returns on market index. Each stock has monthly returns data and market return as well (see attached file). The estimation window moves forward one month at a time.
!iwindow = 30
!istep = 1
!length = @obsrange
equation eq1
!nrolls = @round((!length-!iwindow)/!istep)
matrix(2,!nrolls) coefmat
!j=0
for !i = !iwindow to !length
!j=!j+1
smpl @first+!i-1 @first+!i-1+!iwindow
eq1.ls sr2 c mrp
Colplace(coefmat,eq1.@coefs,!j)
next
I want to get log of the sum squared residuals after each estimation window. At the end of program I do not know how can I get a table for all these SSR . I would appreciate your help. thanks
Re: Rolling regression
Posted: Sat May 12, 2012 8:11 pm
by EViews Gareth
Create a vector the same size as the number of estimations you'll be doing, then store the @ssr data member of the equation into that vector, in the same way you're storing the coefficients.
Re: Rolling regression
Posted: Sun May 13, 2012 5:38 pm
by rashid02
Is the following syntax correct for getting SSR after each regression, where number of obs are 30 months data points and rolling window length 1. I would appreciate your reply thanks
matrix output_ssr{!iwindow}=output{!iwindow}.@ssr
Rolling regression
Posted: Sun May 13, 2012 6:08 pm
by EViews Gareth
You need equation.@ssr
Re: Rolling regression
Posted: Mon May 14, 2012 4:46 pm
by rashid02
Hi Gareth
Many thanks for your prompt reply. Unfortunately my lack of programming skills, is this equation.@ssr be placed at the end of program?
Re: Rolling regression
Posted: Mon May 14, 2012 9:44 pm
by EViews Gareth
It is probably better for you to read through the programming guide, and more of example programs and get an understanding of how what you currently have works, so that you can extend it more easily.
Re: Rolling regression
Posted: Wed Jun 19, 2013 12:58 pm
by pgupta
Hi,
I am using Rolling Regression technique using the following program. Please find attached the EViews workfile. However, after running this program, the estimated coefficients are not getting reflected in the "coefmat". Did i made an error in the program below. Kindly help me on this. Thank you so much!
!iwindow = 100
!istep = 1
!length = @obsrange
equation eq1
!nrolls = @round((!length-!iwindow)/!istep)
matrix(4,!nrolls) coefmat
!j=0
for !i = !iwindow to !length
!j=!j+1
smpl @first+!i-1 @first+!i-1+!iwindow
eq1.ls y c x1 x2 x3
Colplace(coefmat,eq1.@coefs,!j)
next
show coefmat
Re: Rolling regression
Posted: Wed Jun 19, 2013 12:59 pm
by EViews Gareth
I just ran that program on that workfile, and coefmat was filled in.
Re: Rolling regression
Posted: Wed Jun 19, 2013 1:05 pm
by pgupta
Thank you so much for such a quick reply. I ran it again. Same problem. Can this be something with the version? I am using EViews 7. Thanks again.
Re: Rolling regression
Posted: Wed Jun 19, 2013 1:24 pm
by EViews Gareth
Re: Rolling regression
Posted: Wed Jun 19, 2013 1:38 pm
by pgupta
Thank you again. I tried it again and it worked!!! :) :)
I just wanted to ask one more question please. Is there any way to check for autocorrelation in all the regressions(141 in this case) run under Rolling Regression program?