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

For questions regarding programming in the EViews programming language.

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

fatihtekke
Posts: 3
Joined: Sat Jan 05, 2019 10:50 pm

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

Postby fatihtekke » Mon Jan 07, 2019 2:22 pm

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

EViews Matt
EViews Developer
Posts: 560
Joined: Thu Apr 25, 2013 7:48 pm

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

Postby EViews Matt » Tue Jan 08, 2019 10:49 am

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

fatihtekke
Posts: 3
Joined: Sat Jan 05, 2019 10:50 pm

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

Postby fatihtekke » Tue Jan 08, 2019 12:01 pm

Hi Matt,
thanks for your help
Cheers


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 29 guests