Quantcast
Channel: Statalist
Viewing all articles
Browse latest Browse all 65064

suggestion for regressions with nested loops

$
0
0
I want to do a nested loop, I want to do several regressions as follows

dependents vars would be like y1 y2 y3 y4
some independents vars would be fixed, let’s say local indoor x1 x2 x3 x4 x5
and some other independents vars would be t1 t2 t3 t4, these are a group of treatment variables that I want to rotate, but never be together in the same model.


y1 t1 x1 x2 x3 x4 x5
y1 t2 x1 x2 x3 x4 x5
y1 t3 x1 x2 x3 x4 x5
y1 t4 x1 x2 x3 x4 x5
*
y2 t1 x1 x2 x3 x4 x5
y2 t2 x1 x2 x3 x4 x5
y2 t3 x1 x2 x3 x4 x5
y2 t4 x1 x2 x3 x4 x5
*
y3 t1 x1 x2 x3 x4 x5
y3 t2 x1 x2 x3 x4 x5
y3 t3 x1 x2 x3 x4 x5
y3 t4 x1 x2 x3 x4 x5
*
y4 t1 x1 x2 x3 x4 x5
y4 t2 x1 x2 x3 x4 x5
y4 t3 x1 x2 x3 x4 x5
y4 t4 x1 x2 x3 x4 x5
*

I tried the following but it didn’t work as I meant to

local depvar y1 y2 y3 y4 y5 y6
local indvar x1 x2 x3 x4 x5 x6 x7
local treat t1 t2 t3 t4 t4
foreach var1 of varlist `depvar' {
foreach var1 of varlist `treat' {
cap reg `depvar' `treat' `indvar'
estimates store trial`var'_1
}
}
By the way, I’m studying about this with the Stata’s manual, yet I’m trying to get the Baum’s book.

Any suggestions?


Viewing all articles
Browse latest Browse all 65064

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>