regression analysis - use of "if" and "else" commands

For questions regarding programming in the EViews programming language.

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

Roxana_hm
Posts: 2
Joined: Thu Oct 08, 2020 7:35 pm

regression analysis - use of "if" and "else" commands

Postby Roxana_hm » Thu Oct 08, 2020 11:05 pm

Hello Eviews forum members,

I am trying to run an OLS regression that needs to get the coefficients depends on the values of let's say variable s (s can be 0 and 1);

1) When I run OLS regression like below I kind of getting not correct coefficients

y c X1 (s=1) X1 (s=0)
which is not what I want.

2) when I put "if s=1" in sample section (i.e., 1/01/2001 9/09/2019 if s = 1) then I am getting correct results but I cannot have both if s=1 and if s=0 in one go.

I tried if else commands and some other options, I got errors.
The reason that I want all the coefficient in one run is because later I need to test a hypothesis that the two coefficient are equal (wald test).
I am trying it using "quick" tab -> estimate equation but later I will write the codes since I have 100 regressions to run.

Any help would be appreciated.

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

Re: regression analysis - use of "if" and "else" commands

Postby EViews Gareth » Fri Oct 09, 2020 7:43 am

Code: Select all

y c x1*s1 x1*(1-s1)

Roxana_hm
Posts: 2
Joined: Thu Oct 08, 2020 7:35 pm

Re: regression analysis - use of "if" and "else" commands

Postby Roxana_hm » Fri Oct 09, 2020 8:46 pm

Thanks, @EViews Gareth, it works perfectly.


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 2 guests