viewtopic.php?f=4&t=20371&p=65681&hilit=panel+rolling+regression#p65681
I noticed there has been consistent and even growing interest in rolling panel regression functionality.
However, it would appear that EViews doesn't offer a native function for panel rolling regressions, but one could attempt a program as is discussed here:
viewtopic.php?t=18592
However, in many of such threads, the complete rolling regression program hasn't been provided for the panel case.
I was hoping that we could adapt the basic rolling regression EViews Gareth begun:
viewtopic.php?f=15&t=878
To mold it into a panel rolling regression, it might be nice to have comments to denote what would change based on cross section and periods included
Purely as an example, in my case:
- Periods:53
- Cross sections: 670
- Total (unblanced) observations: 21558
I tried the following code with the equation.ls(cx=f) as suggested:
Code: Select all
'Configuration
%y = "y"
%const = c
%var1 = "x1"
%var2 = "x2"
%var3 = "x3"
%var4 = "x4"
%var5 = "x5"
%var6 = "x6"
%var7 = "x7"
'-------------------------------------------------------------------------------------
'run rolling regression
' set window size
!window = 21558
' set step size
!step = 3000
' get size of workfile
!length = @obsrange
' declare equation for estimation
equation eq1
'calculate number of rolls
!nrolls = @round((!length-!window)/!step)
'matrix to store coefficient estimates
matrix(8,!nrolls) coefmat ' where 8 is the number of coefficients
'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 to estimation period
smpl @first+!i-1 @first+!i+!window-2
' estimate equation - where the equation is y=c(1) + c(2)*x1 + c(3)*x2
eq1.ls(cx=f) {%y} {%const} {%x1} {%x2} {%x3} {%x4} {%x5} {%x6} {%x7}
'store coefficients
colplace(coefmat,eq1.@coefs,!j)
next
show coefmat
However, this just gave me a 8x3 matrix. I was expecting 8x50-ish, to cover most of the periods observed. At least for me, it's difficult to figure out how to tweak the syntax to output betas across my desired time horizon.