在 Stata 中,我试图仅将特定变量保留在系数图中,并且我正在使用该drop()
选项,但它运行不佳,尽管它没有产生任何错误。coefplot
是一个社区贡献的命令,这里有更多关于它的信息。
这是我的数据集的数据示例:
* Example generated by -dataex-. For more info, type help dataex
clear
input float(income DiD_implementation treated_area treatment_time)
300 0 1 1 1
232 0 1 1 1
351 0 0 1 0
167 0 0 1 0
322 0 1 1 1
98 0 0 1 0
437 0 1 1 1
311 0 1 1 1
735 0 0 1 0
207 0 0 1 0
diff income, t(treated_area ) p(treatment_time)
这是模型的结果:
DIFFERENCE-IN-DIFFERENCES ESTIMATION RESULTS
Number of observations in the DIFF-IN-DIFF: 61278
Before After
Control: 11876 19262 31138
Treated: 11587 18553 30140
23463 37815
--------------------------------------------------------
Outcome var. | income| S. Err. | |t| | P>|t|
----------------+---------+---------+---------+---------
Before | | | |
Control | 3.079 | | |
Treated | 5.198 | | |
Diff (T-C) | 2.120 | 0.195 | 10.84 | 0.000***
After | | | |
Control | 1.800 | | |
Treated | 1.816 | | |
Diff (T-C) | 0.017 | 0.154 | 0.11 | 0.914
| | | |
Diff-in-Diff | -2.103 | 0.249 | 8.45 | 0.000***
--------------------------------------------------------
R-square: 0.01
* Means and Standard Errors are estimated by linear regression
**Inference: *** p<0.01; ** p<0.05; * p<0.1
根据 Cibernik 的建议,以下代码运行良好:
coefplot income, xline(0) drop(_cons treated_neighborhood treatment_time)