Store and apply coefficients

For questions regarding programming in the EViews programming language.

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

fi99ggb
Posts: 26
Joined: Tue Jul 02, 2019 4:05 am

Store and apply coefficients

Postby fi99ggb » Tue Jul 09, 2019 3:57 am

Hello

I am looking for a quick way to do the following and wondering whether you have any tips:

1. estimate equation (OLS regression): Y1 = a1 + b1*x1 + c1*z1
2. Store coefficient values b1 and c1
3. Estimate restricted OLS: Y2 = a2 + b1*x2 + c1*z2 (only a2 is estimated, b1 and c1 are taken from the first equation)

Step one is standard; step 3 is easy to do manually. I was wondering whether there is an easy way to programmatically pick up b1 and c1 from step 1 and plug them in the equation in step 3.

Thanks
George

EViews Gareth
Fe ddaethom, fe welon, fe amcangyfrifon
Posts: 13604
Joined: Tue Sep 16, 2008 5:38 pm

Re: Store and apply coefficients

Postby EViews Gareth » Tue Jul 09, 2019 7:26 am

Code: Select all

equation eq1.ls y1 c x1 z1 equation eq2.ls (y2-eq1.@coef(1)*x2-eq1.@coef(1)*z2) c

fi99ggb
Posts: 26
Joined: Tue Jul 02, 2019 4:05 am

Re: Store and apply coefficients

Postby fi99ggb » Tue Jul 09, 2019 9:59 am

Beautiful. Thank you.


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 2 guests