Liu, L., Wang, Y., & Xu, Y. (2021). A practical guide to counterfactual estimators for causal inference with time-series cross-sectional data. arXiv preprint arXiv:2107.00856.
cd "/Users/ginglam/OneDrive - whu.edu.cn/02_Data_Storages/Dataset for Learning”
eststo m1:reg Y D X1 X2
esttab m1, nogap se
----------------------------
(1)
Y
----------------------------
D 11.58***
(0.194)
X1 0.988***
(0.0654)
X2 2.976***
(0.0644)
_cons 10.04***
(0.0695)
----------------------------
N 7000
----------------------------
fect Y, treat(D) unit(id) time(time) cov(X1 X2) method("fe") force(“none”)
mat list e(ATT)
e(ATT)[1,2]
ATT N
r1 11.580523 900
xtset id time
eststo m2: xtreg Y D X1 X2,fe
esttab m2, nogap se
----------------------------
(1)
Y
----------------------------
D 9.045***
(0.175)
X1 0.972***
(0.0530)
X2 3.007***
(0.0521)
_cons 10.37***
(0.0565)
----------------------------
N 7000
----------------------------
fect Y, treat(D) unit(id) time(time) cov(X1 X2) method("fe") force("unit”)
mat list e(ATT)
e(ATT)[1,2]
ATT N
r1 9.2511047 900
eststo m3: xtreg Y D X1 X2 i.time,fe
esttab m3, nogap se keep(D X1 X2)
----------------------------
(1)
Y
----------------------------
D 3.099***
(0.147)
X1 0.959***
(0.0360)
X2 3.055***
(0.0354)
----------------------------
N 7000
----------------------------
fect Y, treat(D) unit(id) time(time) cov(X1 X2) method("fe") force("two-way”)
mat list e(ATT)
e(ATT)[1,2]
ATT N
r1 3.4890777 900
等效性检验(equivalence test)
通过等效性检验判断识别假设(identification assumption)是否有效
只适用于 fe, ife, mc, bspline, polynomial and both.
1
2
fect Y, treat(D) unit(id) time(time) cov(X1 X2) se method("fe") preperiod(-25) offperiod(0) equiTest nboots(100)
安慰剂检验(placebo test)
提供安慰剂检验,减轻对前趋势过拟合的担忧(concern of over-fitting in the pre-trend)
在placeboperiod ()指定干预前的范围作为安慰剂周期
1
2
fect Y, treat(D) unit(id) time(time) cov(X1 X2) se method("fe") placeboTest nboots(100)