File size: 12,319 Bytes
3fb2143 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 |
* Set Directory
clear
set more off
set scheme s1mono
cd "$path"
global data_files "$path/Data"
global out_files "$path/output"
**==============================================================================
* Table 1-2
// Conley
use "$data_files/firm_enf.dta", clear
keep if min_dist<50 & starty<=2010
drop if revenue == .
drop if key == .
label var min_dist_10 "Mon\$\_{<10km}\$"
label var any_air "Any Enforcement (0/1)"
label var post "Post"
label var key "High Pollution"
gen min_dist_10_post1 = c.min_dist_10#c.post1
egen ind_time = group(industry prov_id time)
reg2hdfespatial any_air min_dist_10_post1, lat(lat) lon(lon) timevar(time) panelvar(id) altfetime(ind_time) distcutoff(100) lagcutoff(20)
scalar Conley1 = _se[min_dist_10_post1]
reg2hdfespatial any_air_shutdown min_dist_10_post1, lat(lat) lon(lon) timevar(time) panelvar(id) altfetime(ind_time) distcutoff(100) lagcutoff(20)
scalar Conley2 = _se[min_dist_10_post1]
reg2hdfespatial any_air_renovate min_dist_10_post1, lat(lat) lon(lon) timevar(time) panelvar(id) altfetime(ind_time) distcutoff(100) lagcutoff(20)
scalar Conley3 = _se[min_dist_10_post1]
reg2hdfespatial any_air_fine min_dist_10_post1, lat(lat) lon(lon) timevar(time) panelvar(id) altfetime(ind_time) distcutoff(100) lagcutoff(20)
scalar Conley4 = _se[min_dist_10_post1]
reg2hdfespatial any_air_warning min_dist_10_post1, lat(lat) lon(lon) timevar(time) panelvar(id) altfetime(ind_time) distcutoff(100) lagcutoff(20)
scalar Conley5 = _se[min_dist_10_post1]
use "$data_files/firm_enf.dta", clear
drop if revenue == .
drop if key == .
label var min_dist_10 "Mon\$\_{<10km}\$"
label var any_air "Any Enforcement (0/1)"
label var post "Post"
label var key "High Pollution"
eststo clear
reghdfe any_air c.min_dist_10#c.post1 if min_dist<50 & starty<=2010, absorb(time id industry#time prov_id#time) cluster(city_id)
eststo A
estadd ysumm, mean
estadd scalar EN = e(N_full)
estadd local Conley = "[`: di %9.5f Conley1']"
reghdfe any_air_shutdown c.min_dist_10#c.post1 if min_dist<50 & starty<=2010, absorb(time id industry#time prov_id#time) cluster(city_id)
eststo B
estadd ysumm, mean
estadd scalar EN = e(N_full)
estadd local Conley = "[`: di %9.5f Conley2']"
reghdfe any_air_renovate c.min_dist_10#c.post1 if min_dist<50 & starty<=2010, absorb(time id industry#time prov_id#time) cluster(city_id)
eststo C
estadd ysumm, mean
estadd scalar EN = e(N_full)
estadd local Conley = "[`: di %9.5f Conley3']"
reghdfe any_air_fine c.min_dist_10#c.post1 if min_dist<50 & starty<=2010, absorb(time id industry#time prov_id#time) cluster(city_id)
eststo D
estadd ysumm, mean
estadd scalar EN = e(N_full)
estadd local Conley = "[`:di %9.5f Conley4']"
reghdfe any_air_warning c.min_dist_10#c.post1 if min_dist<50 & starty<=2010, absorb(time id industry#time prov_id#time) cluster(city_id)
eststo E
estadd ysumm, mean
estadd scalar EN = e(N_full)
estadd local Conley = "[`:di %9.5f Conley5']"
esttab A B C D E using "$out_files/Table1a.tex", replace b(a2) noconstant se(a2) nolines nogaps compress fragment nonumbers label mlabels(none) collabels() keep(c.min_dist_10*) stats(ymean EN Conley, labels("Mean Outcome" "Observations" "Conley SE")) starlevels(* 0.10 ** 0.05 *** 0.01) substitute(\_ _) tex
* Table 1b
use "$data_files/firm_enf.dta", clear
drop if revenue == .
drop if key == .
label var min_dist_10 "Mon\$\_{<10km}\$"
label var any_air "Any Enforcement (0/1)"
label var post "Post"
label var key "High Pollution"
eststo clear
reghdfe air c.min_dist_10#c.post1##c.key if min_dist<50 & starty<=2010, absorb(time id industry#time prov_id#time) cluster(city_id)
eststo A
estadd ysumm, mean
estadd scalar EN = e(N_full)
reghdfe air_1 c.min_dist_10#c.post1##c.key if min_dist<50 & starty<=2010, absorb(time id industry#time prov_id#time) cluster(city_id)
eststo B
estadd ysumm, mean
estadd scalar EN = e(N_full)
reghdfe air_2 c.min_dist_10#c.post1##c.key if min_dist<50 & starty<=2010, absorb(time id industry#time prov_id#time) cluster(city_id)
eststo C
estadd ysumm, mean
estadd scalar EN = e(N_full)
reghdfe leni c.min_dist_10#c.post1##c.key if min_dist<50 & starty<=2010, absorb(time id industry#time prov_id#time) cluster(city_id)
eststo D
estadd ysumm, mean
estadd scalar EN = e(N_full)
reghdfe stri c.min_dist_10#c.post1##c.key if min_dist<50 & starty<=2010, absorb(time id industry#time prov_id#time) cluster(city_id)
eststo E
estadd ysumm, mean
estadd scalar EN = e(N_full)
esttab A B C D E using "$out_files/Table1b.tex", replace b(a2) noconstant se(a2) nolines nogaps compress fragment nonumbers label mlabels(none) collabels() keep(c.min_dist_10*) stats(ymean EN, labels("Mean Outcome" "Observations")) starlevels(* 0.10 ** 0.05 *** 0.01) substitute(\_ _) tex
* Table 2
gen Shock = high_pre
eststo clear
reghdfe any_air c.min_dist_10#c.post1##c.Shock tem_mean if min_dist<50 & starty<=2010, absorb(time id industry#time prov_id#time) cluster(city_id)
eststo A
estadd ysumm, mean
estadd scalar EN = e(N_full)
reghdfe any_air c.min_dist_10##c.post1##c.Shock tem_mean if min_dist<50 & starty<=2010, absorb(time id industry#time prov_id#time) cluster(city_id)
eststo B
estadd ysumm, mean
estadd scalar EN = e(N_full)
replace Shock = upwd
reghdfe any_air c.min_dist_10#c.post1##c.Shock tem_mean if min_dist<50 & starty<=2010, absorb(time id industry#time prov_id#time) cluster(city_id)
eststo C
estadd ysumm, mean
estadd scalar EN = e(N_full)
reghdfe any_air c.min_dist_10##c.post1##c.Shock tem_mean if min_dist<50 & starty<=2010, absorb(time id industry#time prov_id#time) cluster(city_id)
eststo D
estadd ysumm, mean
estadd scalar EN = e(N_full)
esttab A B C D using "$out_files/Table2.tex", replace b(a2) noconstant se(a2) nolines nogaps compress fragment nonumbers label mlabels(none) collabels() keep() drop(_cons tem_mean post1 min_dist_10) order(Shock c.min_dist_10#c.post1 c.min_dist_10#c.Shock c.min_dist_10#c.post1#c.Shock) stats(ymean EN, labels("Mean Outcome" "Observations")) starlevels(* 0.10 ** 0.05 *** 0.01) substitute(\_ _) tex
**==============================================================================
* Table 3
use "$data_files/city_pm.dta", clear
label variable post1 "Post"
label variable number "\# Mon"
label variable number_iv "Min \# Mon"
gen RD_Estimate = c.post1#c.number
eststo clear
reghdfe pm25 RD_Estimate c.post#c.area c.post#c.pop, a(city_id year#month pred tem_meand age_year incentive2#time) cluster(city_id)
estadd scalar EN = e(N_full)
eststo A
ivreghdfe pm25 c.post#c.area c.post#c.pop (RD_Estimate=c.post1#c.number_iv), a(city_id year#month pred tem_meand age_year incentive2#time) cluster(city_id)
estadd scalar EN = e(N_full)
eststo B
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)
gen above = dist1 > 0
gen RD_Estimate = c.post1#c.above
rdrobust pm25 dist1 if year>=2015, fuzzy(number) p(1) h(11.3) covs(cutoff mean_bench year month) kernel(uni) vce(cluster city_id)
estadd scalar EN = e(N_h_l) + e(N_h_r)
estadd scalar band = e(h_l)
eststo C
reghdfe pm25 RD_Estimate post1 above dist1 c.post1#c.dist1 c.above#c.dist1 c.post#c.above#c.dist1 cutoff if abs(dist1) < 11.3, a(time) cl(city_id)
estadd scalar EN = e(N)
estadd scalar band = 11.3
eststo D
esttab A B C D using "$out_files/Table3a.tex", keep(RD_Estimate) transform(@/1.21 1/1.21, pattern(0 0 0 1)) replace b(a2) se(a2) label noconstant nolines nogaps compress fragment nonumbers mlabels(none) coeflabels(RD_Estimate "\# Monitors") stats(EN, labels( "Observations")) starlevels(* 0.10 ** 0.05 *** 0.01) tex
use "$data_files/city_enf.dta", clear
label variable post1 "Post"
label variable number "\# Mon"
label variable number_iv "Min \# Mon"
gen RD_Estimate = c.post1#c.number
eststo clear
reghdfe log_any_air RD_Estimate c.post#c.area c.post#c.pop, a(city_id year#quarter pred tem_meand age_year incentive2#time) cluster(city_id)
estadd scalar EN = e(N_full)
eststo A
ivreghdfe log_any_air c.post#c.area c.post#c.pop (RD_Estimate=c.post1#c.number_iv), a(city_id year#quarter pred tem_meand age_year incentive2#time) cluster(city_id)
estadd scalar EN = e(N_full)
eststo B
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)
gen above = dist1 > 0
gen RD_Estimate = c.post1#c.above
rdrobust log_any_air dist1 if year>=2015, fuzzy(number) p(1) h(11.3) covs(cutoff mean_bench year quarter) kernel(uni) vce(cluster city_id)
estadd scalar EN = e(N_h_l) + e(N_h_r)
estadd scalar band = e(h_l)
eststo C
reghdfe log_any_air RD_Estimate post1 above dist1 c.post1#c.dist1 c.above#c.dist1 c.post1#c.above#c.dist1 cutoff if abs(dist1) < 11.3, a(time) cl(city_id)
estadd scalar EN = e(N)
estadd scalar band = 11.3
eststo D
esttab A B C D using "$out_files/Table3b.tex", tex keep(RD_Estimate) transform(@/1.21 1/1.21, pattern(0 0 0 1)) replace b(a2) se(a2) label noconstant nolines nogaps compress fragment nonumbers mlabels(none) coeflabels(RD_Estimate "\# Monitors") stats(EN, labels("Observations")) starlevels(* 0.10 ** 0.05 *** 0.01)
replace RD_Estimate = number_iv
eststo clear
regress number number_iv if year>=2015, vce(cluster city_id)
eststo A
regress number RD_Estimate pop area if year>=2015, vce(cluster city_id)
eststo B
rdrobust number dist1 if year>=2015, p(1) h(11.3) covs(cutoff) kernel(uni) vce(cluster city_id)
eststo C
estadd local kern = "Uniform"
estadd scalar band = 11.3
rdrobust number dist1 if year>=2015, p(1) h(11.3) covs(cutoff) kernel(uni) vce(cluster city_id)
eststo D
estadd local kern = "Uniform"
estadd scalar band = 11.3
esttab A B C D using "$out_files/Table3c.tex", tex replace b(a2) se(a2) label noconstant nolines nogaps compress fragment nonumbers noobs mlabels(none) keep(RD_Estimate) coeflabels(RD_Estimate "Estimate") stats(kern band, labels("Kernel" "Bandwidth")) starlevels(* 0.10 ** 0.05 *** 0.01)
**==============================================================================
* Table 4
use "$data_files/monitor_api.dta", clear
gen log_pm25api = log(pm25api)
gen log_pm10api = log(pm10api)
gen reassign = (year == 2017)
replace reassign = 1 if year == 2016 & month >= 11
rename pm25 AOD
label variable AOD "AOD"
label variable reassign "Reassigned"
eststo clear
reghdfe log_pm25api AOD pre tem_mean, a(monitor_id year#month) cl(city_id)
eststo A
estadd ysumm, mean
reghdfe log_pm25api AOD pre tem_mean if ~compare, a(monitor_id year#month) cl(city_id)
eststo B
estadd ysumm, mean
reghdfe log_pm25api AOD c.AOD#c.reassign pre tem_mean if ~compare, a(monitor_id year#month) cl(city_id)
eststo C
estadd ysumm, mean
reghdfe log_pm25api AOD pre tem_mean if compare, a(monitor_id year#month) cl(city_id)
eststo D
estadd ysumm, mean
reghdfe log_pm25api AOD c.AOD#c.reassign pre tem_mean if compare, a(monitor_id year#month) cl(city_id)
eststo E
estadd ysumm, mean
use "$data_files/city_pm.dta", clear
label variable post1 "Post"
label variable number "\# Mon"
gen reassign = (year == 2017)
replace reassign = 1 if year == 2016 & month >= 10
label variable reassign "Reassigned"
reghdfe pm25 c.post1#c.number c.post1#c.number#c.reassign c.post1#c.area c.post1#c.pop, a(city_id year#month pred tem_meand age_year incentive2#time) cluster(city_id)
eststo F
estadd ysumm, mean
use "$data_files/city_enf.dta", clear
label variable post1 "Post"
label variable number "\# Mon"
gen reassign = (year == 2017)
replace reassign = 1 if year == 2016 & quarter == 4
label variable reassign "Reassigned"
reghdfe log_any_air c.post1#c.number c.post1#c.number#c.reassign c.post1#c.area c.post1#c.pop, a(city_id year#quarter pred tem_meand age_year incentive2#time) cluster(city_id)
eststo G
estadd ysumm, mean
esttab A B C D E F G using "$out_files/Table4.tex", replace b(a2) noconstant se(a2) nolines nogaps compress fragment nonumbers label mlabels(none) collabels() keep(AOD c.AOD#c.reassign c.post1#c.number c.post1#c.number#c.reassign) drop() coeflabels(c.AOD#c.reassign "AOD $\times$ Reassigned" c.post1#c.number "\# Monitors" c.post1#c.number#c.reassign "\# Monitors $\times$ Reassigned") stats(ymean N, labels("Mean Outcome" "Observations")) starlevels(* 0.10 ** 0.05 *** 0.01) substitute(\_ _) tex
|