Page 1 of 1

perform a regression for each crossid in a panel workfile and store the slopes

Posted: Mon Jan 07, 2019 2:22 pm
by fatihtekke
Hi there,
I have a panel data with a 1200 cross section id with around 40 time series observations.
I need to run each crossid and obtain the "beta"
I know that this code is working properly.

for !i=1 to 1200
smpl if @crossid=!i
equation linreg{!i}.LS Y C X1 X2
next

however, it is not easy to store the "beta for X1 for 1200 regression by hand, I wonder if anyone can help me to create a new variable that contains all beta"s as a 1200*1 matrix
Cheers

Re: perform a regression for each crossid in a panel workfile and store the slopes

Posted: Tue Jan 08, 2019 10:49 am
by EViews Matt
Hello,

You just need to create the auxiliary storage for the betas and then copy them out of the equation objects one at a time.

Code: Select all

vector(1200) betas for !i=1 to 1200 smpl if @crossid=!i equation linreg{!i}.LS Y C X1 X2 betas(!i) = linreg{!i}.@coefs(2) next

Re: perform a regression for each crossid in a panel workfile and store the slopes

Posted: Tue Jan 08, 2019 12:01 pm
by fatihtekke
Hi Matt,
thanks for your help
Cheers