Dear,
I have a set of different dependent variables and a common set of controls. Furthermore, I need to store my results.
I have created my global list (not reported). You can find below my loop script.
xtset classid
local i = 1
foreach var of global y_inv {
xtreg`var' $control1, fe
estimates store m`i'
local ++1
}
However, it is not enough. Now, I need to run regression for different kind of business types. Hence, in a typical regression line, it would be:
xtreg y1 x1 x2 x3 if business==1, fe
xtreg y1 x1 x2 x3 if business==2, fe
xtreg y1 x1 x2 x3 if business==3, fe
How can I add this "if business==" in my loop"? Ok I could run three different loops with the condition If but it is not efficient.
Related Posts with loop regression
LoopHello guys, I have a monthly panel data for periods 1996m1 to 2018m12. Using the code below, I have…
Combining variablesHi I have a question on how to combine multiple variables of the same category into single new varia…
Auto increment in var2 according to value of var1.Hey all, I was working on a cluster, and I stuck when I need to give numbering according to var1. So…
3 by 3 Matrix of Count VariablesHi All, I want to create a 3 X 3 matrix from 9 combinations of count variables Sev and Rch. The thr…
problems in state equations of sspaceHi. I'm trying to estimate the natural interest rate. Unfortunately, I have run into the following c…
Subscribe to:
Post Comments (Atom)
0 Response to loop regression
Post a Comment