* Set Directory
clear
set more off
set scheme s1mono
cd "$path"
global data_files "$path/Data"
global out_files "$path/output"
**==============================================================================
* Figure 1
use "$data_files/firm_enf.dta", clear
fvset base 2014 year
* Binscatter plot
binscatter any_air min_dist if min_dist<50 & starty<=2010, by(post) line(none) ytitle(Any Air Pollution Related Enforcement) xtitle(Distance to the Closest Monitor(km)) legend(region(lwidth(none)) pos(12) ring(0) lab(1 pre-policy (2010-2014)) lab(2 post-policy (2015-2017))) mc(black cranberry) lc(black cranberry) ysc(r(0.001 0.013)) ylab(0.001(0.002)0.013) graphregion(fcolor(white) lcolor(none) ifcolor(white) ilcolor(white) ilpattern(blank)) plotregion(fcolor(white) lcolor(none) ifcolor(white) ilcolor(white))
graph export "$out_files/any_air_gradient_50.pdf", replace
binscatter any_air year if min_dist<50 & starty<=2010, by(min_dist_10) ytitle(Any Air Pollution Related Enforcement) xtitle(Year) legend(region(lwidth(none)) pos(12) ring(0) order(2 1) lab(1 10-50km) lab(2 0-10km)) mc(black cranberry) line(none) xtick(2010(1)2017) xlabel(2010 "2010" 2011 "2011" 2012 "2012" 2013 "2013" 2014 "2014" 2015 "2015" 2016 "2016" 2017 "2017") ysc(r(0.001 0.013)) ylab(0.001(0.002)0.013) graphregion(fcolor(white) lcolor(none) ifcolor(white) ilcolor(white) ilpattern(blank)) plotregion(fcolor(white) lcolor(none) ifcolor(white) ilcolor(white))
graph export "$out_files/any_air_trend.pdf", replace
use "$data_files/Raw/pm.dta", clear
drop pm25
rename pm_indirect pm3
rename pm_direct pm2
reshape long pm, i(city_id year month) j(group)
append using "$data_files/pix.dta"
replace group = 1 if group == .
egen time = group(year month)
binscatter pm year, by(group) line(none) legend(region(lwidth(none)) pos(12) ring(0) cols(3) lab(1 Monitor (≤ 10km)) lab(2 City Center (10-50km)) lab(3 Surrounding Area (> 50km))) ysc(r(0.33 0.47)) ylab(0.30(0.02)0.48) mc(cranberry black gray) m(D O S) ytitle("Aerosol Optical Depth") xtitle("Year") xtick(2010(1)2017) xlabel(2010 "2010" 2011 "2011" 2012 "2012" 2013 "2013" 2014 "2014" 2015 "2015" 2016 "2016" 2017 "2017") ysc(r(0.24 0.48)) ylab(0.24(0.04)0.48) graphregion(fcolor(white) lcolor(none) ifcolor(white) ilcolor(white) ilpattern(blank)) plotregion(fcolor(white) lcolor(none) ifcolor(white) ilcolor(white))
graph export "$out_files/monitors_trend.pdf", replace
**==============================================================================
* Figure 2
use "$data_files/firm_enf.dta", clear
* set base level
fvset base 20 time
fvset base 4 min_d_d4
* Event Study Specification
reghdfe any_air i.time##i.min_d_d4 if min_dist<50 & starty<=2010, absorb(id time industry#time prov_id#time) cluster(city_id)
qui coefplot, baselevels omitted vert yline(0, lc(black)) xline(20.5, lc(cranberry) lp(dash)) keep(*.time#0.min_d_d4) drop() graphregion(color(white) fcolor(white)) plotregion(color(white)) ytitle(Parameter Estimate) xtitle(Year) le(95) mc(black) ciopts(recast(rcap) lwidth(0.3) lpattern(dash)) gen(enf_5_) replace
twoway (rarea enf_5_ul1 enf_5_ll1 enf_5_at, color(gs6%20)) (scatter enf_5_b enf_5_at, msymbol(p) mc(black%60)) (line enf_5_b enf_5_at, lp(dash) lc(blackblack%60)), yline(0, lc(black)) xline(20.5, lp(dash) lc(cranberry)) graphregion(fcolor(white) lcolor(none) ifcolor(white) ilcolor(white) ilpattern(blank)) plotregion(fcolor(white) lcolor(none) ifcolor(white) ilcolor(white)) legend(off) ytitle("") xtitle("") xtick(1(1)32) xlabel(1 "2010" 5 "2011" 9 "2012" 13 "2013" 17 "2014" 21 "2015" 25 "2016" 29 "2017") ysc(r(-0.006 0.012)) ylab(-0.006(0.006)0.012)
graph export "$out_files/event_enf_min_dist5.pdf", replace
qui coefplot, baselevels omitted vert yline(0, lc(black)) xline(20.5, lc(cranberry) lp(dash)) keep(*.time#1.min_d_d4) drop() graphregion(color(white) fcolor(white)) plotregion(color(white)) ytitle(Parameter Estimate) xtitle(Year) le(95) mc(black) ciopts(recast(rcap) lwidth(0.3) lpattern(dash)) gen(enf_10_) replace
twoway (rarea enf_10_ul1 enf_10_ll1 enf_10_at, color(gs6%20)) (scatter enf_10_b enf_10_at, msymbol(p) mc(black%60)) (line enf_10_b enf_10_at, lp(dash) lc(blackblack%60)), yline(0, lc(black)) xline(20.5, lp(dash) lc(cranberry)) graphregion(fcolor(white) lcolor(none) ifcolor(white) ilcolor(white) ilpattern(blank)) plotregion(fcolor(white) lcolor(none) ifcolor(white) ilcolor(white)) legend(off) ytitle("") xtitle("") xtick(1(1)32) xlabel(1 "2010" 5 "2011" 9 "2012" 13 "2013" 17 "2014" 21 "2015" 25 "2016" 29 "2017") ysc(r(-0.006 0.012)) ylab(-0.006(0.006)0.012)
graph export "$out_files/event_enf_min_dist10.pdf", replace
qui coefplot, baselevels omitted vert yline(0, lc(black)) xline(20.5, lc(cranberry) lp(dash)) keep(*.time#2.min_d_d4) drop() graphregion(color(white) fcolor(white)) plotregion(color(white)) ytitle(Parameter Estimate) xtitle(Year) le(95) mc(black) ciopts(recast(rcap) lwidth(0.3) lpattern(dash)) gen(enf_15_) replace
twoway (rarea enf_15_ul1 enf_15_ll1 enf_15_at, color(gs6%20)) (scatter enf_15_b enf_10_at, msymbol(p) mc(black%60)) (line enf_15_b enf_15_at, lp(dash) lc(blackblack%60)), yline(0, lc(black)) xline(20.5, lp(dash) lc(cranberry)) graphregion(fcolor(white) lcolor(none) ifcolor(white) ilcolor(white) ilpattern(blank)) plotregion(fcolor(white) lcolor(none) ifcolor(white) ilcolor(white)) legend(off) ytitle("") xtitle("") xtick(1(1)32) xlabel(1 "2010" 5 "2011" 9 "2012" 13 "2013" 17 "2014" 21 "2015" 25 "2016" 29 "2017") ysc(r(-0.006 0.012)) ylab(-0.006(0.006)0.012)
graph export "$out_files/event_enf_min_dist15.pdf", replace
qui coefplot, baselevels omitted vert yline(0, lc(black)) xline(20.5, lc(cranberry) lp(dash)) keep(*.time#3.min_d_d4) drop() graphregion(color(white) fcolor(white)) plotregion(color(white)) ytitle(Parameter Estimate) xtitle(Year) le(95) mc(black) ciopts(recast(rcap) lwidth(0.3) lpattern(dash)) gen(enf_20_) replace
twoway (rarea enf_20_ul1 enf_20_ll1 enf_20_at, color(gs6%20)) (scatter enf_20_b enf_20_at, msymbol(p) mc(black%60)) (line enf_20_b enf_20_at, lp(dash) lc(blackblack%60)), yline(0, lc(black)) xline(20.5, lp(dash) lc(cranberry)) graphregion(fcolor(white) lcolor(none) ifcolor(white) ilcolor(white) ilpattern(blank)) plotregion(fcolor(white) lcolor(none) ifcolor(white) ilcolor(white)) legend(off) ytitle("") xtitle("") xtick(1(1)32) xlabel(1 "2010" 5 "2011" 9 "2012" 13 "2013" 17 "2014" 21 "2015" 25 "2016" 29 "2017") ysc(r(-0.006 0.012)) ylab(-0.006(0.006)0.012)
graph export "$out_files/event_enf_min_dist20.pdf", replace
**==============================================================================
* Figure 3
use "$data_files/Raw/city_info.dta", clear
merge 1:1 city_id using "$data_files/share.dta"
drop if _merge == 2
drop _merge
binsreg share_rev_10 number, ci(95) graphregion(color(white) fcolor(white)) plotregion(color(white)) ytitle(% of High-Pollution Activity <10km from Monitor) xtitle(# Monitors)
graph export "$out_files/revenue_share.pdf", replace
**==============================================================================
* Figure 4
use "$data_files/city_pm.dta", clear
reghdfe pm25, a(city_id) residuals(pm_res)
collapse (mean) pm_res, by(number_iv year)
twoway (line pm_res year if number==1, lc(navy)) (line pm_res year if number==2, lc(maroon)) /*
*/ (line pm_res year if number==4, lc(forest_green)) (line pm_res year if number==6, lc(dkorange)), /*
*/ yline(0, lc(black)) xline(2014.5, lp(dash) lc(cranberry)) graphregion(color(white) fcolor(white)) plotregion(color(white)) ytitle("Aerosol Optical Depth") xtitle("Year") xtick(2010(1)2017) xsc(r(2010 2017)) xlabel(2010 "2010" 2011 "2011" 2012 "2012" 2013 "2013" 2014 "2014" 2015 "2015" 2016 "2016" 2017 "2017") legend(off) text(-0.008 2016.8 "One" -0.05 2016.8 "Two" -0.085 2016.8 "Four" -0.097 2016.8 "Six")
graph export "$out_files/number_iv_trend.pdf", replace
use "$data_files/city_pm.dta", clear
fvset base 2014 year
fvset base 20 time
drop if year==2014 & month==12
reghdfe pm25 i.time##c.number i.post1##i.quarter##c.area i.post1##i.quarter##c.pop i.quarter##c.area i.quarter##c.pop, a(city_id year#month pred tem_meand age_year year#incentive2) cluster(city_id)
coefplot, baselevels omitted vert yline(-0, lc(black)) xline(20.5, lp(dash) lc(cranberry)) keep(*me#c.number) coeflabels() drop() ysc(r(-0.08 0.04)) ylabel(-0.08(0.04)0.04) graphregion(color(white) fcolor(white)) plotregion(color(white)) ytitle(Parameter Estimate) le(95) mc(black) gen(pm1_) replace
regress number number_iv area pop
predict num_hat
reghdfe pm25 i.time##c.num_hat i.post1##i.quarter##c.area i.post1##i.quarter##c.pop i.quarter##c.area i.quarter##c.pop, a(city_id year#month pred tem_meand age_year year#incentive2) cluster(city_id)
coefplot, baselevels omitted vert yline(-0, lc(black)) xline(20.5, lp(dash) lc(cranberry)) keep(*me#c.num_hat) coeflabels() drop() graphregion(color(white) fcolor(white)) plotregion(color(white)) ytitle(Parameter Estimate) le(95) mc(black) gen(pm2_) replace
twoway (rarea pm1_ul1 pm1_ll1 pm1_at, color(gs6%20)) (line pm1_b pm1_at, lwidth(medthick) lp(dash) lc(blackblack%70)) (rarea pm2_ul1 pm2_ll1 pm2_at, color(gs6%20)) (line pm2_b pm2_at, lp(dash) lc(blackblack%40)), yline(-0, lc(black)) xline(20.5, lp(dash) lc(cranberry)) graphregion(fcolor(white) lcolor(none) ifcolor(white) ilcolor(white) ilpattern(blank)) plotregion(fcolor(white) lcolor(none) ifcolor(white) ilcolor(white)) ytitle("") xtitle("") xtick(1(1)32) xlabel(1 "2010" 5 "2011" 9 "2012" 13 "2013" 17 "2014" 21 "2015" 25 "2016" 29 "2017") ysc(r(-0.08 0.08)) ylabel(-0.08(0.04)0.08) legend(order(2 "DiD" 4 "DiD+IV") pos(2) ring(0) rows(2))
graph export "$out_files/eventpm.pdf", replace
**==============================================================================
* Figure 5
use "$data_files/city_pm_rd.dta", clear
gen dist1 = area - 20 if cutoff == 1
replace dist1 = area - 50 if cutoff == 2
gen bench = pm25 if year < 2012
bys city_id cutoff: egen mean_bench = mean(bench)
regress number cutoff if abs(dist1)<22
predict res_num, residuals
rdplot res_num dist1 if abs(dist1)<15 & year==2015 & month==1, p(2) h(15) nbins(5) kernel(uni) ci(95) vce(cluster city_id) graph_options(ytitle(Residualized # of Monitors) xtitle(Distance to the Closest Geographical Size Cutoff) legend(off) graphregion(fcolor(white) lcolor(none) ifcolor(white) ilcolor(white) ilpattern(blank)) plotregion(fcolor(white) lcolor(none) ifcolor(white) ilcolor(white)) legend(nobox region(fcolor(white) margin(zero) lcolor(white))) ysc(r(-1.5 1.5)) ylabel(-1.5(0.5)1.5) xsc(r(-15 15)) xlabel(-15(5)15))
graph export "$out_files/fs_ci.pdf", replace
regress incentive2 cutoff if abs(dist1)<22
predict res_inc2, residuals
rdplot res_inc2 dist1 if abs(dist1)<15 & year==2015 & month==1, p(2) h(15) nbins(5) kernel(uni) ci(95) vce(cluster city_id) graph_options(ytitle(Residualized Reduction Goal(%)) xtitle(Distance to the Closest Geographical Size Cutoff) legend(off) graphregion(fcolor(white) lcolor(none) ifcolor(white) ilcolor(white) ilpattern(blank)) plotregion(fcolor(white) lcolor(none) ifcolor(white) ilcolor(white)) legend(nobox region(fcolor(white) margin(zero) lcolor(white))) ysc(r(-10 10)) ylabel(-10(5)10) xsc(r(-15 15)) xlabel(-15(5)15))
graph export "$out_files/inc2_ci.pdf", replace
regress pm25 cutoff mean_bench if abs(dist1)<22 & year>=2015
predict res_pm, residuals
rdplot res_pm dist1 if abs(dist1)<15 & year>=2015 & year>2011, p(2) h(15) nbins(5) covs() kernel(uni) ci(95) vce(cluster city_id) graph_options(ytitle(Residualized AOD) xtitle(Distance to the Closest Geographical Size Cutoff) legend(off) graphregion(fcolor(white) lcolor(none) ifcolor(white) ilcolor(white) ilpattern(blank)) plotregion(fcolor(white) lcolor(none) ifcolor(white) ilcolor(white)) legend(nobox region(fcolor(white) margin(zero) lcolor(white))) ysc(r(-0.06 0.06)) ylabel(-0.06(0.03)0.06) xsc(r(-15 15)) xlabel(-15(5)15))
graph export "$out_files/rd_ci.pdf", replace
regress pm25 cutoff mean_bench if abs(dist1)<22 & year<2015 & year>2010
predict res_pm_pre, residuals
rdplot res_pm_pre dist1 if abs(dist1)<15 & year<2015 & year>2011, p(2) h(15) nbins(5) covs() kernel(uni) ci(95) vce(cluster city_id) graph_options(ytitle(Residualized AOD) xtitle(Distance to the Closest Geographical Size Cutoff) legend(off) graphregion(fcolor(white) lcolor(none) ifcolor(white) ilcolor(white) ilpattern(blank)) plotregion(fcolor(white) lcolor(none) ifcolor(white) ilcolor(white)) legend(nobox region(fcolor(white) margin(zero) lcolor(white))) ysc(r(-0.06 0.06)) ylabel(-0.06(0.03)0.06) xsc(r(-15 15)) xlabel(-15(5)15))
graph export "$out_files/rd_ci_pre.pdf", replace
**==============================================================================
use "$data_files/city_enf_rd.dta", clear
gen dist1 = area - 20 if cutoff == 1
replace dist1 = area - 50 if cutoff == 2
gen bench = log_any_air if year < 2012
bys city_id cutoff: egen mean_bench = mean(bench)
regress log_any_air cutoff mean_bench if abs(dist1)<22 & year>=2015
predict res_air, residuals
rdplot res_air dist1 if abs(dist1)<16 & year>=2015 & year>2011, p(2) h(15) nbins(5) covs() kernel(uni) ci(95) vce(cluster city_id) graph_options(ytitle(Residualized log(# Any Enf)) xtitle(Distance to the Closest Geographical Size Cutoff) legend(off) graphregion(fcolor(white) lcolor(none) ifcolor(white) ilcolor(white) ilpattern(blank)) plotregion(fcolor(white) lcolor(none) ifcolor(white) ilcolor(white)) legend(nobox region(fcolor(white) margin(zero) lcolor(white))) ysc(r(-0.5 0.5)) ylabel(-0.5(0.25)0.5) xsc(r(-15 15)) xlabel(-15(5)15))
graph export "$out_files/rd_ci_enf.pdf", replace
regress log_any_air cutoff if abs(dist1)<22 & year<2015 & year>2011
predict res_air_pre, residuals
rdplot res_air_pre dist1 if abs(dist1)<16 & year<2015 & year>2011, p(2) h(15) nbins(5) covs() kernel(uni) ci(95) vce(cluster city_id) graph_options(ytitle(Residualized log(# Any Enf)) xtitle(Distance to the Closest Geographical Size Cutoff) legend(off) graphregion(fcolor(white) lcolor(none) ifcolor(white) ilcolor(white) ilpattern(blank)) plotregion(fcolor(white) lcolor(none) ifcolor(white) ilcolor(white)) legend(nobox region(fcolor(white) margin(zero) lcolor(white))) ysc(r(-0.5 0.5)) ylabel(-0.5(0.25)0.5) xsc(r(-15 15)) xlabel(-15(5)15))
graph export "$out_files/rd_ci_enf_pre.pdf", replace
**==============================================================================
* Figure 6
use "$data_files/city_pm.dta", clear
fvset base 58 age
reghdfe pm25 c.post1#c.number c.post1#c.area c.post1#c.pop i.age#c.post1#c.number if age >= 50 & age <= 60, a(city_id year#month pred tem_meand incentive2#i.year) cluster(city_id)
coefplot, baselevels omitted vert keep(*age#c.post1#c.number) drop(_cons c.post1#c.number c.post1#c.area c.post1#c.pop) yline(0, lc(cranberry)) graphregion(fcolor(white) lcolor(none) ifcolor(white) ilcolor(white) ilpattern(blank)) plotregion(fcolor(white) lcolor(none) ifcolor(white) ilcolor(white)) legend(off) ytitle("") xtitle("Age of Mayor") coeflabels(50.age#c.post1#c.number = "50" 51.age#c.post1#c.number = "51" 52.age#c.post1#c.number = "52" 53.age#c.post1#c.number = "53" 54.age#c.post1#c.number = "54" 55.age#c.post1#c.number = "55" 56.age#c.post1#c.number = "56" 57.age#c.post1#c.number = "57" 58.age#c.post1#c.number = "58" 59.age#c.post1#c.number = "59" 60.age#c.post1#c.number = "60") le(95) ysc(r(-0.04 0.02)) ylab(-0.04(0.02)0.02)
graph export "$out_files/promotion_age.pdf", replace
use "$data_files/city_enf.dta", clear
fvset base 58 age
reghdfe log_any_air c.post1#c.number i.age#c.post1#c.number c.post1#c.area c.post1#c.pop if age >= 50 & age <= 60, a(city_id year#quarter incentive2#i.year) cluster(city_id)
coefplot, baselevels omitted vert keep(*age#c.post1#c.number) drop(_cons c.post1#c.number c.post1#c.area c.post1#c.pop) yline(0, lc(cranberry)) graphregion(fcolor(white) lcolor(none) ifcolor(white) ilcolor(white) ilpattern(blank)) plotregion(fcolor(white) lcolor(none) ifcolor(white) ilcolor(white)) legend(off) ytitle("") xtitle("Age of Mayor") coeflabels(50.age#c.post1#c.number = "50" 51.age#c.post1#c.number = "51" 52.age#c.post1#c.number = "52" 53.age#c.post1#c.number = "53" 54.age#c.post1#c.number = "54" 55.age#c.post1#c.number = "55" 56.age#c.post1#c.number = "56" 57.age#c.post1#c.number = "57" 58.age#c.post1#c.number = "58" 59.age#c.post1#c.number = "59" 60.age#c.post1#c.number = "60") le(95) ysc(r(-0.12 0.24)) ylab(-0.12(0.12)0.24)
graph export "$out_files/promotion_age_enf.pdf", replace