Page 1 of 1

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

Posted: Thu Oct 08, 2020 11:05 pm
by Roxana_hm
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.

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

Posted: Fri Oct 09, 2020 7:43 am
by EViews Gareth

Code: Select all

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

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

Posted: Fri Oct 09, 2020 8:46 pm
by Roxana_hm
Thanks, @EViews Gareth, it works perfectly.