I applied a difference-in-difference approach to one of my research projects. Especially, I want to find out how certain state-level laws("A" laws) affect the unemployment rate of the state. The year the bill was passed is different for each state.
To do a falsification test, I created a placebo treatment variable among non-"A" laws and late adopting "A" laws states with randomly assigned region-specific "A" laws passage dates.
I tried to do simulation 1000 times with randomly assigned treatment years. And then, I want to store the values(Coefficient, P-value, and Confidence level) derived from 1000 regressions.
The dataset would look like this:
year | treatment group(state) | Treated year | |
1 | 1996 | 1 | 0 |
1 | 1997 | 1 | 0 |
1 | 1998 | 1 | 1 |
2 | 1996 | 0 | 0 |
2 | 1997 | 0 | 0 |
2 | 1998 | 0 | 0 |
3 | 1996 | 1 | 0 |
3 | 1997 | 1 | 1 |
3 | 1998 | 1 | 1 |
year | treatment group(state) | Treated year | |
1 | 1996 | 1 | 0 |
1 | 1997 | 1 | 1 |
1 | 1998 | 1 | 1 |
2 | 1996 | 0 | 0 |
2 | 1997 | 0 | 0 |
2 | 1998 | 0 | 0 |
3 | 1996 | 1 | 0 |
3 | 1997 | 1 | 0 |
3 | 1998 | 1 | 1 |
year | treatment group(state) | Treated year | |
1 | 1996 | 1 | 1 |
1 | 1997 | 1 | 1 |
1 | 1998 | 1 | 1 |
2 | 1996 | 0 | 0 |
2 | 1997 | 0 | 1 |
2 | 1998 | 0 | 1 |
3 | 1996 | 1 | 0 |
3 | 1997 | 1 | 0 |
3 | 1998 | 1 | 1 |
Code:
permute treated b= el(r(table), 1, 3) ll = el(r(table),5,3) ul = el(r(table),6,3), /// saving(SomeOutFile.dta, replace): reg s y x1 x2 treated
0 Response to running estimation1000 times with random assign treated groups
Post a Comment