链接:https://pan.baidu.com/s/1nBvlYGXkV7ednEx93ge1ZQ
提取码:vs5q
/*** APPENDIX ***
*********************
*** Summary Stats ***
*********************
*full sample
sum avglt
sum avglt if year<2006
sum avglt if year>=2006
sum nr06 nr07 nr08 if year==2006
*restricted sample
sum avglt if wage!=.
sum avglt if year<2006 & wage!=.
sum avglt if year>=2006 & wage!=.
sum nr06 nr07 nr08 if year==2006 & wage!=.
sum rggvy wage outputwage state_frac if year==2006
sum wage outputwage state_frac if nr06==1 & year==2006
sum wage outputwage state_frac if nr07==1 & year==2006
sum wage outputwage state_frac if nr08==1 & year==2006
*** Fig. 1a: Mean by Wave ***
*****************************
set scheme s1mono //设置图片的主题
bysort year: egen avglt_06 = mean(avglt) if year>=2000 & nr06==1
bysort year: egen avglt_07 = mean(avglt) if year>=2000 & nr07==1
bysort year: egen avglt_08 = mean(avglt) if year>=2000 & nr08==1
label var avglt_06 "Wave 1"
label var avglt_07 "Wave 2"
label var avglt_08 "Wave 3"
twoway (scatter avglt_06 year) (scatter avglt_07 year) (scatter avglt_08 year), xtitle(Year) ytitle(Avg. Night-time Light Index) ylabel(0(2)10) xlabel(2000(2)2014) xline(2006)
local pre "i.year#c.wage i.year#c.outputwage i.year#c.state_frac"
***********************************************
*** Table 1, Panel A. Base Analysis: Lights ***
***********************************************
*col. 1
reghdfe std_lt nregs , absorb(sno year#st) cluster(sno)
local b1 = _b[nregs]
*col. 2
reghdfe std_lt nregs i.year#c.dlt00_05 i.year#i.rggvy , absorb(sno year#st) cluster(sno)
local b2 = _b[nregs]
*col. 3
reghdfe std_lt nregs if wage!=., absorb(sno year#st) cluster(sno)
local b3 = _b[nregs]
*col. 4
reghdfe std_lt nregs i.year#c.dlt00_05 i.year#i.rggvy if wage!=., absorb(sno year#st) cluster(sno)
local b4 = _b[nregs]
*col. 5
reghdfe std_lt nregs i.year#c.dlt00_05 i.year#i.rggvy `pre', absorb(sno year#st) cluster(sno)
local b5 = _b[nregs]
关于代码中#的含义,参考:https://blog.csdn.net/arlionn/article/details/80818984
local pre "i.year#c.wage i.year#c.outputwage i.year#c.state_frac"
*****************************
*** Fig. 1a: Mean by Wave ***
*****************************
set scheme s1mono
bysort year: egen avglt_06 = mean(avglt) if year>=2000 & nr06==1
bysort year: egen avglt_07 = mean(avglt) if year>=2000 & nr07==1
bysort year: egen avglt_08 = mean(avglt) if year>=2000 & nr08==1
label var avglt_06 "Wave 1"
label var avglt_07 "Wave 2"
label var avglt_08 "Wave 3"
twoway (scatter avglt_06 year) (scatter avglt_07 year) (scatter avglt_08 year), xtitle(Year) ytitle(Avg. Night-time Light Index) ylabel(0(2)10) xlabel(2000(2)2014) xline(2006)
*** Fig. 2a: Event Figure, Early Waves ***
******************************************
gen wave1=nr06
gen wave2=nr07
gen wave3=nr08
tab year, gen(yr)
*store wave 1 results
forvalues i=1/14{
gen w`i'=0 if wave1~=.
replace w`i'=1 if wave1==1 & yr`i'==1
gen x`i'=0 if wave2~=.
replace x`i'=1 if wave2==1 & yr`i'==1
}
*omit 2006
replace w6=0 if wave1~=.
replace x6=0 if wave2~=.
*estimation
reghdfe std_lt w1 w2 w3 w4 w5 w6 w7 w8 w9 w10 w11 w12 w13 w14 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12 x13 x14, absorb(sno year#st) cluster(sno)
*store
estadd ysumm
eststo lights_w1
drop w1-w14 x1-x14
*store wave 2 results
forvalues i=1/14{
gen w`i'=0 if wave2~=.
replace w`i'=1 if wave2==1 & yr`i'==1
gen x`i'=0 if wave1~=.
replace x`i'=1 if wave1==1 & yr`i'==1
}
*omit 2006
replace w6=0 if wave2~=.
replace x6=0 if wave1~=.
*estimation
reghdfe std_lt w1 w2 w3 w4 w5 w6 w7 w8 w9 w10 w11 w12 w13 w14 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12 x13 x14, absorb(sno year#st) cluster(sno)
*store
estadd ysumm
eststo lights_w2
*label years
forvalue i=1/14{
local j = 1999+`i'
label var w`i' "`j'"
}
set scheme s1mono //设置绘图模板https://blog.csdn.net/weixin_39611308/article/details/111373344
coefplot (lights_w1, label("Wave 1")) (lights_w2, label("Wave 2")), keep(w1 w2 w3 w4 w5 w6 w7 w8 w9 w10 w11 w12 w13 w14) vertical ytitle(Coefficient on Wave*Year) ylabel(-.5(.1).5) xlabel(,labsize(small)) yline(0) levels(95) ciopts(lpattern(dash)) omitted baselevels ///
groups(w1 w2 w3 w4 w5 w6 = `""{bf:Pre-Rollout}" "(No Districts)""' ///
w7 w8 w9 = `""{bf:Rollout}" "(Early Districts)""' ///
w10 w11 w12 w13 w14 = `""{bf:Post-Rollout}" "(All Districts)""')
drop w1-w14 x1-x14
forvalues i=1/14{
gen w`i'=0 if wave3~=.
replace w`i'=1 if wave3==1 & yr`i'==1
}
*omit 2005
replace w6=0 if wave3~=.
reghdfe std_lt w1 w2 w3 w4 w5 w6 w7 w8 w9 w10 w11 w12 w13 w14 , absorb(sno year#st) cluster(sno)
estadd ysumm
eststo lights_w3
*label years
forvalue i=1/14{
local j = 1999+`i'
label var w`i' "`j'"
}
*figure output
coefplot (lights_w3, label("Wave 3")) , keep(w*) vertical ytitle(Coefficient on Wave*Year) ylabel(-.5(.1).5) xlabel(,labsize(small)) yline(0) levels(95) ciopts(lpattern(dash)) omitted baselevels ///
groups(w1 w2 w3 w4 w5 w6 = `""{bf:Pre-Rollout}" "(No Districts)""' ///
w7 w8 w9 = `""{bf:Rollout}" "(Early Dist.)""' ///
w10 w11 w12 w13 w14 = `""{bf:Post-Rollout}" "(All Districts)""')
*** App Table 2, Panel A. Association with levels, not trend ***
*****************************************************************
egen std_premean_lt = std(pre_meanlt) //取标准误的意义何在呢
egen std_pregrowth_lt = std(dlt00_05)
**pre-period mean
*col. 1
reghdfe std_premean_lt nr08 if year==2000, absorb(st) cluster(st)
*col. 2
reghdfe std_premean_lt nr08 if year==2000 & wage!=., absorb(st) cluster(st)
**pre-period growth
*col. 3
reghdfe std_pregrowth_lt nr08 if year==2000, absorb(st) cluster(st)
*col. 4
reghdfe std_pregrowth_lt nr08 if year==2000 & wage!=., absorb(st) cluster(st)
*** Appendix Figures: Goodman-Bacon Decompositions ***
******************************************************
xtset sno year
*App Fig. 1: GB Decomposition, All Waves
bacondecomp std_lt nregs, ddetail
*App. Fig. 2a: GB Decomposition: 2006 & 2007
preserve
drop if nr08==1
bacondecomp std_lt nregs, ddetail
restore
**App. Fig. 2b: GB Decomposition: 2007 & 2008
preserve
drop if nr06==1
bacondecomp std_lt nregs, ddetail
restore
*App. Fig. 2c: GB Decomposition: 2006 & 2008
preserve
drop if nr07==1
bacondecomp std_lt nregs, ddetail
restore