anonymous-submission-acl2025 commited on
Commit
cfce9ef
·
1 Parent(s): 9c666aa
Files changed (32) hide show
  1. 9/paper.pdf +3 -0
  2. 9/replication_package/Ado/brain.ado +772 -0
  3. 9/replication_package/Code/FS.do +139 -0
  4. 9/replication_package/Code/Figures.do +150 -0
  5. 9/replication_package/Code/MASTER.do +14 -0
  6. 9/replication_package/Code/NOAA Weather Data (NEW!)/Alt_weather_var_v1.do +587 -0
  7. 9/replication_package/Code/NOAA Weather Data (NEW!)/NOAA_download.R +28 -0
  8. 9/replication_package/Code/Prepare_Data.do +325 -0
  9. 9/replication_package/Code/Prepare_Data_New.do +447 -0
  10. 9/replication_package/Code/TS.do +301 -0
  11. 9/replication_package/Code/TS_NEW_1.do +393 -0
  12. 9/replication_package/Code/Tables.do +163 -0
  13. 9/replication_package/Code/Tables_NEW_1.do +503 -0
  14. 9/replication_package/Code/Tables_NEW_2.do +436 -0
  15. 9/replication_package/Data/aod_month.dta +3 -0
  16. 9/replication_package/Data/city_info.dta +3 -0
  17. 9/replication_package/Data/city_info_rd.dta +3 -0
  18. 9/replication_package/Data/city_month.dta +3 -0
  19. 9/replication_package/Data/did_ddl_match.dta +3 -0
  20. 9/replication_package/Data/mask_filter_search.dta +3 -0
  21. 9/replication_package/Data/pm10_corrected_reference.dta +3 -0
  22. 9/replication_package/Data/pollution.csv +3 -0
  23. 9/replication_package/Data/pollution_1116.dta +3 -0
  24. 9/replication_package/Data/search_sale.dta +3 -0
  25. 9/replication_package/Data/station_day_1116.dta +3 -0
  26. 9/replication_package/Data/station_list.dta +3 -0
  27. 9/replication_package/Data/station_month.dta +3 -0
  28. 9/replication_package/Data/weather_1116.dta +3 -0
  29. 9/replication_package/Data/weather_1116_alt.dta +3 -0
  30. 9/replication_package/README.pdf +3 -0
  31. 9/replication_package/Readme_new.txt +3 -0
  32. 9/should_reproduce.txt +3 -0
9/paper.pdf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:cd9e664c51fc3fb20dfd0ba909c148b3cab68aaaa60c800038ebc3b8b44d79f1
3
+ size 838205
9/replication_package/Ado/brain.ado ADDED
@@ -0,0 +1,772 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ cap program drop brain
2
+ program define brain, rclass
3
+ version 9.0
4
+ syntax anything(id="command") [if] [in], [Hidden(numlist)] [INput(varlist)] [Output(varlist)] [ITer(integer 0)] [Eta(real 0.25)] [Spread(real 0.5)] [RAW] [NOSort]
5
+ token `"`anything'"'
6
+ if length(`"`1'"') < 2 {
7
+ di as error "invalid brain command"
8
+ error 999
9
+ }
10
+ if `"`1'"' == substr("define",1,length(`"`1'"')) {
11
+ if `"`input'"' == "" {
12
+ di as error "no input variables specified"
13
+ error 999
14
+ }
15
+ if `"`output'"' == "" {
16
+ di as error "no output variables specified"
17
+ error 999
18
+ }
19
+ local inp = wordcount(`"`input'"')
20
+ local out = wordcount(`"`output'"')
21
+ local hidden = `"`inp' `hidden' `out'"'
22
+ token `"`hidden'"'
23
+ local layer = ""
24
+ local i = 1
25
+ while "``i''" != "" {
26
+ cap confirm integer number ``i''
27
+ if _rc > 0 {
28
+ di as error "invalid layer number"
29
+ error 999
30
+ }
31
+ if ``i'' <= 0 {
32
+ di as error "invalid layer definition"
33
+ error 999
34
+ }
35
+ local layer = `"`layer',``i''"'
36
+ local i = `i' + 1
37
+ }
38
+ local layer = "("+substr(`"`layer'"',2,.)+")"
39
+ matrix layer = `layer'
40
+ if wordcount(`"`input'"') != layer[1,1] {
41
+ di as error "invalid number of input variables, " layer[1,1] " required"
42
+ matrix drop layer
43
+ error 999
44
+ }
45
+ if wordcount(`"`output'"') != layer[1,colsof(layer)] {
46
+ di as error "invalid number of output variables, " layer[1,colsof(layer)] " required"
47
+ matrix drop layer
48
+ error 999
49
+ }
50
+ matrix input = J(4,layer[1,1],0)
51
+ local i = 1
52
+ foreach v of varlist `input' {
53
+ qui sum `v' `if' `in'
54
+ matrix input[1,`i'] = r(min)
55
+ matrix input[2,`i'] = 1 / (r(max) - r(min))
56
+ if input[2,`i'] == . {
57
+ matrix input[2,`i'] = 1
58
+ }
59
+ local i = `i'+1
60
+ }
61
+ matrix colnames input = `input'
62
+ matrix rownames input = min norm value signal
63
+ matrix output = J(4,layer[1,colsof(layer)],0)
64
+ local i = 1
65
+ foreach v of varlist `output' {
66
+ qui sum `v' `if' `in'
67
+ matrix output[1,`i'] = r(min)
68
+ matrix output[2,`i'] = 1 / (r(max) - r(min))
69
+ if output[2,`i'] == . {
70
+ matrix output[2,`i'] = 1
71
+ }
72
+ local i = `i'+1
73
+ }
74
+ matrix colnames output = `output'
75
+ matrix rownames output = min norm value signal
76
+ braincreate
77
+ braininit `spread'
78
+ di as text "Defined matrices:"
79
+ braindir
80
+ exit
81
+ }
82
+ if `"`1'"' == substr("save",1,length("`1'")) {
83
+ if `"`2'"' == "" {
84
+ di as error "no file specified"
85
+ error 999
86
+ }
87
+ local using = `"`2'"'
88
+ tempname save
89
+ cap local layer = colsof(layer)
90
+ if _rc > 0 {
91
+ di as error "no network defined"
92
+ error 999
93
+ }
94
+ cap local size = colsof(brain)
95
+ if _rc > 0 {
96
+ di as error "no network defined"
97
+ error 999
98
+ }
99
+ cap local isize = colsof(input)
100
+ if _rc > 0 {
101
+ di as error "no network defined"
102
+ error 999
103
+ }
104
+ cap local osize = colsof(output)
105
+ if _rc > 0 {
106
+ di as error "no network defined"
107
+ error 999
108
+ }
109
+ local using = subinstr(trim(`"`using'"'),"\","/",.)
110
+ if regex(`"`using'?"',"\.[^/]*\?") == 0 {
111
+ local using = `"`using'.brn"'
112
+ }
113
+ qui file open `save' using `"`using'"', write binary replace
114
+ file write `save' %9s `"braindead"'
115
+ file write `save' %4bu (`layer')
116
+ forvalue i = 1/`layer' {
117
+ file write `save' %4bu (layer[1,`i'])
118
+ }
119
+ local names : colnames input
120
+ local len = length(`"`names'"')
121
+ file write `save' %4bu (`len')
122
+ file write `save' %`len's `"`names'"'
123
+ local isize = layer[1,1]
124
+ forvalue i = 1/`isize' {
125
+ file write `save' %8z (input[1,`i'])
126
+ file write `save' %8z (input[2,`i'])
127
+ }
128
+ local names : colnames output
129
+ local len = length(`"`names'"')
130
+ file write `save' %4bu (`len')
131
+ file write `save' %`len's `"`names'"'
132
+ local osize = layer[1,colsof(layer)]
133
+ forvalue i = 1/`osize' {
134
+ file write `save' %8z (output[1,`i'])
135
+ file write `save' %8z (output[2,`i'])
136
+ }
137
+ forvalue i = 1/`size' {
138
+ file write `save' %8z (brain[1,`i'])
139
+ }
140
+ file close `save'
141
+ exit
142
+ }
143
+ if "`1'" == substr("load",1,length("`1'")) {
144
+ if `"`2'"' == "" {
145
+ di as error "no file specified"
146
+ error 999
147
+ }
148
+ local using = `"`2'"'
149
+ tempname load bin
150
+ local using = subinstr(trim(`"`using'"'),"\","/",.)
151
+ if regex(`"`using'?"',"\.[^/]*\?") == 0 {
152
+ local using = "`using'.brn"
153
+ }
154
+ file open `load' using `"`using'"', read binary
155
+ file read `load' %9s str
156
+ if `"`str'"' != "braindead" {
157
+ di as error "invalid file format"
158
+ file close `load'
159
+ error 999
160
+ }
161
+ file read `load' %4bu `bin'
162
+ local layer = `bin'
163
+ matrix layer = J(1,`layer',0)
164
+ forvalue i = 1/`layer' {
165
+ file read `load' %4bu `bin'
166
+ if r(eof) {
167
+ di as error "invalid file format"
168
+ file close `load'
169
+ error 999
170
+ }
171
+ matrix layer[1,`i'] = `bin'
172
+ }
173
+ file read `load' %4bu `bin'
174
+ local len = `bin'
175
+ file read `load' %`len's str
176
+ local layer = layer[1,1]
177
+ matrix input = J(4,`layer',0)
178
+ matrix colnames input = `str'
179
+ matrix rownames input = min norm value signal
180
+ forvalue i = 1/`layer' {
181
+ file read `load' %8z `bin'
182
+ matrix input[1,`i'] = `bin'
183
+ file read `load' %8z `bin'
184
+ matrix input[2,`i'] = `bin'
185
+ }
186
+ file read `load' %4bu `bin'
187
+ local len = `bin'
188
+ file read `load' %`len's str
189
+ local layer = layer[1,colsof(layer)]
190
+ matrix output = J(4,`layer',0)
191
+ matrix colnames output = `str'
192
+ matrix rownames output = min norm value signal
193
+ forvalue i = 1/`layer' {
194
+ file read `load' %8z `bin'
195
+ matrix output[1,`i'] = `bin'
196
+ file read `load' %8z `bin'
197
+ matrix output[2,`i'] = `bin'
198
+ }
199
+ braincreate
200
+ local size = colsof(brain)
201
+ local i = 0
202
+ while 1 {
203
+ file read `load' %8z `bin'
204
+ if r(eof) {
205
+ continue, break
206
+ }
207
+ local i = `i'+1
208
+ if `i' > `size' {
209
+ di as error "invalid file format"
210
+ file close `load'
211
+ error 999
212
+ }
213
+ matrix brain[1,`i'] = `bin'
214
+ }
215
+ if `i' < `size' {
216
+ di as error "invalid file format"
217
+ file close `load'
218
+ error 999
219
+ }
220
+ file close `load'
221
+ di as text "Loaded matrices:"
222
+ braindir
223
+ exit
224
+ }
225
+ if `"`1'"' == substr("feed",1,length("`1'")) {
226
+ macro shift
227
+ tempname output
228
+ local isize = colsof(input)
229
+ local osize = colsof(output)
230
+ local ostart = colsof(neuron)-`osize'+1
231
+ local wc = wordcount(`"`*'"')
232
+ if `wc' != `isize' {
233
+ di as error "number of values does not match input neurons (`wc' <> `isize')"
234
+ error 999
235
+ }
236
+ foreach v in `*' {
237
+ cap confirm number `v'
238
+ if _rc != 0 {
239
+ di as error "invalid value: `v'"
240
+ error 999
241
+ }
242
+ }
243
+ local i = 1
244
+ if `"`raw'"' == "" {
245
+ while `"``i''"' != "" {
246
+ matrix input[3,`i'] = ``i''
247
+ local i = `i'+1
248
+ }
249
+ forvalue i = 1/`isize' {
250
+ matrix input[4,`i'] = max(min((input[3,`i']-input[1,`i']) * input[2,`i'],1),0)
251
+ matrix neuron[1,`i'] = input[4,`i']
252
+ }
253
+ }
254
+ else {
255
+ while `"``i''"' != "" {
256
+ matrix input[4,`i'] = max(min(``i'',1),0)
257
+ local i = `i'+1
258
+ }
259
+ forvalue i = 1/`isize' {
260
+ matrix input[3,`i'] = input[4,`i'] / input[2,`i'] + input[1,`i']
261
+ matrix neuron[1,`i'] = input[4,`i']
262
+ }
263
+ }
264
+ mata: brainforward()
265
+ mata: brainoutputget(0)
266
+ matrix `output' = output[3..4,1...]
267
+ matrix list `output', noheader format(%18.9f)
268
+ return matrix output = `output'
269
+ exit
270
+ }
271
+ if `"`1'"' == substr("signal",1,length("`1'")) {
272
+ macro shift
273
+ tempname signal
274
+ local isize = colsof(input)
275
+ local osize = colsof(output)
276
+ local ostart = colsof(neuron)-`osize'+1
277
+ local nsize = colsof(neuron)
278
+ local inames : colnames input
279
+ local onames : colnames output
280
+ matrix `signal' = J(`isize'+1, `osize', 0)
281
+ matrix colnames `signal' = `onames'
282
+ matrix rownames `signal' = `inames' flatline
283
+ matrix neuron[1, 1] = J(1,`isize', 0)
284
+ mata: brainforward()
285
+ mata: brainoutputget(0)
286
+ if "`raw'" == "" {
287
+ matrix `signal'[`isize'+1,1] = output[3,1...]
288
+ }
289
+ else {
290
+ matrix `signal'[`isize'+1,1] = output[4,1...]
291
+ }
292
+ forvalue i = 1/`isize' {
293
+ matrix neuron[1, 1] = J(1,`isize', 0)
294
+ matrix neuron[1, `i'] = 1
295
+ mata: brainforward()
296
+ if `"`raw'"' == "" {
297
+ forvalue j = 1/`osize' {
298
+ local k = `ostart'+`j'-1
299
+ matrix `signal'[`i',`j'] = neuron[1,`k'] / output[2,`j'] + output[1,`j']
300
+ matrix `signal'[`i',`j'] = `signal'[`i',`j'] - output[3,`j']
301
+ }
302
+ }
303
+ else {
304
+ forvalue j = 1/`osize' {
305
+ local k = `ostart'+`j'-1
306
+ matrix `signal'[`i',`j'] = neuron[1,`k'] - output[4,`j']
307
+ }
308
+ }
309
+ }
310
+ matrix list `signal', noheader format(%18.9f)
311
+ return matrix signal = `signal'
312
+ exit
313
+ }
314
+ if `"`1'"' == substr("margin",1,length("`1'")) {
315
+ tempname signal
316
+ tempvar delta nouse
317
+ macro shift
318
+ local inames : colnames input
319
+ local onames : colnames output
320
+ local mnames = "`inames'"
321
+ local osize = colsof(output)
322
+ local isize = colsof(input)
323
+ local msize = `isize'
324
+ if `"`*'"' != "" {
325
+ local mnames = ""
326
+ local msize = 0
327
+ foreach v of varlist `*' {
328
+ if index(" `inames' ", " `v' ") == 0 {
329
+ di as error "invalid input variable `v'"
330
+ error 999
331
+ }
332
+ if index(" `mnames' "," `v' ") > 0 {
333
+ di as error "input variable `v' already defined"
334
+ error 999
335
+ }
336
+ local mnames = "`mnames' `v'"
337
+ local msize = `msize'+1
338
+ }
339
+ }
340
+ qui des, varlist
341
+ local names = r(varlist)
342
+ qui gen byte `nouse' = 1
343
+ qui replace `nouse' = 0 `in' `if'
344
+ local snames = subinstr(`"`inames',`onames'"'," ",",",.)
345
+ qui replace `nouse' = 1 `in' if `nouse' == 0 & missing(`snames')
346
+ local snames = ""
347
+ local bnames = ""
348
+ forvalue o = 1/`osize' {
349
+ tempvar signal`o' base`o'
350
+ qui gen double `signal`o'' = .
351
+ qui gen double `base`o'' = .
352
+ local snames = "`snames' `signal`o''"
353
+ local bnames = "`bnames' `base`o''"
354
+ }
355
+ qui gen double `delta' = .
356
+ matrix `signal' = J(`msize',`osize',0)
357
+ matrix rownames `signal' = `mnames'
358
+ local cnames = ""
359
+ forvalue o = 1/`osize' {
360
+ local oname = word("`onames'", `o')
361
+ local cnames = "`cnames' `oname'"
362
+ }
363
+ di as text "unrestricted " _continue
364
+ matrix colnames `signal' = `cnames'
365
+ order `inames' `bnames' `nouse'
366
+ mata: brainsignal(0)
367
+ order `inames' `snames' `nouse'
368
+ local ind = 0
369
+ foreach v of varlist `mnames' {
370
+ forvalue i = 1/`isize' {
371
+ local iname = word("`inames'", `i')
372
+ if "`v'" == "`iname'" {
373
+ di as result "`iname' " _continue
374
+ mata: brainsignal(`i')
375
+ local ind = `ind' + 1
376
+ forvalue o = 1/`osize' {
377
+ local oname = word("`onames'", `o')
378
+ qui replace `delta' = `base`o''-`signal`o'' if `nouse' == 0
379
+ qui sum `delta' if `nouse' == 0
380
+ matrix `signal'[`ind',`o'] = r(mean)
381
+ }
382
+ continue, break
383
+ }
384
+ }
385
+ }
386
+ order `names'
387
+ di ""
388
+ matrix list `signal', noheader format(%18.9f)
389
+ return matrix margin = `signal'
390
+ exit
391
+ }
392
+ if `"`1'"' == substr("think",1,length("`1'")) {
393
+ tempvar nouse
394
+ macro shift
395
+ local wc = wordcount(`"`*'"')
396
+ local osize = colsof(output)
397
+ if `wc' != `osize' {
398
+ di as error "number of target variables does not match output neurons (`wc' <> `osize')"
399
+ error 999
400
+ }
401
+ foreach v in `*' {
402
+ cap drop `v'
403
+ qui gen double `v' = .
404
+ }
405
+ qui des, varlist
406
+ local names = r(varlist)
407
+ qui gen byte `nouse' = 1
408
+ qui replace `nouse' = 0 `in' `if'
409
+ local inames : colnames input
410
+ local mnames = subinstr(`"`inames'"'," ",",",.)
411
+ qui replace `nouse' = 1 `in' if `nouse' == 0 & missing(`mnames')
412
+ local mnames = ""
413
+ order `inames' `*' `nouse'
414
+ mata: brainthink()
415
+ order `names'
416
+ exit
417
+ }
418
+ if `"`1'"' == substr("train",1,length("`1'")) {
419
+ tempvar nouse rnd
420
+ if `eta' < 0 {
421
+ di as error "eta has to be a number larger equal zero"
422
+ error 999
423
+ }
424
+ if `iter' < 0 {
425
+ di as error "number of iterations has to be larger equal zero"
426
+ error 999
427
+ }
428
+ qui des, varlist
429
+ local names = r(varlist)
430
+ qui gen byte `nouse' = 1
431
+ qui replace `nouse' = 0 `in' `if'
432
+ local inames : colnames input
433
+ local onames : colnames output
434
+ local mnames = subinstr(`"`inames',`onames'"'," ",",",.)
435
+ qui replace `nouse' = 1 `in' if `nouse' == 0 & missing(`mnames')
436
+ local mnames = ""
437
+ if `"`nosort'"' != "" {
438
+ sort `nouse'
439
+ }
440
+ else {
441
+ qui gen double `rnd' = uniform()
442
+ sort `nouse' `rnd'
443
+ }
444
+ qui count if `nouse' == 0
445
+ local N = r(N)
446
+ order `inames' `onames'
447
+ local err = 0
448
+ local prev = .
449
+ di as text "{hline 40}"
450
+ di as text "Brain{dup 7: }Number of obs = " as result %12.0fc `N'
451
+ di as text "Train{dup 17: }eta = " as result %12.6f `eta'
452
+ di as text "{hline 10}{c TT}{hline 14}{c TT}{hline 14}
453
+ di as text "Iteration {c |} Error {c |} Delta"
454
+ di as text "{hline 10}{c +}{hline 14}{c +}{hline 14}"
455
+ forvalue i = 1/`iter' {
456
+ mata: braintrain(`eta', `N')
457
+ local err = r(error)/`N'/colsof(output)
458
+ local delta = `err'-`prev'
459
+ local prev = `err'
460
+ di as result %9.0f `i' as text " {c |} " as result %12.9f `err' as text " {c |} " as result %12.9f `delta'
461
+ }
462
+ mata: braintrain(0, `N')
463
+ local err = r(error)/`N'/colsof(output)
464
+ local delta = `err'-`prev'
465
+ if `iter' == 0 {
466
+ di as result " current" as text " {c |} " as result %12.9f `err' as text " {c |} " as result %12.9f `delta'
467
+ }
468
+ else {
469
+ di as text "{hline 10}{c +}{hline 14}{c +}{hline 14}"
470
+ di as result " final" as text " {c |} " as result %12.9f `err' as text " {c |} " as result %12.9f `delta'
471
+ }
472
+ order `names'
473
+ di as text "{hline 10}{c BT}{hline 14}{c BT}{hline 14}"
474
+ return scalar N = `N'
475
+ return scalar err = `err'
476
+ exit
477
+ }
478
+ di as error "invalid brain command"
479
+ error 999
480
+ end
481
+
482
+ cap program drop braindir
483
+ program define braindir
484
+ di as result " input[" rowsof(input) "," colsof(input) "]"
485
+ di as result " output[" rowsof(output) "," colsof(output) "]"
486
+ di as result " neuron[" rowsof(neuron) "," colsof(neuron) "]"
487
+ di as result " layer[" rowsof(layer) "," colsof(layer) "]"
488
+ di as result " brain[" rowsof(brain) "," colsof(brain) "]"
489
+ end
490
+
491
+ cap program drop braincreate
492
+ program define braincreate
493
+ local names = ""
494
+ local size = 0
495
+ local layer = colsof(layer)
496
+ forvalue l = 2/`layer' {
497
+ local p = `l'-1
498
+ local neurons = layer[1,`l']
499
+ local weights = layer[1,`p']
500
+ local size = `size' + `neurons' * (`weights'+1)
501
+ if `l' < `layer' {
502
+ local prefix = "h`p'n"
503
+ }
504
+ else {
505
+ local prefix = "o"
506
+ }
507
+ forvalue n = 1/`neurons' {
508
+ forvalue w = 1/`weights' {
509
+ local names = "`names' `prefix'`n'w`w'"
510
+ }
511
+ local names = "`names' `prefix'`n'b"
512
+ }
513
+ }
514
+ cap matrix brain = J(1,`size',0)
515
+ if _rc > 0 {
516
+ local matsize = int(`size'*1.1)
517
+ set matsize `matsize'
518
+ matrix brain = J(1,`size',0)
519
+ }
520
+ matrix colnames brain = `names'
521
+ matrix rownames brain = weight
522
+ local names = "in"
523
+ local layer = `layer'-2
524
+ forvalue l = 1/`layer' {
525
+ local names = "`names' hid`l'"
526
+ }
527
+ local names = "`names' out"
528
+ matrix colnames layer = `names'
529
+ matrix rownames layer = neurons
530
+ local layer = colsof(layer)
531
+ local names = ""
532
+ local size = 0
533
+ forvalue i = 1/`layer' {
534
+ local neurons = layer[1,`i']
535
+ local size = `size'+`neurons'
536
+ if `i' == 1 {
537
+ local prefix = "in"
538
+ }
539
+ else if `i' == `layer' {
540
+ local prefix = "out"
541
+ }
542
+ else {
543
+ local j = `i'-1
544
+ local prefix = "h`j'n"
545
+ }
546
+ forvalue j = 1/`neurons' {
547
+ local names = "`names' `prefix'`j'"
548
+ }
549
+ }
550
+ matrix neuron = J(1,`size',0)
551
+ matrix colnames neuron = `names'
552
+ matrix rownames neuron = signal
553
+ end
554
+
555
+ cap program drop braininit
556
+ program define braininit
557
+ local spread = abs(`1')
558
+ local range = `spread'*2
559
+ local size = colsof(brain)
560
+ forvalue i = 1/`size' {
561
+ matrix brain[1,`i'] = uniform()*`range'-`spread'
562
+ }
563
+ end
564
+
565
+ mata:
566
+
567
+ void braininp(real scalar obs, real matrix input, real matrix neuron)
568
+ { real matrix inp3, inp4, mm
569
+ real scalar i, icnt, ncnt
570
+ icnt = cols(input)
571
+ ncnt = cols(neuron)
572
+ inp3 = st_data(obs, 1..icnt)
573
+ inp4 = (inp3[1, .] - input[1, .]) :* input[2, .]
574
+ mm = minmax(inp4)
575
+ if (mm[1,1] < 0 | mm[1,2] > 1)
576
+ { for (i = 1; i <= icnt; i++)
577
+ { if (inp4[1, i] < 0) inp4[1, i] = 0
578
+ if (inp4[1, i] > 1) inp4[1, i] = 1
579
+ }
580
+ }
581
+ neuron = inp4[1,.], neuron[1,icnt+1..ncnt]
582
+ input = input[1::2,.] \ inp3 \ inp4
583
+ }
584
+
585
+ void brainoutputget(real scalar obs)
586
+ { real matrix output
587
+ output = st_matrix("output")
588
+ brainoutget(obs, cols(st_matrix("input")), st_matrix("neuron"), output)
589
+ st_replacematrix("output", output)
590
+ }
591
+
592
+ void brainoutputset(real scalar obs)
593
+ { real matrix output
594
+ output = st_matrix("output")
595
+ brainoutset(obs, cols(st_matrix("input")), output)
596
+ st_replacematrix("output", output)
597
+ }
598
+
599
+ void brainoutset(real scalar obs, real scalar icnt, real matrix output)
600
+ { real matrix out3, out4, mm
601
+ real scalar i, ocnt
602
+ ocnt = cols(output)
603
+ out3 = st_data(obs, icnt+1..icnt+ocnt)
604
+ out4 = (out3[1, .] - output[1, .]) :* output[2, .]
605
+ mm = minmax(out4)
606
+ if (mm[1,1] < 0 | mm[1,2] > 1)
607
+ { for (i = 1; i <= ocnt; i++)
608
+ { if (out4[1, i] < 0) out4[1, i] = 0
609
+ if (out4[1, i] > 1) out4[1, i] = 1
610
+ }
611
+ }
612
+ output = output[1::2,.] \ out3 \ out4
613
+ }
614
+
615
+ void brainoutget(real scalar obs, real scalar icnt, real matrix neuron, real matrix output)
616
+ { real matrix out3, out4
617
+ real scalar i, ocnt, ostart
618
+ ocnt = cols(output)
619
+ ostart = cols(neuron) - ocnt + 1
620
+ out4 = neuron[1, ostart..ostart+ocnt-1]
621
+ out3 = out4[1, .] :/ output[2, .] + output[1, .]
622
+ output = output[1::2,.] \ out3 \ out4
623
+ if (obs > 0) st_store(obs, icnt+1..icnt+ocnt, out3)
624
+ }
625
+
626
+ void brainforward()
627
+ { real matrix neuron
628
+ neuron = st_matrix("neuron")
629
+ brainforw(st_matrix("layer"), neuron, st_matrix("brain"))
630
+ st_replacematrix("neuron", neuron)
631
+ }
632
+
633
+ void brainforw(layer, neuron, brain)
634
+ { real scalar layers, neurons, npos, wpos
635
+ real scalar l, n, start, weights, net
636
+ real matrix feed
637
+ layers = cols(layer)
638
+ npos = layer[1,1]+1
639
+ wpos = 1
640
+ start = 1
641
+ for (l = 2; l <= layers; l++)
642
+ { neurons = layer[1,l]
643
+ weights = layer[1,l-1]
644
+ feed = neuron[1, start..start+weights-1], 1
645
+ start = start+weights
646
+ for (n = 1; n <= neurons; n++)
647
+ { net = sum(feed :* brain[1,wpos..wpos+weights])
648
+ neuron[1,npos] = 1/(1+exp(-net))
649
+ wpos = wpos + weights + 1
650
+ npos++
651
+ }
652
+ }
653
+ }
654
+
655
+ void brainbackward(real scalar eta)
656
+ { real matrix brain
657
+ real scalar error
658
+ brain = st_matrix("brain")
659
+ error = brainbackw(eta, st_matrix("output"), st_matrix("layer"), st_matrix("neuron"), brain)
660
+ st_replacematrix("brain",brain)
661
+ st_rclear()
662
+ st_numscalar("r(error)", error)
663
+ }
664
+
665
+ void brainsignal(real scalar inp)
666
+ { real matrix neuron, layer, brain, input, output
667
+ real scalar obs, icnt, ocnt, N
668
+ layer = st_matrix("layer")
669
+ neuron = st_matrix("neuron")
670
+ brain = st_matrix("brain")
671
+ output = st_matrix("output")
672
+ input = st_matrix("input")
673
+ icnt = cols(input)
674
+ ocnt = cols(output)
675
+ ncnt = cols(neuron)
676
+ nouse = icnt+ocnt+1
677
+ N = st_nobs()
678
+ for (obs = 1; obs <= N; obs++)
679
+ { if (st_data(obs, nouse) == 1)
680
+ { continue
681
+ }
682
+ braininp(obs, input, neuron)
683
+ if (inp >= 1 & inp <= icnt)
684
+ { neuron[1,inp] = 0
685
+ }
686
+ brainforw(layer, neuron, brain)
687
+ brainoutget(obs, icnt, neuron, output)
688
+ }
689
+ }
690
+
691
+ void brainthink()
692
+ { brainsignal(0)
693
+ }
694
+
695
+ real scalar brainbackw(real scalar eta, real matrix output, real matrix layer, real matrix neuron, real matrix brain)
696
+ { real matrix delta, err, diff, sub
697
+ real scalar dpos, wpos, npos, lay, error
698
+ real scalar n, l
699
+ real scalar ncol, ocol, dcol
700
+ ncol = cols(neuron)
701
+ ocol = cols(output)
702
+ diff = (J(1, ncol-layer[1,1],1) :- neuron[1, layer[1,1]+1..ncol]) :* neuron[1, layer[1,1]+1..ncol]
703
+ err = output[4, .] :- neuron[1, ncol-ocol+1..ncol]
704
+ error = 0
705
+ for (n = 1; n <= ocol; n++) error = error + abs(err[1, n])
706
+ if (eta <= 0)
707
+ { return(error)
708
+ }
709
+ dcol = cols(diff)
710
+ delta = err :* diff[1, dcol-ocol+1..dcol]
711
+ wpos = cols(brain)+1
712
+ dpos = dcol-ocol+1
713
+ for (l = cols(layer)-1; l >= 2; l--)
714
+ { lay = layer[1, l]
715
+ err = J(1, lay, 0)
716
+ dcol = dpos-1
717
+ dpos = dpos-lay
718
+ sub = diff[1, dpos..dcol]
719
+ for (n = layer[1, l+1]; n >= 1; n--)
720
+ { wpos = wpos - lay - 1
721
+ err = err :+ delta[1, n] :* brain[1, wpos..wpos+lay-1] :* sub
722
+ }
723
+ delta = err, delta
724
+ }
725
+ npos = 1
726
+ dpos = 1
727
+ for (l = 2; l <= cols(layer); l++)
728
+ { lay = layer[1, l-1]
729
+ sub = eta * (neuron[1, npos..npos+lay-1], 1)
730
+ if (l == 2)
731
+ { err = delta[1, dpos] :* sub
732
+ dpos++
733
+ for (n = 2; n <= layer[1, l]; n++)
734
+ { err = err, (delta[1, dpos] :* sub)
735
+ dpos++
736
+ }
737
+ }
738
+ else
739
+ { for (n = 1; n <= layer[1, l]; n++)
740
+ { err = err, (delta[1, dpos] :* sub)
741
+ dpos++
742
+ }
743
+ }
744
+ npos = npos + lay
745
+ }
746
+ brain = brain :+ err
747
+ return(error)
748
+ }
749
+
750
+ void braintrain(real scalar eta, real scalar N)
751
+ { real matrix neuron, layer, brain, input, output
752
+ real scalar obs, icnt, error
753
+ layer = st_matrix("layer")
754
+ neuron = st_matrix("neuron")
755
+ brain = st_matrix("brain")
756
+ output = st_matrix("output")
757
+ input = st_matrix("input")
758
+ icnt = cols(input)
759
+ error = 0
760
+ for (obs = 1; obs <= N; obs++)
761
+ { braininp(obs, input, neuron)
762
+ brainoutset(obs, icnt, output)
763
+ brainforw(layer, neuron, brain)
764
+ error = error + brainbackw(eta, output, layer, neuron, brain)
765
+ }
766
+ if (eta > 0)
767
+ { st_replacematrix("brain",brain)
768
+ }
769
+ st_rclear()
770
+ st_numscalar("r(error)", error)
771
+ }
772
+ end
9/replication_package/Code/FS.do ADDED
@@ -0,0 +1,139 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ***This is the main program for appendix figures generated using Stata 15 MP
2
+
3
+ clear all
4
+ set more off
5
+
6
+ *global path "/Users/`c(username)'/Dropbox/China_Pollution_Monitoring"
7
+
8
+ *==============================================================================*
9
+ *Figures A1 and B5 are plotted using ArcGIS 10.2 based on city_info_rd.dta
10
+ *==============================================================================*
11
+ *Figure A3: PM10 and AOD Yearly Trends
12
+ *==============================================================================*
13
+ use "$path/Data/station_month.dta",clear
14
+ bysort year phase: egen pm10_y=mean(pm10)
15
+ bysort year phase: egen aod_y=mean(aod)
16
+ duplicates drop year phase,force
17
+ twoway (line pm10_y year if phase==1) (line aod_y year if phase==1, yaxis(2) lpattern(dash) lcol(black)), xtitle("") ytitle("PM10") ytitle("AOD", axis(2)) ///
18
+ xline(2013, lcol(black)) ylabel(80(20)160) ylabel(0.3(0.1)0.7, axis(2)) legend(pos(6) row(1) label(1 "PM10 in Wave 1") label(2 "AOD in Wave 1")) scheme(plotplainblind)
19
+ graph export "$path/Results/figures/FA3A_aod_pm10_year_1116_wave1.png", as(png) replace
20
+ twoway (line pm10_y year if phase==2, lcol(red)) (line aod_y year if phase==2, yaxis(2) lpattern(dash) lcol(red)), xtitle("") ytitle("PM10") ytitle("AOD", axis(2)) ///
21
+ xline(2014, lcol(red)) ylabel(80(20)160) ylabel(0.3(0.1)0.7, axis(2)) legend(pos(6) row(1) label(1 "PM10 in Wave 2") label(2 "AOD in Wave 2")) scheme(plotplainblind)
22
+ graph export "$path/Results/figures/FA3B_aod_pm10_year_1116_wave2.png", as(png) replace
23
+
24
+ *==============================================================================*
25
+ *Figure A4: Examples of PM10 Time Series
26
+ *==============================================================================*
27
+ use "$path/Data/station_day_1116.dta",clear
28
+ twoway (line pm10 date if pm10_n==1316 & date>=18993), ylabel(0(200)800) xline(19359,lpattern(solid) lcolor(red)) ///
29
+ xlabel(18993 "2012" 19359 "2013" 19724 "2014" 20089 "2015" 20454 "2016" 20820 "2017") legend(pos(6) r(1)) ytitle(PM10(ug/m3)) xtitle("") scheme(plotplainblind)
30
+ graph export "$path/Results/figures/FA4A_Shijiazhuang.png", as(png) replace
31
+ twoway (line pm10 date if pm10_n==541 & date>=18993), ylabel(0(200)800) xline(19478,lpattern(solid) lcolor(red)) ///
32
+ xlabel(18993 "2012" 19359 "2013" 19724 "2014" 20089 "2015" 20454 "2016" 20820 "2017") legend(pos(6) r(1)) ytitle(PM10(ug/m3)) xtitle("") scheme(plotplainblind)
33
+ graph export "$path/Results/figures/FA4B_Zhuzhou.png", as(png) replace
34
+ twoway (line pm10 date if pm10_n==325 & date>=18993), ylabel(0(200)800) xline(19264,lpattern(solid) lcolor(red)) ///
35
+ xlabel(18993 "2012" 19359 "2013" 19724 "2014" 20089 "2015" 20454 "2016" 20820 "2017") legend(pos(6) r(1)) ytitle(PM10(ug/m3)) xtitle("") scheme(plotplainblind)
36
+ graph export "$path/Results/figures/FA4C_Beijing.png", as(png) replace
37
+ twoway (line pm10 date if pm10_n==335 & date>=18993), ylabel(0(200)800) xline(19654,lpattern(solid) lcolor(red)) ///
38
+ xlabel(18993 "2012" 19359 "2013" 19724 "2014" 20089 "2015" 20454 "2016" 20820 "2017") legend(pos(6) r(1)) ytitle(PM10(ug/m3)) xtitle("") scheme(plotplainblind)
39
+ graph export "$path/Results/figures/FA4D_Beihai.png", as(png) replace
40
+
41
+ *==============================================================================*
42
+ *Figure A5: Distribution of Automation Time
43
+ *==============================================================================*
44
+ use "$path/Data/station_day_1116.dta" ,clear
45
+ duplicates drop pm10_n,force
46
+ hist auto_date, w(20) xlabel(18993 "2012" 19267 "Oct." 19359 "2013" 19479 "May" 19632 "Oct." 19724 "2014") xtitle("") scheme(plotplainblind)
47
+ graph export "$path/Results/figures/FA5_auto_time.png", as(png) replace
48
+
49
+ *==============================================================================*
50
+ *Figure B1:RD Plots Using Raw Daily PM10 in Wave 1 & 2, Deadline, and Monthly PM10
51
+ *==============================================================================*
52
+ ***station-day
53
+ use "$path/Data/station_day_1116.dta",clear
54
+ gen T=date-auto_date
55
+ rdplot pm10 T if T>=-364 & T<=364 & phase==1, lowerend(-364) upperend(364) p(3) kernel(tri) nbins(364 364) ci(95) masspoints(off) ///
56
+ graph_options(xlabel(-360(60)360) ylabel(0(50)250) legend(off) ytitle(PM10 - Wave 1) xtitle(Days before/after Automation) scheme(plotplainblind))
57
+ graph export "$path/Results/figures/FB1A_rd_pm10_raw_wave1_365d.png", as(png) replace
58
+ rdplot pm10 T if T>=-364 & T<=364 & phase==2, lowerend(-364) upperend(364) p(3) kernel(tri) nbins(364 364) ci(95) masspoints(off) ///
59
+ graph_options(xlabel(-360(60)360) ylabel(0(50)250) legend(off) ytitle(PM10 - Wave 2) xtitle(Days before/after Automation) scheme(plotplainblind))
60
+ graph export "$path/Results/figures/FB1B_rd_pm10_raw_wave2_365d.png", as(png) replace
61
+ rdplot pm10 T if T>=-364 & T<=364 & (auto_date==19359 | auto_date==19724), lowerend(-364) upperend(364) p(3) kernel(tri) nbins(364 364) ci(95) masspoints(off) ///
62
+ graph_options(xlabel(-360(60)360) ylabel(0(50)250) legend(off) ytitle(PM10 - Deadline) xtitle(Days before/after Automation) scheme(plotplainblind))
63
+ graph export "$path/Results/figures/FB1C_rd_pm10_raw_deadline_365d.png", as(png) replace
64
+
65
+ ***station-month
66
+ use "$path/Data/station_month.dta" ,clear
67
+ rdplot pm10 n_month if n_month>=-12 & n_month<=12, lowerend(-12) upperend(12) p(2) kernel(tri) nbins(12 12) ci(95) masspoints(off) ///
68
+ graph_options(xlabel(-12(3)12) ylabel(0(50)200) legend(off) ytitle(Monthly PM10) xtitle(Months before/after Automation) scheme(plotplainblind))
69
+ graph export "$path/Results/figures/FB1D_rd_pm10_raw_station_12m.png", as(png) replace
70
+
71
+ *==============================================================================*
72
+ *Figure B2: Station-Daily Weather
73
+ *==============================================================================*
74
+ use "$path/Data/station_day_1116.dta",clear
75
+ gen T=date-auto_date
76
+ gen month=month(date)
77
+ foreach v in temp rain rh wind_speed{
78
+ qui reghdfe `v', absorb(pm10_n month) res(resid_`v'_sm)
79
+ }
80
+ rdplot resid_temp_sm T if T>=-364 & T<=364, lowerend(-364) upperend(364) p(3) kernel(tri) nbins(364 364) ci(95) masspoints(off) ///
81
+ graph_options(xlabel(-360(60)360) legend(off) ytitle(Residual - Temperature) xtitle(Days before/after Automation) scheme(plotplainblind))
82
+ graph export "$path/Results/figures/FB2A_rd_temp_sm_365d.png", as(png) replace
83
+ rdplot resid_rain_sm T if T>=-364 & T<=364, lowerend(-364) upperend(364) p(3) kernel(tri) nbins(364 364) ci(95) masspoints(off) ///
84
+ graph_options(xlabel(-360(60)360) legend(off) ytitle(Residual - Precipitation) xtitle(Days before/after Automation) scheme(plotplainblind))
85
+ graph export "$path/Results/figures/FB2B_rd_rain_sm_365d.png", as(png) replace
86
+ rdplot resid_rh_sm T if T>=-364 & T<=364, lowerend(-364) upperend(364) p(3) kernel(tri) nbins(364 364) ci(95) masspoints(off) ///
87
+ graph_options(xlabel(-360(60)360) legend(off) ytitle(Residual - Relative Humidity) xtitle(Days before/after Automation) scheme(plotplainblind))
88
+ graph export "$path/Results/figures/FB2C_rd_rh_sm_365d.png", as(png) replace
89
+ rdplot resid_wind_speed_sm T if T>=-364 & T<=364, lowerend(-364) upperend(364) p(3) kernel(tri) nbins(364 364) ci(95) masspoints(off) ///
90
+ graph_options(xlabel(-360(60)360) legend(off) ytitle(Residual - Wind Speed) xtitle(Days before/after Automation) scheme(plotplainblind))
91
+ graph export "$path/Results/figures/FB2D_rd_wdsp_sm_365d.png", as(png) replace
92
+
93
+ *==============================================================================*
94
+ *Figure B6: RD Plots for PM10 Variability
95
+ *==============================================================================*
96
+ use "$path/Data/station_day_1116.dta",clear
97
+ gen year=year(date)
98
+ gen month=month(date)
99
+ gen T = date - auto_date
100
+ gen n_month=floor(T/30)
101
+ bysort pm10_n n_month: egen sd_pm10=sd(pm10)
102
+ foreach v of var pm10-rh{
103
+ bysort pm10_n n_month: egen `v'_m=mean(`v')
104
+ drop `v'
105
+ rename `v'_m `v'
106
+ }
107
+ duplicates drop pm10_n n_month,force
108
+ qui reghdfe sd_pm10 wind_speed rain temp rh, absorb(pm10_n month) res(resid_sd_pm10_smw)
109
+ rdplot resid_sd_pm10_smw n_month if n_month>=-12 & n_month<=12, lowerend(-12) upperend(12) p(2) kernel(tri) nbins(12 12) ci(95) masspoints(off) ///
110
+ graph_options(xlabel(-12(3)12) legend(off) ylabel(-20(10)20) ytitle("Residual - PM10 Monthly Standard Deviation") xtitle(Months before/after Automation) scheme(plotplainblind))
111
+ graph export "$path/Results/figures/FB6_rd_sd_PM10_12m.png", as(png) replace
112
+
113
+ *==============================================================================*
114
+ *Figure C: Correction of Pre-Automation PM10 Data
115
+ *==============================================================================*
116
+ use "$path/Data/city_month.dta" ,clear
117
+ hist pm10 if after==0 & rd==1,fcolor(none) lp("-") lcolor(black) w(20) start(0) addplot(hist pm10_corrected if after==0 & rd==1 & pm10!=., ///
118
+ fcolor(none) lcolor(red) w(20) start(0)) scheme(plotplainblind) ylabel(0(0.005)0.015) xtitle("PM10") legend(pos(6) r(1) label(1 "Reported PM10") label(2 "Corrected PM10"))
119
+ graph export "$path/Results/figures/FC_hist_pm_corrected.png", as(png) replace
120
+ *su pm10_corrected if after==0 & rd==1 & pm10!=.
121
+ *su pm10 if after==0 & rd==1
122
+
123
+ *==============================================================================*
124
+ *Figure D2: RD Plots for Online Searches: January 1st 2015
125
+ *==============================================================================*
126
+ use "$path/Data/search_city_month.dta" ,clear
127
+ egen year_month=group(year month)
128
+ gen n_month2=year_month-49
129
+
130
+ rdplot pmmask n_month2 if n_month2>=-12 & n_month2<=12, lowerend(-12) upperend(12) p(2) kernel(tri) nbins(12 12) ci(95) masspoints(off) ///
131
+ graph_options(xlabel(-12(3)12) legend(off) ylabel(0(10)80) ytitle(Baidu Search Index: Anti-Haze Face Mask) xtitle("Months before/after January 1st, 2015") scheme(plotplainblind))
132
+ graph export "$path/Results/figures/FD2A_rd_pmmask_raw_city_month_12m_2015.png", as(png) replace
133
+ rdplot filter n_month2 if n_month2>=-12 & n_month2<=12, lowerend(-12) upperend(12) p(2) kernel(tri) nbins(12 12) ci(95) masspoints(off) ///
134
+ graph_options(xlabel(-12(3)12) legend(off) ylabel(0(10)80) ytitle(Baidu Search Index: Air Filter) xtitle("Months before/after January 1st, 2015") scheme(plotplainblind))
135
+ graph export "$path/Results/figures/FD2B_rd_filter_raw_city_month_12m_2015.png", as(png) replace
136
+
137
+
138
+ ***The End
139
+
9/replication_package/Code/Figures.do ADDED
@@ -0,0 +1,150 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ***This is the main program for Figures 1 and 2 generated using Stata 15 MP
2
+
3
+ clear all
4
+ set more off
5
+
6
+ set matsize 5000
7
+ set scheme plotplain
8
+
9
+ *global path "/Users/`c(username)'/Dropbox/China_Pollution_Monitoring"
10
+
11
+ *==============================================================================*
12
+ *Figure 1: RD Plots for PM10, AOD and Online Search
13
+ *==============================================================================*
14
+ ***Figure 1A & 1B: station-daily raw and residual PM10
15
+ use "$path/Data/station_day_1116.dta",clear
16
+ gen T=date-auto_date
17
+ gen month=month(date)
18
+ qui reghdfe pm10 wind_speed rain temp rh, absorb(pm10_n month) res(resid_pm10_smw)
19
+ rdplot pm10 T if T>=-364 & T<=364, lowerend(-364) upperend(364) p(3) kernel(tri) nbins(364 364) ci(95) masspoints(off) ///
20
+ graph_options(xlabel(-360(60)360) ylabel(0(50)250) legend(off) ytitle(PM10) xtitle(Days before/after Automation) scheme(plotplainblind))
21
+ graph export "$path/Results/figures/F1A_rd_PM10_raw_station_365d.png", as(png) replace
22
+ rdplot resid_pm10_smw T if T>=-364 & T<=364, lowerend(-364) upperend(364) p(3) kernel(tri) nbins(364 364) ci(95) masspoints(off) ///
23
+ graph_options(xlabel(-360(60)360) ylabel(-75(25)75) legend(off) ytitle(Residual - PM10) xtitle(Days before/after Automation) scheme(plotplainblind))
24
+ graph export "$path/Results/figures/F1B_rd_PM10_smw_station_365d.png", as(png) replace
25
+
26
+ ***Figure 1C & 1D: station-monthly PM10 and AOD
27
+ use "$path/Data/station_month.dta" ,clear
28
+ qui reghdfe pm10 wind_speed rain temp rh, absorb(pm10_n month) res(resid_pm10_smw)
29
+ rdplot resid_pm10_smw n_month if n_month>=-12 & n_month<=12, lowerend(-12) upperend(12) p(3) kernel(tri) nbins(12 12) ci(95) masspoints(off) ///
30
+ graph_options(xlabel(-12(3)12) legend(off) ytitle(Residual - PM10) xtitle(Months before/after Automation) scheme(plotplainblind))
31
+ graph export "$path/Results/figures/F1C_rd_pm10_smw_station_12m.png", as(png) replace
32
+ qui reghdfe aod wind_speed rain temp rh, absorb(pm10_n month) res(resid_aod_smw)
33
+ rdplot resid_aod_smw n_month if n_month>=-12 & n_month<=12, lowerend(-12) upperend(12) p(2) kernel(tri) nbins(12 12) ci(95) masspoints(off) ///
34
+ graph_options(xlabel(-12(3)12) ylabel(-0.08(0.02)0.08) legend(off) ytitle(Residual - AOD, margin(none)) xtitle(Months before/after Automation) scheme(plotplainblind))
35
+ graph export "$path/Results/figures/F1D_rd_aod_smw_station_12m.png", as(png) replace
36
+
37
+ ***Figure 1E & 1F: city-monthly search for face mask and air filter
38
+ use "$path/Data/search_city_month.dta",clear
39
+ foreach v in pmmask filter{
40
+ qui reghdfe `v' wind_speed rain temp rh, absorb(code_city month) res(resid_`v'_smw)
41
+ }
42
+ rdplot resid_pmmask_smw n_month if n_month>=-12 & n_month<=12, lowerend(-12) upperend(12) p(4) kernel(tri) nbins(12 12) ci(95) masspoints(off) ///
43
+ graph_options(xlabel(-12(3)12) legend(off) ylabel(-20(10)20) ytitle(Baidu Search Index: Anti-Haze Face Mask) xtitle(Months before/after Automation) scheme(plotplainblind))
44
+ graph export "$path/Results/figures/F1E_rd_pmmask_smw_city_month_12m.png", as(png) replace
45
+ rdplot resid_filter_smw n_month if n_month>=-12 & n_month<=12, lowerend(-12) upperend(12) p(3) kernel(tri) nbins(12 12) ci(95) masspoints(off) ///
46
+ graph_options(xlabel(-12(3)12) legend(off) ylabel(-20(10)20) ytitle(Baidu Search Index: Air Filter) xtitle(Months before/after Automation) scheme(plotplainblind))
47
+ graph export "$path/Results/figures/F1F_rd_filter_smw_city_month_12m.png", as(png) replace
48
+
49
+ *==============================================================================*
50
+ *Figure 2: City RD for PM10 in 76 Cities
51
+ *==============================================================================*
52
+ use "$path/Data/city_info_rd.dta",clear
53
+ keep if list_76==1
54
+ sort rd_estimate_1116
55
+ gen city_N=_n
56
+ gen l_95_1116=rd_estimate_1116-1.96*error_1116
57
+ gen h_95_1116=rd_estimate_1116+1.96*error_1116
58
+
59
+ input y1 x1 y2 x2
60
+ -100 13 -30 13
61
+ -100 18 -10 18
62
+ -100 25 -10 25
63
+ -100 29 -10 29
64
+ -100 43 15 43
65
+ -100 53 15 53
66
+ -100 57 25 57
67
+ -100 59 25 59
68
+ -100 63 40 63
69
+ -100 73 70 73
70
+ -100 76 71 76
71
+ end
72
+
73
+ twoway rspike l_95_1116 h_95_1116 city_N, color(black) || scatter rd_estimate_1116 city_N if l_95_1116 >0, msymbol(square) mcolor(cranberry) msize(0.5) ///
74
+ || scatter rd_estimate_1116 city_N if l_95_1116 <=0 , mstyle(p1) msize(0.3) color(cranberry) lp(dash) ///
75
+ || pcarrow y1 x1 y2 x2, mc(ebblue) msize(0.6) lp(shortdash) lc(ebblue) yline(0,lp(solid) lcol(black)) yline(-100 100, lp(dot)) yline(28.2, lp(dash)) ///
76
+ ylabel(-100 "-100" 0 "0" 28.2 "Mean" 100 "100" 200 "200",labsize(small)) ///
77
+ xlabel(13 "Beijing" 18 "Shanghai" 25 "Guangzhou" 29 "Shenzhen" 43 "Chongqing" 53 "Chengdu" 57 "Tianjin" 59 "Shenyang" 63 "Wuhan" 73 "Xi'an" 76 "Shijiazhuang", labsize(tiny) alt) ///
78
+ ytitle(City-Specific RD Estimates) xtitle(City) legend(ring(0) position(11) col(1) order(2 "RD Estimate Positive and Significant at 5%" 3 "RD Estimate" 1 "95% CI" )) ///
79
+ plotregion(lcolor(black) fcolor(white)) scheme(plottig)
80
+ graph export "$path/Results/figures/F2.png", as(png) replace
81
+ graph export "$path/Results/figures/F2.pdf", replace
82
+
83
+ *==============================================================================*
84
+ *Figure 3: DiD Plots for PM10 and online searches
85
+ *==============================================================================*
86
+ ***Figure 3A: PM10
87
+ use "$path/Data/did_ddl_match.dta",clear
88
+ gen year=year(date)
89
+ gen month=month(date)
90
+ egen year_month=group(year month)
91
+ gen treat=(auto_date==19359)
92
+ gen after2=(year>=2013)
93
+ gen m12_before2=(year==2012 & month>=11 & month<=12)
94
+ gen m34_before2=(year==2012 & month>=9 & month<=10)
95
+ gen m56_before2=(year==2012 & month>=7 & month<=8)
96
+ gen m712_before2=(year==2012 & month>=1 & month<=6)
97
+ gen m12_after2=(year==2013 & month>=1 & month<=2)
98
+ gen m34_after2=(year==2013 & month>=3 & month<=4)
99
+ gen m56_after2=(year==2013 & month>=5 & month<=6)
100
+ gen m712_after2=(year==2013 & month>=7 & month<=12)
101
+
102
+ foreach v in 12 34 56 712{
103
+ gen treat_m`v'_before2=treat*m`v'_before2
104
+ gen treat_m`v'_after2=treat*m`v'_after2
105
+ }
106
+
107
+ qui reghdfe l_pm10 treat_m712_before2 treat_m56_before2 treat_m34_before2 treat_m12_after2 treat_m34_after2 treat_m56_after2 treat_m712_after2 ///
108
+ wind_speed rain temp rh, absorb(pm10_n year_month) vce(cluster code_city)
109
+ plotbeta treat_m712_before2 | treat_m56_before2 | treat_m34_before2 | 0 | treat_m12_after2 | treat_m34_after2 | treat_m56_after2 | treat_m712_after2, ///
110
+ vertical level(90) xlab(1 "7-12" 2 "5-6" 3 "3-4" 4 "1-2" 5 "1-2" 6 "3-4" 7 "5-6" 8 "7-12" , labsize(medsmall) labcolor(black) axis(1)) ///
111
+ xlab(none, axis(2)) xtitle("Months before/after Automation", col(black)) ytitle("Estimated Coefficients: Log(PM10)") yline(0, lp(dash)) xline(4.5, lp(dash)) scheme(plotplainblind)
112
+ graph export "$path/Results/figures/F3A_DiD_pm10.png", as(png) replace
113
+
114
+ ***Figure 3B & 3C: searches for masks and air filters
115
+ use "$path/Data/did_ddl_search.dta" ,clear
116
+ gen year=year(date)
117
+ gen month=month(date)
118
+ egen year_month=group(year month)
119
+ gen treat=(auto_date==19359)
120
+ gen after2=(year>=2013)
121
+ gen m12_before2=(year==2012 & month>=11 & month<=12)
122
+ gen m34_before2=(year==2012 & month>=9 & month<=10)
123
+ gen m56_before2=(year==2012 & month>=7 & month<=8)
124
+ gen m712_before2=(year==2012 & month>=1 & month<=6)
125
+ gen m12_after2=(year==2013 & month>=1 & month<=2)
126
+ gen m34_after2=(year==2013 & month>=3 & month<=4)
127
+ gen m56_after2=(year==2013 & month>=5 & month<=6)
128
+ gen m712_after2=(year==2013 & month>=7 & month<=12)
129
+
130
+ foreach v in 12 34 56 712{
131
+ gen treat_m`v'_before2=treat*m`v'_before2
132
+ gen treat_m`v'_after2=treat*m`v'_after2
133
+ }
134
+
135
+ qui reghdfe filter treat_m712_before2 treat_m56_before2 treat_m34_before2 treat_m12_after2 treat_m34_after2 treat_m56_after2 treat_m712_after2 ///
136
+ wind_speed rain temp rh, absorb(code_city year_month) vce(cluster code_city)
137
+ plotbeta treat_m712_before2 | treat_m56_before2 | treat_m34_before2 | 0 | treat_m12_after2 | treat_m34_after2 | treat_m56_after2 | treat_m712_after2, ///
138
+ vertical level(90) xlab(1 "7-12" 2 "5-6" 3 "3-4" 4 "1-2" 5 "1-2" 6 "3-4" 7 "5-6" 8 "7-12" , labsize(medsmall) labcolor(black) axis(1)) ///
139
+ xlab(none, axis(2)) xtitle("Months before/after Automation", col(black)) ytitle("Estimated Coefficients: Air Filter Searches") yline(0, lp(dash)) xline(4.5, lp(dash)) scheme(plotplainblind)
140
+ graph export "$path/Results/figures/F3B_filter_DiD.png", as(png) replace
141
+
142
+ qui reghdfe pmmask treat_m712_before2 treat_m56_before2 treat_m34_before2 treat_m12_after2 treat_m34_after2 treat_m56_after2 treat_m712_after2 ///
143
+ wind_speed rain temp rh, absorb(code_city year_month) vce(cluster code_city)
144
+ plotbeta treat_m712_before2 | treat_m56_before2 | treat_m34_before2 | 0 | treat_m12_after2 | treat_m34_after2 | treat_m56_after2 | treat_m712_after2, ///
145
+ vertical level(90) xlab(1 "7-12" 2 "5-6" 3 "3-4" 4 "1-2" 5 "1-2" 6 "3-4" 7 "5-6" 8 "7-12" , labsize(medsmall) labcolor(black) axis(1)) ///
146
+ xlab(none, axis(2)) xtitle("Months before/after Automation", col(black)) ytitle("Estimated Coefficients: Mask Searches") yline(0, lp(dash)) xline(4.5, lp(dash)) scheme(plotplainblind)
147
+ graph export "$path/Results/figures/F3C_pmmask_DiD.png", as(png) replace
148
+
149
+
150
+ ***The End
9/replication_package/Code/MASTER.do ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ *** Master file for China Pollution Monitoring Paper
2
+ *** Instructions: Set path to directory with Codes, Data, and Results folders (including Results/figures folder).
3
+ *** Then run master file to produce all output.
4
+ global path "/Users/garrethgibney/Library/CloudStorage/OneDrive-Personal/Work/PhD Project/Research Projects/OSLO Replication Games/Replication Package/125321-V1/China_Pollution_Monitoring"
5
+ cd "$path/Code"
6
+
7
+ do Prepare_Data.do
8
+ do Figures.do
9
+ do Tables.do
10
+ do FS.do
11
+ do TS.do
12
+
13
+
14
+ ***The End
9/replication_package/Code/NOAA Weather Data (NEW!)/Alt_weather_var_v1.do ADDED
@@ -0,0 +1,587 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ *==============================================================================*
2
+ *0. Preparation
3
+ *==============================================================================*]
4
+ * Weather data downloading in file name
5
+ *Setting a global path & data directory
6
+ clear
7
+ global path "/Volumes/External Drive A/Greenstone et al/NOAA Weather Data/China"
8
+ * Note: Weather Data was downloaded from the NOAA weather station data archive, using NOAA_download.R
9
+
10
+ *==============================================================================*
11
+ *1. Matching weather & pollution stations
12
+ *==============================================================================*
13
+ *Notes: (a) This section takes a very long time to run. One loop can take a couple hours to run. This entire section took 3 days to run over christmas! (b) I had huge issues with the datafile sizes. The output from this section is 25GB. It needs to run in weekly sections, due to hardware limitations!
14
+ timer clear 1
15
+ timer on 1
16
+ forvalues i = 1/52 {
17
+ use "$path/pollution_station.dta", clear
18
+ gen year = year(date)
19
+ gen week = week(date)
20
+ keep if year == 2011 & week == `i'
21
+ drop year week
22
+ reshape wide pollution_lat pollution_lon, i(date) j(pm10_n)
23
+ save "$path/pollution_station_wide_`i'_2011.dta", replace
24
+
25
+ use "$path/china_weather_2011_16_v2.dta", clear
26
+ gen year = year(date)
27
+ gen week = week(date)
28
+ keep if year == 2011 & week == `i'
29
+ drop year week
30
+ save "$path/weather_station_`i'_2011.dta", replace
31
+
32
+ use "$path/pollution_station_wide_`i'_2011.dta", clear
33
+ merge 1:m date using "$path/weather_station_`i'_2011.dta"
34
+ drop _m
35
+ gen seq=_n
36
+ reshape long pollution_lat pollution_lon, i(seq) j(pm10_n)
37
+ save "$path/pw_station_2011/pw_station_long_`i'_2011.dta", replace
38
+ }
39
+ timer off 1
40
+ timer list 1
41
+
42
+
43
+ timer on 2
44
+ forvalues i = 1/52 {
45
+ use "$path/Raw CSV/pollution_station.dta", clear
46
+ gen year = year(date)
47
+ gen week = week(date)
48
+ keep if year == 2012 & week == `i'
49
+ drop year week
50
+ reshape wide pollution_lat pollution_lon, i(date) j(pm10_n)
51
+ save "$path/pollution_station_wide_`i'_2011.dta", replace
52
+
53
+ use "$path/Raw CSV/weather_station.dta", clear
54
+ gen year = year(date)
55
+ gen week = week(date)
56
+ keep if year == 2012 & week == `i'
57
+ drop year week
58
+ save "$path/weather_station_`i'_2011.dta", replace
59
+
60
+ use "$path/pollution_station_wide_`i'_2011.dta", clear
61
+ merge 1:m date using "$path/weather_station_`i'_2011.dta"
62
+ drop _m
63
+ gen seq=_n
64
+ reshape long pollution_lat pollution_lon, i(seq) j(pm10_n)
65
+ save "$path/pw_station_2012/pw_station_long_`i'_2011.dta", replace
66
+ }
67
+ timer off 2
68
+ timer list 2
69
+
70
+
71
+ timer on 3
72
+ forvalues i = 1/52 {
73
+ use "$path/Raw CSV/pollution_station.dta", clear
74
+ gen year = year(date)
75
+ gen week = week(date)
76
+ keep if year == 2013 & week == `i'
77
+ drop year week
78
+ reshape wide pollution_lat pollution_lon, i(date) j(pm10_n)
79
+ save "$path/Raw CSV/pollution_station_wide_`i'_2011.dta", replace
80
+
81
+ use "$path/Raw CSV/weather_station.dta", clear
82
+ gen year = year(date)
83
+ gen week = week(date)
84
+ keep if year == 2013 & week == `i'
85
+ drop year week
86
+ save "$path/weather_station_`i'_2011.dta", replace
87
+
88
+ use "$path/pollution_station_wide_`i'_2011.dta", clear
89
+ merge 1:m date using "$path/weather_station_`i'_2011.dta"
90
+ drop _m
91
+ gen seq=_n
92
+ reshape long pollution_lat pollution_lon, i(seq) j(pm10_n)
93
+ save "$path/pw_station_2013/pw_station_long_`i'_2011.dta", replace
94
+ }
95
+ timer off 3
96
+ timer list 3
97
+
98
+
99
+ timer on 4
100
+ forvalues i = 1/52 {
101
+ use "$path/Raw CSV/pollution_station.dta", clear
102
+ gen year = year(date)
103
+ gen week = week(date)
104
+ keep if year == 2014 & week == `i'
105
+ drop year week
106
+ reshape wide pollution_lat pollution_lon, i(date) j(pm10_n)
107
+ save "$path/pollution_station_wide_`i'_2011.dta", replace
108
+
109
+ use "$path/Raw CSV/weather_station.dta", clear
110
+ gen year = year(date)
111
+ gen week = week(date)
112
+ keep if year == 2014 & week == `i'
113
+ drop year week
114
+ save "$path/weather_station_`i'_2011.dta", replace
115
+
116
+ use "$path/pollution_station_wide_`i'_2011.dta", clear
117
+ merge 1:m date using "$path/weather_station_`i'_2011.dta"
118
+ drop _m
119
+ gen seq=_n
120
+ reshape long pollution_lat pollution_lon, i(seq) j(pm10_n)
121
+ save "$path/pw_station_2014/pw_station_long_`i'_2011.dta", replace
122
+ }
123
+ timer off 4
124
+ timer list 4
125
+
126
+
127
+ timer on 5
128
+ forvalues i = 1/52 {
129
+ use "$path/Raw CSV/pollution_station.dta", clear
130
+ gen year = year(date)
131
+ gen week = week(date)
132
+ keep if year == 2015 & week == `i'
133
+ drop year week
134
+ reshape wide pollution_lat pollution_lon, i(date) j(pm10_n)
135
+ save "$path/pollution_station_wide_`i'_2011.dta", replace
136
+
137
+ use "$path/Raw CSV/weather_station.dta", clear
138
+ gen year = year(date)
139
+ gen week = week(date)
140
+ keep if year == 2015 & week == `i'
141
+ drop year week
142
+ save "$path/weather_station_`i'_2011.dta", replace
143
+
144
+ use "$path/pollution_station_wide_`i'_2011.dta", clear
145
+ merge 1:m date using "$path/weather_station_`i'_2011.dta"
146
+ drop _m
147
+ gen seq=_n
148
+ reshape long pollution_lat pollution_lon, i(seq) j(pm10_n)
149
+ save "$path/pw_station_2015/pw_station_long_`i'_2011.dta", replace
150
+ }
151
+ timer off 5
152
+ timer list 5
153
+
154
+ timer on 6
155
+ forvalues i = 1/52 {
156
+ use "$path/pollution_station.dta", clear
157
+ gen year = year(date)
158
+ gen week = week(date)
159
+ keep if year == 2016 & week == `i'
160
+ drop year week
161
+ reshape wide pollution_lat pollution_lon, i(date) j(pm10_n)
162
+ save "$path/pollution_station_wide_`i'_2011.dta", replace
163
+
164
+ use "$path/Raw CSV/weather_station.dta", clear
165
+ gen year = year(date)
166
+ gen week = week(date)
167
+ keep if year == 2016 & week == `i'
168
+ drop year week
169
+ save "$path/weather_station_`i'_2011.dta", replace
170
+
171
+ use "$path/Raw CSV/pollution_station_wide_`i'_2011.dta", clear
172
+ merge 1:m date using "$path/weather_station_`i'_2011.dta"
173
+ drop _m
174
+ gen seq=_n
175
+ reshape long pollution_lat pollution_lon, i(seq) j(pm10_n)
176
+ save "$path/pw_station_2016/pw_station_long_`i'_2011.dta", replace
177
+ }
178
+ timer off 6
179
+ timer list 6
180
+
181
+ *==============================================================================*
182
+ *2. Estimating the distance between each pollution station & ALL weather stations on each day.
183
+ *==============================================================================*
184
+ *Notes: This section takes a couple of hours to run! In case of error, each year is ran seperately.
185
+ * 2011
186
+ filelist , dir($path/pw_station_2011) pattern(*.dta) norecur
187
+
188
+ * save a copy so that we can load each observation in the loop below
189
+ tempfile files
190
+ split filename, parse(".") generate(filename)
191
+ drop filename filename2
192
+ rename filename1 filename
193
+ save "files_2011", replace
194
+
195
+ * loop over each file and input each file into temporary datasets.
196
+ forvalues i = 1/52 {
197
+ use "files_2011" in `i', clear
198
+ global f = dirname + "/" + filename + ".dta"
199
+ global d = filename
200
+
201
+ use "$f", clear
202
+ drop seq
203
+ replace wdsp = "" if wdsp == "NA"
204
+ destring wdsp, gen(wind_speed)
205
+ replace prcp = "" if prcp == "NA"
206
+ destring prcp, gen(rain)
207
+ replace rh = "" if rh == "NA"
208
+ rename rh rh_s
209
+ destring rh_s, gen(rh)
210
+
211
+ drop wdsp prcp rh_s
212
+
213
+ sphdist, lat1(pollution_lat) lon1(pollution_lon) lat2(latitude) lon2(longitude) radians units(km) gen(distance)
214
+
215
+ save "$path/pw_station_distances/$d", replace
216
+ }
217
+
218
+ * 2012
219
+ filelist , dir($path/pw_station_2012) pattern(*.dta) norecur
220
+
221
+ * save a copy so that we can load each observation in the loop below
222
+ tempfile files
223
+ split filename, parse(".") generate(filename)
224
+ drop filename filename2
225
+ rename filename1 filename
226
+ save "files_2012", replace
227
+
228
+ * loop over each file and input each file into temporary datasets.
229
+ forvalues i = 1/52 {
230
+ use "files_2012" in `i', clear
231
+ global f = dirname + "/" + filename + ".dta"
232
+ global d = filename
233
+
234
+ use "$f", clear
235
+ drop seq
236
+ replace wdsp = "" if wdsp == "NA"
237
+ destring wdsp, gen(wind_speed)
238
+ replace prcp = "" if prcp == "NA"
239
+ destring prcp, gen(rain)
240
+ replace rh = "" if rh == "NA"
241
+ rename rh rh_s
242
+ destring rh_s, gen(rh)
243
+
244
+ drop wdsp prcp rh_s
245
+
246
+ sphdist, lat1(pollution_lat) lon1(pollution_lon) lat2(latitude) lon2(longitude) radians units(km) gen(distance)
247
+
248
+ save "$path/pw_station_distances/$d", replace
249
+ }
250
+
251
+ * 2013
252
+ filelist , dir($path/pw_station_2013) pattern(*.dta) norecur
253
+
254
+ * save a copy so that we can load each observation in the loop below
255
+ tempfile files
256
+ split filename, parse(".") generate(filename)
257
+ drop filename filename2
258
+ rename filename1 filename
259
+ save "files_2013", replace
260
+
261
+ * loop over each file and input each file into temporary datasets.
262
+ forvalues i = 1/52 {
263
+ use "files_2013" in `i', clear
264
+ global f = dirname + "/" + filename + ".dta"
265
+ global d = filename
266
+
267
+ use "$f", clear
268
+ drop seq
269
+ replace wdsp = "" if wdsp == "NA"
270
+ destring wdsp, gen(wind_speed)
271
+ replace prcp = "" if prcp == "NA"
272
+ destring prcp, gen(rain)
273
+ replace rh = "" if rh == "NA"
274
+ rename rh rh_s
275
+ destring rh_s, gen(rh)
276
+
277
+
278
+ drop wdsp prcp rh_s
279
+
280
+ sphdist, lat1(pollution_lat) lon1(pollution_lon) lat2(latitude) lon2(longitude) radians units(km) gen(distance)
281
+
282
+ save "$path/pw_station_distances/$d", replace
283
+ }
284
+
285
+ * 2014
286
+ filelist , dir($path/pw_station_2014) pattern(*.dta) norecur
287
+
288
+ * save a copy so that we can load each observation in the loop below
289
+ tempfile files
290
+ split filename, parse(".") generate(filename)
291
+ drop filename filename2
292
+ rename filename1 filename
293
+ save "files_2014", replace
294
+
295
+ * loop over each file and input each file into temporary datasets.
296
+ forvalues i = 1/52 {
297
+ use "files_2014" in `i', clear
298
+ global f = dirname + "/" + filename + ".dta"
299
+ global d = filename
300
+
301
+ use "$f", clear
302
+ drop seq
303
+ replace wdsp = "" if wdsp == "NA"
304
+ destring wdsp, gen(wind_speed)
305
+ replace prcp = "" if prcp == "NA"
306
+ destring prcp, gen(rain)
307
+ replace rh = "" if rh == "NA"
308
+ rename rh rh_s
309
+ destring rh_s, gen(rh)
310
+
311
+
312
+ drop wdsp prcp rh_s
313
+
314
+ sphdist, lat1(pollution_lat) lon1(pollution_lon) lat2(latitude) lon2(longitude) radians units(km) gen(distance)
315
+
316
+ save "$path/pw_station_distances/$d", replace
317
+ }
318
+
319
+ * 2015
320
+ filelist , dir($path/pw_station_2015) pattern(*.dta) norecur
321
+
322
+ * save a copy so that we can load each observation in the loop below
323
+ tempfile files
324
+ split filename, parse(".") generate(filename)
325
+ drop filename filename2
326
+ rename filename1 filename
327
+ save "files_2015", replace
328
+
329
+ * loop over each file and input each file into temporary datasets.
330
+ forvalues i = 1/52 {
331
+ use "files_2015" in `i', clear
332
+ global f = dirname + "/" + filename + ".dta"
333
+ global d = filename
334
+
335
+ use "$f", clear
336
+ drop seq
337
+ replace wdsp = "" if wdsp == "NA"
338
+ destring wdsp, gen(wind_speed)
339
+ replace prcp = "" if prcp == "NA"
340
+ destring prcp, gen(rain)
341
+ replace rh = "" if rh == "NA"
342
+ rename rh rh_s
343
+ destring rh_s, gen(rh)
344
+
345
+
346
+ drop wdsp prcp rh_s
347
+
348
+ sphdist, lat1(pollution_lat) lon1(pollution_lon) lat2(latitude) lon2(longitude) radians units(km) gen(distance)
349
+
350
+ save "$path/pw_station_distances/$d", replace
351
+ }
352
+
353
+ * 2016
354
+ filelist , dir($path/pw_station_2016) pattern(*.dta) norecur
355
+
356
+ * save a copy so that we can load each observation in the loop below
357
+ tempfile files
358
+ split filename, parse(".") generate(filename)
359
+ drop filename filename2
360
+ rename filename1 filename
361
+ save "files_2016", replace
362
+
363
+ * loop over each file and input each file into temporary datasets.
364
+ forvalues i = 1/52 {
365
+ use "files_2016" in `i', clear
366
+ global f = dirname + "/" + filename + ".dta"
367
+ global d = filename
368
+
369
+ use "$f", clear
370
+ drop seq
371
+ replace wdsp = "" if wdsp == "NA"
372
+ destring wdsp, gen(wind_speed)
373
+ replace prcp = "" if prcp == "NA"
374
+ destring prcp, gen(rain)
375
+ replace rh = "" if rh == "NA"
376
+ rename rh rh_s
377
+ destring rh_s, gen(rh)
378
+
379
+
380
+ drop wdsp prcp rh_s
381
+
382
+ sphdist, lat1(pollution_lat) lon1(pollution_lon) lat2(latitude) lon2(longitude) radians units(km) gen(distance)
383
+
384
+ save "$path/pw_station_distances/$d", replace
385
+ }
386
+
387
+ *==============================================================================*
388
+ *3. Generation of Alternative weather variables.
389
+ *==============================================================================*
390
+ **********************************************
391
+ ** Nearest Station (Conseptual Replication) **
392
+ **********************************************
393
+ filelist , dir($path/pw_station_distances) pattern(*.dta) norecur
394
+
395
+ * save a copy so that we can load each observation in the loop below
396
+ tempfile files
397
+ split filename, parse(".") generate(filename)
398
+ drop filename filename2
399
+ rename filename1 filename
400
+ save "files_2011_16", replace
401
+
402
+ * Nearest Station weather measure
403
+ forvalues i = 1/312 {
404
+ use "files_2011_16" in `i', clear
405
+ global f = dirname + "/" + filename + ".dta"
406
+ global d = filename
407
+
408
+ use "$f", clear
409
+ drop if rain == . | rh == . | temp == . | wind_speed == .
410
+ bysort pm10_n date: egen min_distance = min(distance)
411
+ gen closest =1 if distance == min_distance
412
+ keep if closest == 1
413
+ keep pm10_n date temp wind_speed rain rh
414
+ save "$path/Nearest/$d", replace
415
+ }
416
+
417
+ cd "$path/Nearest/"
418
+ clear
419
+ append using `: dir . files "*.dta"'
420
+ drop if pm10_n == .
421
+ isid pm10_n date
422
+ rename temp temp_n
423
+ rename rain rain_n
424
+ rename rh rh_n
425
+ rename wind_speed wind_speed_n
426
+
427
+ save "$path/output/nearest.dta", replace
428
+
429
+
430
+ ***************************************************
431
+ ** DWA (using all stations) (Robust Replication) **
432
+ ***************************************************
433
+ ** DWA using all stations
434
+ filelist , dir($path/pw_station_distances) pattern(*.dta) norecur
435
+
436
+ * save a copy so that we can load each observation in the loop below
437
+ tempfile files
438
+ split filename, parse(".") generate(filename)
439
+ drop filename filename2
440
+ rename filename1 filename
441
+ save "files_2011_16", replace
442
+
443
+ * DWA (No Limit)
444
+ forvalues i = 1/312 {
445
+ use "files_2011_16" in `i', clear
446
+ global f = dirname + "/" + filename + ".dta"
447
+ global d = filename
448
+
449
+ use "$f", clear
450
+
451
+ gen distance1 = 1/distance
452
+ bysort pm10_n date: egen total_distance1= total(distance1)
453
+
454
+
455
+ foreach var of varlist temp wind_speed rh rain {
456
+ gen `var'1 = `var'/distance
457
+ bysort pm10_n date: egen total_`var'1 = total(`var'1)
458
+ gen `var'_DWA = total_`var'1 / total_distance1
459
+ }
460
+
461
+ keep pm10_n date temp_DWA wind_speed_DWA rh_DWA rain_DWA
462
+
463
+ sum temp_DWA wind_speed_DWA rh_DWA rain_DWA
464
+
465
+ bysort pm10_n date: gen seq=_n
466
+ keep if seq == 1
467
+ drop seq
468
+
469
+ save "$path/DWA/$d", replace
470
+ }
471
+
472
+ cd "$path/DWA/"
473
+ clear
474
+ append using `: dir . files "*.dta"'
475
+ drop if pm10_n == .
476
+ isid pm10_n date
477
+
478
+
479
+ save "$path/output/DWA.dta", replace
480
+
481
+ * DWA (Only stations within 100km)
482
+ forvalues i = 1/312 {
483
+ use "$path/files_2011_16" in `i', clear
484
+ global f = dirname + "/" + filename + ".dta"
485
+ global d = filename
486
+
487
+ use "$f", clear
488
+
489
+ drop if distance > 100
490
+
491
+ gen distance1 = 1/distance
492
+ bysort pm10_n date: egen total_distance1= total(distance1)
493
+
494
+
495
+ foreach var of varlist temp wind_speed rh rain {
496
+ gen `var'1 = `var'/distance
497
+ bysort pm10_n date: egen total_`var'1 = total(`var'1)
498
+ gen `var'_DWA_100 = total_`var'1 / total_distance1
499
+ }
500
+
501
+ keep pm10_n date temp_DWA_100 wind_speed_DWA_100 rh_DWA_100 rain_DWA_100
502
+
503
+ sum temp_DWA_100 wind_speed_DWA_100 rh_DWA_100 rain_DWA_100
504
+
505
+ bysort pm10_n date: gen seq=_n
506
+ keep if seq == 1
507
+ drop seq
508
+
509
+ save "$path/DWA_100/$d", replace
510
+ }
511
+
512
+ cd "$path/DWA_100/"
513
+ clear
514
+ append using `: dir . files "*.dta"'
515
+ isid pm10_n date
516
+
517
+
518
+ save "$path/output/DWA_100.dta", replace
519
+
520
+ ** DWA using station only near by stations (500km)
521
+ filelist , dir($path/pw_station_distances) pattern(*.dta) norecur
522
+
523
+ * save a copy so that we can load each observation in the loop below
524
+ tempfile files
525
+ split filename, parse(".") generate(filename)
526
+ drop filename filename2
527
+ rename filename1 filename
528
+ save "$path/files_2011_16.dta", replace
529
+
530
+ * DWA (Only station within 500km)
531
+ forvalues i = 1/312 {
532
+ use "$path/files_2011_16" in `i', clear
533
+ global f = dirname + "/" + filename + ".dta"
534
+ global d = filename
535
+
536
+ use "$f", clear
537
+
538
+ drop if distance > 500
539
+
540
+ gen distance1 = 1/distance
541
+ bysort pm10_n date: egen total_distance1= total(distance1)
542
+
543
+
544
+ foreach var of varlist temp wind_speed rh rain {
545
+ gen `var'1 = `var'/distance
546
+ bysort pm10_n date: egen total_`var'1 = total(`var'1)
547
+ gen `var'_DWA_500 = total_`var'1 / total_distance1
548
+ }
549
+
550
+ keep pm10_n date temp_DWA_500 wind_speed_DWA_500 rh_DWA_500 rain_DWA_500
551
+
552
+ sum temp_DWA_500 wind_speed_DWA_500 rh_DWA_500 rain_DWA_500
553
+
554
+ bysort pm10_n date: gen seq=_n
555
+ keep if seq == 1
556
+ drop seq
557
+
558
+ save "$path/DWA_500/$d", replace
559
+ }
560
+
561
+ cd "$path/DWA_500/"
562
+ clear
563
+ append using `: dir . files "*.dta"'
564
+ isid pm10_n date
565
+
566
+
567
+ save "$path/output/DWA_500.dta", replace
568
+
569
+ *==============================================================================*
570
+ *4. Merging Weather Data files
571
+ *==============================================================================*
572
+ cd "$path/Output"
573
+ clear
574
+ use weather_1116.dta, clear
575
+ rename station_n pm10_n
576
+ merge 1:1 pm10_n date using nearest.dta
577
+ drop _m
578
+ merge 1:1 pm10_n date using DWA.dta
579
+ drop _m
580
+ merge 1:1 pm10_n date using DWA_100.dta
581
+ drop _m
582
+ merge 1:1 pm10_n date using DWA_500.dta
583
+ drop _m
584
+ rename pm10_n station_n
585
+ save "$path/output/weather_1116_alt.dta", replace
586
+
587
+
9/replication_package/Code/NOAA Weather Data (NEW!)/NOAA_download.R ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Library
2
+ library(GSODR)
3
+
4
+ #==============================================================================*
5
+ #0. Downloading weather station data!
6
+ #==============================================================================*
7
+ # Downloading NOAA weather station Data! (https://www.ncei.noaa.gov/data/global-summary-of-the-day/doc/readme.txt)
8
+
9
+ # Downloading & Data Cleaning!
10
+ China_weather_2011_F <- get_GSOD(years = 2011, country = "China")
11
+ China_weather_2011_S <- subset(China_weather_2011_F, select = c("STNID", "NAME", "YEARMODA","YEAR","MONTH","DAY", "TEMP", "WDSP", "PRCP", "RH", "LATITUDE", "LONGITUDE"))
12
+ China_weather_2012_F <- get_GSOD(years = 2012, country = "China")
13
+ China_weather_2012_S <- subset(China_weather_2012_F, select = c("STNID", "NAME", "YEARMODA","YEAR","MONTH","DAY", "TEMP", "WDSP", "PRCP", "RH", "LATITUDE", "LONGITUDE"))
14
+ China_weather_2013_F <- get_GSOD(years = 2013, country = "China")
15
+ China_weather_2013_S <- subset(China_weather_2013_F, select = c("STNID", "NAME", "YEARMODA","YEAR","MONTH","DAY", "TEMP", "WDSP", "PRCP", "RH", "LATITUDE", "LONGITUDE"))
16
+ China_weather_2014_F <- get_GSOD(years = 2014, country = "China")
17
+ China_weather_2014_S <- subset(China_weather_2014_F, select = c("STNID", "NAME", "YEARMODA","YEAR","MONTH","DAY", "TEMP", "WDSP", "PRCP", "RH", "LATITUDE", "LONGITUDE"))
18
+ China_weather_2015_F <- get_GSOD(years = 2015, country = "China")
19
+ China_weather_2015_S <- subset(China_weather_2015_F, select = c("STNID", "NAME", "YEARMODA","YEAR","MONTH","DAY", "TEMP", "WDSP", "PRCP", "RH", "LATITUDE", "LONGITUDE"))
20
+ China_weather_2016_F <- get_GSOD(years = 2016, country = "China")
21
+ China_weather_2016_S <- subset(China_weather_2016_F, select = c("STNID", "NAME", "YEARMODA","YEAR","MONTH","DAY", "TEMP", "WDSP", "PRCP", "RH", "LATITUDE", "LONGITUDE"))
22
+ # Creation of Weather Station Dataset!
23
+ china_weather_2011_16_S <- rbind(China_weather_2011_S, China_weather_2012_S, China_weather_2013_S, China_weather_2014_S, China_weather_2015_S, China_weather_2016_S)
24
+ rm(China_weather_2011_S, China_weather_2011_F, China_weather_2012_S, China_weather_2012_F, China_weather_2013_S, China_weather_2013_F, China_weather_2014_S, China_weather_2014_F, China_weather_2015_S, China_weather_2015_F, China_weather_2016_S, China_weather_2016_F)
25
+ write.csv(china_weather_2011_16_S, "/Volumes/External Drive A/Greenstone et al/NOAA Weather Data/China/china_weather_2011_16_v2.csv", row.names=TRUE)
26
+
27
+ # Checking if the weather data are in the correct units
28
+ summary(china_weather_2011_16_S)
9/replication_package/Code/Prepare_Data.do ADDED
@@ -0,0 +1,325 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ***Prepare Data for Tables/Figures Based on Raw Data using Stata 15 MP
2
+
3
+ clear all
4
+ set more off
5
+
6
+ *global path "/Users/`c(username)'/Dropbox/China_Pollution_Monitoring"
7
+
8
+ *==============================================================================*
9
+ *0. Set Up
10
+ *The most recent package versions are used as of March 2021.
11
+ *The estimates and output format may change slightly using different package versions.
12
+ *==============================================================================*
13
+ *Manually copy brain.ado from https://github.com/ThorstenDoherr/brain
14
+ net install rdrobust, from("https://raw.githubusercontent.com/rdpackages/rdrobust/master/stata") replace
15
+ net install rddensity, from("https://raw.githubusercontent.com/rdpackages/rddensity/master/stata") replace
16
+ local ssc_packages "reghdfe ftools sxpose tsspell geonear plotbeta outreg2 estout"
17
+ if !missing("`ssc_packages'") {
18
+ foreach pkg in "`ssc_packages'" {
19
+ * install using ssc, but avoid re-installing if already present
20
+ capture which `pkg'
21
+ if _rc == 111 {
22
+ dis "Installing `pkg'"
23
+ qui ssc install `pkg',replace
24
+ }
25
+ }
26
+ }
27
+
28
+ *==============================================================================*
29
+ *1. Generate station_day_1116.dta
30
+ *==============================================================================*
31
+ use "$path/Data/pollution_1116.dta",clear
32
+ merge 1:1 station_n date using "$path/Data/weather_1116.dta",nogen
33
+ rename station_n pm10_n
34
+ merge m:1 pm10_n using "$path/Data/station_list.dta",nogen
35
+ drop station_lat station_lon
36
+ save "$path/Data/station_day_1116.dta",replace
37
+
38
+ *==============================================================================*
39
+ *2. Generate did_ddl_match.dta: station-daily PM10 data for deadline stations with distance matching (Table 1B, columns 3-5)
40
+ *==============================================================================*
41
+ use "$path/Data/station_list.dta",clear
42
+ keep if auto_date==19359
43
+ rename pm10_n pm10_n1
44
+ save "$path/Data/temp/station_ddl_1.dta",replace
45
+
46
+ use "$path/Data/station_list.dta",clear
47
+ keep if auto_date==19724
48
+ save "$path/Data/temp/station_ddl_2.dta",replace
49
+
50
+ use "$path/Data/temp/station_ddl_1.dta",clear
51
+ geonear pm10_n1 station_lat station_lon using "$path/Data/temp/station_ddl_2.dta", n(pm10_n station_lat station_lon) long ellipsoid
52
+ keep if km_to_pm10_n<=400
53
+ save "$path/Data/temp/station_ddl_match.dta",replace
54
+
55
+ use "$path/Data/temp/station_ddl_match.dta",clear
56
+ keep pm10_n1
57
+ rename pm10_n1 pm10_n
58
+ gen treat=1
59
+ save "$path/Data/temp/station_ddl_treated.dta",replace
60
+
61
+ use "$path/Data/temp/station_ddl_match.dta",clear
62
+ keep pm10_n
63
+ gen treat=0
64
+ save "$path/Data/temp/station_ddl_control.dta",replace
65
+
66
+ use "$path/Data/station_day_1116.dta",clear
67
+ gen year=year(date)
68
+ keep if year==2012 | year==2013
69
+ joinby pm10_n using "$path/Data/temp/station_ddl_treated.dta"
70
+ save "$path/Data/temp/station_day_ddl_treated.dta",replace
71
+
72
+ use "$path/Data/station_day_1116.dta",clear
73
+ gen year=year(date)
74
+ keep if year==2012 | year==2013
75
+ joinby pm10_n using "$path/Data/temp/station_ddl_control.dta"
76
+ save "$path/Data/temp/station_day_ddl_control.dta",replace
77
+
78
+ use "$path/Data/temp/station_day_ddl_treated.dta",clear
79
+ append using "$path/Data/temp/station_day_ddl_control.dta"
80
+ drop year so2 no2 phase treat
81
+ gen l_pm10=log(pm10), after(pm10)
82
+ label variable l_pm10 "logarithm of pm10"
83
+ compress
84
+ save "$path/Data/did_ddl_match.dta",replace
85
+
86
+ *==============================================================================*
87
+ *3. Generate station_month.dta
88
+ *==============================================================================*
89
+ use "$path/Data/station_day_1116.dta",clear
90
+ gen month_date = mofd(date)
91
+ gen month_auto_date = mofd(auto_date)
92
+ format month* %tm
93
+ gen n_month = month_date - month_auto_date
94
+ gen after = (month_date >= month_auto_date)
95
+ drop month_date month_auto_date
96
+ gen year=year(date)
97
+ gen month=month(date)
98
+ foreach v of varlist pm10-rh{
99
+ bysort pm10_n year month: egen `v'_month=mean(`v')
100
+ drop `v'
101
+ rename `v'_month `v'
102
+ }
103
+ duplicates drop pm10_n year month,force
104
+ drop date
105
+ merge m:1 pm10_n year month using "$path/Data/aod_month.dta", keep(match) nogen
106
+ save "$path/Data/station_month.dta",replace
107
+
108
+ *==============================================================================*
109
+ *4. Generate city_month.dta to be added with corrected PM10 in Section 10
110
+ *for plotting Appendix Figure C
111
+ *==============================================================================*
112
+ use "$path/Data/station_month.dta",clear
113
+ foreach v of varlist pm10-aod{
114
+ bysort code_city year month: egen `v'_month=mean(`v')
115
+ drop `v'
116
+ rename `v'_month `v'
117
+ }
118
+ gsort code_city year month -auto_date
119
+ duplicates drop code_city year month,force
120
+ drop pm10_n so2 no2
121
+ save "$path/Data/city_month.dta",replace
122
+
123
+ *==============================================================================*
124
+ *5. Compare city PM10 in Jan-June in 2013 vs 2014
125
+ *==============================================================================*
126
+ use "$path/Data/city_month.dta",clear
127
+ gen period=0 if year==2013 & month>=1 & month<=6
128
+ replace period=1 if year==2014 & month>=1 & month<=6
129
+ drop if period==.
130
+ collapse (mean) pm10, by(code_city period)
131
+ reshape wide pm10, i(code_city) j(period)
132
+ gen diff_period=pm101-pm100
133
+ drop pm100 pm101
134
+ label variable diff_period "Mean Difference in PM10 between 2014 Jan-June and 2013 Jan-June"
135
+ save "$path/Data/temp/city_period_compare.dta",replace
136
+
137
+ *==============================================================================*
138
+ *6. Generate RD estimates for each city
139
+ *==============================================================================*
140
+ use "$path/Data/station_day_1116.dta",clear
141
+ levelsof code_city, local (p)
142
+ cap qui erase "$path/Results/rd_pm10_city.txt"
143
+ foreach y of local p{
144
+ use "$path/Data/station_day_1116.dta",clear
145
+ qui gen T=date-auto_date
146
+ qui gen month=month(date)
147
+ keep if code_city==`y'
148
+ cap qui reghdfe pm10 wind_speed rain temp rh, absorb(pm10_n month) res(resid_pm10_`y'_smw)
149
+ cap qui rdrobust resid_pm10_`y'_smw T, c(0) p(1) q(2) kernel(tri) vce(cluster pm10_n) masspoints(off)
150
+ cap outreg2 using "$path/Results/rd_pm10_city", excel dec(4) append ctitle(`y') addtext(Kernel, Tri., Station FE, Y, Month FE, Y, Weather, Y) sortvar(RD_Estimate)
151
+ }
152
+
153
+ ***import the city-level RD estimates
154
+ clear
155
+ import delimited "$path/Results/rd_pm10_city.txt", rowrange(2:5) colrange(2)
156
+ drop in 2
157
+ sxpose, clear
158
+ split _var2, parse("*")
159
+ split _var3, parse("(" ")")
160
+ drop _var3 _var22-_var31
161
+ rename _var1 code_city
162
+ rename _var2 rd_estimate_1116_raw
163
+ rename _var21 rd_estimate_1116
164
+ rename _var32 error_1116
165
+ destring code_city rd_estimate_1116 error_1116, replace
166
+ label variable rd_estimate_1116_raw "Raw RD Estimate"
167
+ label variable rd_estimate_1116 "RD_Estimate_1116"
168
+ label variable error_1116 "Standard error of RD estimate"
169
+ /*City 230100 and 510400 have a large number of missing PM10 prior to automation.
170
+ Some Stata/rdrobust version still generate RD estimates for the two cities with a warning:
171
+ "Estimates might be unreliable due to low number of effective observations"
172
+ An earlier Stata 15 MP/rdrobust version (Winter 2020) does not generate RD estimates for the two cities with the following warning:
173
+ "Not enough observations to perform calculations"
174
+ Therefore, we replace the RD estimate for the two cities with missing values for compatibility and consistency.
175
+ */
176
+ replace rd_estimate_1116_raw="" if rd_estimate_1116_raw!="" & (code_city==230100 | code_city==510400)
177
+ replace rd_estimate_1116=. if rd_estimate_1116!=. & (code_city==230100 | code_city==510400)
178
+ save "$path/Data/temp/city_rd_estimate.dta",replace
179
+ *==============================================================================*
180
+ *7. Generate dummy list_76 indicating cities with fewer missing observations prior to automation
181
+ *==============================================================================*
182
+ use "$path/Data/station_day_1116.dta", clear
183
+ drop no2-rh
184
+ gen T=date-auto_date
185
+ keep if T<0 & T>=-120
186
+ xtset pm10_n date
187
+ tsspell pm10
188
+ keep if pm10==.
189
+ gsort code_city pm10_n -_seq
190
+ duplicates drop pm10_n,force
191
+ sort code_city _seq
192
+ duplicates drop code_city,force
193
+ gen list_76=(_seq<60)
194
+ /*city 650100 has 56 (or 21) missing days pre (or post) automation, with large
195
+ RD estimate and standard error, thus the estimate is unreliable and dropped.
196
+ */
197
+ replace list_76=0 if code_city==650100
198
+ keep code_city list_76
199
+ save "$path/Data/temp/city_list_76.dta",replace
200
+ *==============================================================================*
201
+ *8. Merge city characteristics with city-level RD and differences in PM10
202
+ *==============================================================================*
203
+ use "$path/Data/city_info.dta",clear
204
+ merge 1:1 code_city using "$path/Data/temp/city_list_76.dta", nogen
205
+ merge 1:1 code_city using "$path/Data/temp/city_rd_estimate.dta", nogen
206
+ merge 1:1 code_city using "$path/Data/temp/city_period_compare.dta", nogen
207
+ gen sig=(substr(rd_estimate_1116_raw,-2,2)=="**")
208
+ *define RD dummy: also used for Table 2A columns 3-4
209
+ gen rd=1 if list_76==1 & sig==1 & rd_estimate_1116>0, after(phase)
210
+ replace rd=1 if list_76==0 & diff_period>=35 & diff_period!=.
211
+ replace rd=0 if rd==.
212
+ label variable rd "underreporting dummy"
213
+ drop sig
214
+ save "$path/Data/city_info_rd.dta",replace
215
+
216
+ *==============================================================================*
217
+ *9. Generate city-daily deadline data and city-monthly search data (Table 2A)
218
+ *==============================================================================*
219
+ use "$path/Data/station_day_1116.dta", clear
220
+ foreach v of varlist pm10-rh{
221
+ bysort code_city date: egen `v'_m=mean(`v')
222
+ drop `v'
223
+ rename `v'_m `v'
224
+ }
225
+ gsort code_city date -auto_date
226
+ duplicates drop code_city date,force
227
+ drop pm10_n
228
+ merge 1:1 code_city date using "$path/Data/mask_filter_search.dta", keep(match) nogen
229
+
230
+ ***add city RD dummy info for Table 2A: column 3-4
231
+ merge m:1 code_city using "$path/Data/city_info_rd.dta",nogen
232
+ drop list_76 rd_estimate_1116_raw-diff_period
233
+ save "$path/Data/temp/search_city_day.dta",replace
234
+
235
+ ***generate city-daily search for deadline cities (Table 2B)
236
+ gen year=year(date)
237
+ keep if year>=2012 & year<=2013
238
+ drop year phase pm10-so2 rd
239
+ keep if auto_date==19724 | auto_date==19359
240
+ save "$path/Data/did_ddl_search.dta",replace
241
+
242
+ ***aggregate to city-monthly level (Table 2A)
243
+ use "$path/Data/temp/search_city_day.dta",clear
244
+ gen year=year(date)
245
+ gen month=month(date)
246
+ gen month_date = mofd(date)
247
+ gen month_auto_date = mofd(auto_date)
248
+ format month* %tm
249
+ gen n_month = month_date - month_auto_date
250
+ drop month_date month_auto_date
251
+
252
+ foreach v of varlist pm10-pmmask {
253
+ bysort code_city n_month: egen `v'_m=mean(`v')
254
+ drop `v'
255
+ rename `v'_m `v'
256
+ }
257
+ duplicates drop code_city n_month,force
258
+ drop date so2 no2
259
+ foreach v of varlist pmmask filter{
260
+ gen l_`v'=log(`v'+1)
261
+ }
262
+ save "$path/Data/search_city_month.dta",replace
263
+
264
+ *==============================================================================*
265
+ *10. Correct city-month PM10 using neural network
266
+ *==============================================================================*
267
+ *do "$path/Codes/PM_correction.do"
268
+ set seed 123456
269
+ use "$path/Data/city_month.dta",clear
270
+ foreach v of var aod wind_speed temp rh rain{
271
+ gen `v'2=`v'^2
272
+ gen `v'3=`v'^3
273
+ gen `v'4=`v'^4
274
+ }
275
+ *** separate into training (70%) and testing (30%) sets within after data
276
+ gen random = runiform()
277
+ sort after random
278
+ bysort after: gen test_set = (_n < 0.3*_N)
279
+ replace test_set = . if after == 0
280
+ *** save sst as local
281
+ summ pm10 if test_set==1
282
+ scalar pm10mean = r(mean)
283
+ egen sst = sum((pm10-pm10mean)^2) if test_set == 1
284
+ summ sst
285
+ local sst = r(mean)
286
+ *** neural net
287
+ xi: brain define, input(aod aod2 aod3 aod4 temp rain rh wind_speed temp2 rain2 rh2 wind_speed2 temp3 rain3 rh3 wind_speed3 temp4 rain4 rh4 wind_speed4 i.month i.code_city) output(pm10) hidden(20 20)
288
+ brain train if test_set == 0, iter(300) eta(.5)
289
+ brain think pm10_ann
290
+ egen rbrain_ann = sum((pm10-pm10_ann)^2) if test_set==1
291
+ summ rbrain_ann
292
+ local rbrain_ann = r(mean)
293
+ di "R-sq. brain: " 1-(`rbrain_ann'/`sst')
294
+ ***polynomial
295
+ reghdfe pm10 aod aod2 aod3 aod4 temp rain rh wind_speed temp2 rain2 rh2 wind_speed2 temp3 rain3 rh3 wind_speed3 temp4 rain4 rh4 wind_speed4 if test_set == 0, absorb(month code_city) vce(cl code_city)
296
+ predict pm10_ols, xb
297
+ egen r_ols = sum((pm10-pm10_ols)^2) if test_set==1
298
+ summ r_ols
299
+ local r_ols = r(mean)
300
+ di "R-sq. brain: " 1-`r_ols'/`sst'
301
+ drop _I*
302
+ ***Corrected PM10 as appendix data for future use
303
+ gen pm10_corrected=pm10
304
+ replace pm10_corrected=pm10_ann if after==0 & pm10_ann !=.
305
+ drop sst rbrain_ann r_ols
306
+ save "$path/Data/city_month.dta",replace
307
+
308
+ keep code_city year month pm10 pm10_corrected
309
+ sort code_city year month
310
+ format %9.1f pm10 pm10_corrected
311
+ label variable pm10 "Reported PM10 (ug/m3)"
312
+ label variable pm10_corrected "Corrected PM10 (ug/m3)"
313
+ save "$path/Data/pm10_corrected.dta",replace
314
+
315
+ *==============================================================================*
316
+ *11. Add city RD dummy to city_month.dta for plotting Appendix Figure C
317
+ *==============================================================================*
318
+ use "$path/Data/city_month.dta",clear
319
+ merge m:1 code_city using "$path/Data/city_info_rd.dta",nogen
320
+ drop list_76 rd_estimate_1116_raw-diff_period
321
+ compress
322
+ save "$path/Data/city_month.dta",replace
323
+
324
+
325
+ ***The End
9/replication_package/Code/Prepare_Data_New.do ADDED
@@ -0,0 +1,447 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ***Prepare Data for Tables/Figures Based on Raw Data using Stata 15 MP
2
+
3
+ clear all
4
+ set more off
5
+
6
+ *global path "/Users/`c(username)'/Dropbox/China_Pollution_Monitoring"
7
+
8
+ *==============================================================================*
9
+ *0. Set Up
10
+ *The most recent package versions are used as of March 2021.
11
+ *The estimates and output format may change slightly using different package versions.
12
+ *==============================================================================*
13
+ *Manually copy brain.ado from https://github.com/ThorstenDoherr/brain
14
+ net install rdrobust, from("https://raw.githubusercontent.com/rdpackages/rdrobust/master/stata") replace
15
+ net install rddensity, from("https://raw.githubusercontent.com/rdpackages/rddensity/master/stata") replace
16
+ local ssc_packages "reghdfe ftools sxpose tsspell geonear plotbeta outreg2 estout"
17
+ if !missing("`ssc_packages'") {
18
+ foreach pkg in "`ssc_packages'" {
19
+ * install using ssc, but avoid re-installing if already present
20
+ capture which `pkg'
21
+ if _rc == 111 {
22
+ dis "Installing `pkg'"
23
+ qui ssc install `pkg',replace
24
+ }
25
+ }
26
+ }
27
+
28
+ /* Original Weather Data
29
+ *==============================================================================*
30
+ *1. Generate station_day_1116.dta
31
+ *==============================================================================*
32
+ use "$path/Data/pollution_1116.dta",clear
33
+ merge 1:1 station_n date using "$path/Data/weather_1116.dta",nogen
34
+ rename station_n pm10_n
35
+ merge m:1 pm10_n using "$path/Data/station_list.dta",nogen
36
+ drop station_lat station_lon
37
+ save "$path/Data/station_day_1116.dta",replace
38
+ */
39
+ *==============================================================================*
40
+ *1GG. Generate station_day_1116.dta (New!)
41
+ *==============================================================================*
42
+ use "$path/Data/pollution_1116.dta",clear
43
+ merge 1:1 station_n date using "$path/Data/weather_1116.dta",nogen // Merging Old Data File
44
+ merge 1:1 station_n date using "$path/Data/weather_1116_alt.dta",nogen //Merge with new altertaive weather data, generate in using alt_weather_var.do
45
+ rename station_n pm10_n
46
+ merge m:1 pm10_n using "$path/Data/station_list.dta",nogen
47
+ drop station_lat station_lon
48
+ save "$path/Data/station_day_1116.dta",replace
49
+
50
+ *==============================================================================*
51
+ *2. Generate did_ddl_match.dta: station-daily PM10 data for deadline stations with distance matching (Table 1B, columns 3-5)
52
+ *==============================================================================*
53
+ use "$path/Data/station_list.dta",clear
54
+ keep if auto_date==19359
55
+ rename pm10_n pm10_n1
56
+ save "$path/Data/temp/station_ddl_1.dta",replace
57
+
58
+ use "$path/Data/station_list.dta",clear
59
+ keep if auto_date==19724
60
+ save "$path/Data/temp/station_ddl_2.dta",replace
61
+
62
+ use "$path/Data/temp/station_ddl_1.dta",clear
63
+ geonear pm10_n1 station_lat station_lon using "$path/Data/temp/station_ddl_2.dta", n(pm10_n station_lat station_lon) long ellipsoid
64
+ keep if km_to_pm10_n<=400
65
+ save "$path/Data/temp/station_ddl_match.dta",replace
66
+
67
+ use "$path/Data/temp/station_ddl_match.dta",clear
68
+ keep pm10_n1
69
+ rename pm10_n1 pm10_n
70
+ gen treat=1
71
+ save "$path/Data/temp/station_ddl_treated.dta",replace
72
+
73
+ use "$path/Data/temp/station_ddl_match.dta",clear
74
+ keep pm10_n
75
+ gen treat=0
76
+ save "$path/Data/temp/station_ddl_control.dta",replace
77
+
78
+ use "$path/Data/station_day_1116.dta",clear
79
+ gen year=year(date)
80
+ keep if year==2012 | year==2013
81
+ joinby pm10_n using "$path/Data/temp/station_ddl_treated.dta"
82
+ save "$path/Data/temp/station_day_ddl_treated.dta",replace
83
+
84
+ use "$path/Data/station_day_1116.dta",clear
85
+ gen year=year(date)
86
+ keep if year==2012 | year==2013
87
+ joinby pm10_n using "$path/Data/temp/station_ddl_control.dta"
88
+ save "$path/Data/temp/station_day_ddl_control.dta",replace
89
+
90
+ use "$path/Data/temp/station_day_ddl_treated.dta",clear
91
+ append using "$path/Data/temp/station_day_ddl_control.dta"
92
+ drop year so2 no2 phase treat
93
+ gen l_pm10=log(pm10), after(pm10)
94
+ label variable l_pm10 "logarithm of pm10"
95
+ compress
96
+ save "$path/Data/did_ddl_match.dta",replace
97
+
98
+
99
+ *==============================================================================*
100
+ *2. Generate did_ddl_match.dta: station-daily AOD data for deadline stations with distance matching (Table 1B, columns 3-5)
101
+ *==============================================================================*
102
+ use "$path/Data/station_list.dta",clear
103
+ keep if auto_date==19359
104
+ rename pm10_n pm10_n1
105
+ save "$path/Data/temp/station_ddl_1.dta",replace
106
+
107
+ use "$path/Data/station_list.dta",clear
108
+ keep if auto_date==19724
109
+ save "$path/Data/temp/station_ddl_2.dta",replace
110
+
111
+ use "$path/Data/temp/station_ddl_1.dta",clear
112
+ geonear pm10_n1 station_lat station_lon using "$path/Data/temp/station_ddl_2.dta", n(pm10_n station_lat station_lon) long ellipsoid
113
+ keep if km_to_pm10_n<=400
114
+ save "$path/Data/temp/station_ddl_match.dta",replace
115
+
116
+ use "$path/Data/temp/station_ddl_match.dta",clear
117
+ keep pm10_n1
118
+ rename pm10_n1 pm10_n
119
+ gen treat=1
120
+ save "$path/Data/temp/station_ddl_treated.dta",replace
121
+
122
+ use "$path/Data/temp/station_ddl_match.dta",clear
123
+ keep pm10_n
124
+ gen treat=0
125
+ save "$path/Data/temp/station_ddl_control.dta",replace
126
+
127
+ use "$path/Data/station_day_1116.dta",clear
128
+ gen year=year(date)
129
+ keep if year==2012 | year==2013
130
+ joinby pm10_n using "$path/Data/temp/station_ddl_treated.dta"
131
+ save "$path/Data/temp/station_day_ddl_treated.dta",replace
132
+
133
+ use "$path/Data/station_day_1116.dta",clear
134
+ gen year=year(date)
135
+ keep if year==2012 | year==2013
136
+ joinby pm10_n using "$path/Data/temp/station_ddl_control.dta"
137
+ save "$path/Data/temp/station_day_ddl_control.dta",replace
138
+
139
+ use "$path/Data/temp/station_day_ddl_treated.dta",clear
140
+ append using "$path/Data/temp/station_day_ddl_control.dta"
141
+ drop year so2 no2 phase treat
142
+ gen l_pm10=log(pm10), after(pm10)
143
+ label variable l_pm10 "logarithm of pm10"
144
+ compress
145
+ save "$path/Data/did_ddl_match.dta",replace
146
+ *==============================================================================*
147
+ *3. Generate station_month.dta
148
+ *==============================================================================*
149
+ use "$path/Data/station_day_1116.dta",clear
150
+ gen month_date = mofd(date)
151
+ gen month_auto_date = mofd(auto_date)
152
+ format month* %tm
153
+ gen n_month = month_date - month_auto_date
154
+ gen after = (month_date >= month_auto_date)
155
+ drop month_date month_auto_date
156
+ gen year=year(date)
157
+ gen month=month(date)
158
+ foreach v of varlist pm10-rh{
159
+ bysort pm10_n year month: egen `v'_month=mean(`v')
160
+ drop `v'
161
+ rename `v'_month `v'
162
+ }
163
+ duplicates drop pm10_n year month,force
164
+ drop date
165
+ merge m:1 pm10_n year month using "$path/Data/aod_month.dta", keep(match) nogen
166
+ save "$path/Data/station_month.dta",replace
167
+
168
+ *==============================================================================*
169
+ *4. Generate city_month.dta to be added with corrected PM10 in Section 10
170
+ *for plotting Appendix Figure C
171
+ *==============================================================================*
172
+ use "$path/Data/station_month.dta",clear
173
+ foreach v of varlist pm10-aod{
174
+ bysort code_city year month: egen `v'_month=mean(`v')
175
+ drop `v'
176
+ rename `v'_month `v'
177
+ }
178
+ gsort code_city year month -auto_date
179
+ duplicates drop code_city year month,force
180
+ drop pm10_n so2 no2
181
+ save "$path/Data/city_month.dta",replace
182
+
183
+ *==============================================================================*
184
+ *5. Compare city PM10 in Jan-June in 2013 vs 2014
185
+ *==============================================================================*
186
+ use "$path/Data/city_month.dta",clear
187
+ gen period=0 if year==2013 & month>=1 & month<=6
188
+ replace period=1 if year==2014 & month>=1 & month<=6
189
+ drop if period==.
190
+ collapse (mean) pm10, by(code_city period)
191
+ reshape wide pm10, i(code_city) j(period)
192
+ gen diff_period=pm101-pm100
193
+ drop pm100 pm101
194
+ label variable diff_period "Mean Difference in PM10 between 2014 Jan-June and 2013 Jan-June"
195
+ save "$path/Data/temp/city_period_compare.dta",replace
196
+
197
+ *==============================================================================*
198
+ *6. Generate RD estimates for each city
199
+ *==============================================================================*
200
+ *Original
201
+ use "$path/Data/station_day_1116.dta",clear
202
+ levelsof code_city, local (p)
203
+ cap qui erase "$path/Results/rd_pm10_city.txt"
204
+ foreach y of local p{
205
+ use "$path/Data/station_day_1116.dta",clear
206
+ qui gen T=date-auto_date
207
+ qui gen month=month(date)
208
+ keep if code_city==`y'
209
+ cap qui reghdfe pm10 wind_speed rain temp rh, absorb(pm10_n month) res(resid_pm10_`y'_smw)
210
+ cap qui rdrobust resid_pm10_`y'_smw T, c(0) p(1) q(2) kernel(tri) vce(cluster pm10_n) masspoints(off)
211
+ cap outreg2 using "$path/Results/rd_pm10_city", excel dec(4) append ctitle(`y') addtext(Kernel, Tri., Station FE, Y, Month FE, Y, Weather, Y) sortvar(RD_Estimate)
212
+ }
213
+ ***import the city-level RD estimates
214
+ clear
215
+ import delimited "$path/Results/rd_pm10_city.txt", rowrange(2:5) colrange(2)
216
+ drop in 2
217
+ sxpose, clear
218
+ split _var2, parse("*")
219
+ split _var3, parse("(" ")")
220
+ drop _var3 _var22-_var31
221
+ rename _var1 code_city
222
+ rename _var2 rd_estimate_1116_raw
223
+ rename _var21 rd_estimate_1116
224
+ rename _var32 error_1116
225
+ destring code_city rd_estimate_1116 error_1116, replace
226
+ label variable rd_estimate_1116_raw "Raw RD Estimate"
227
+ label variable rd_estimate_1116 "RD_Estimate_1116"
228
+ label variable error_1116 "Standard error of RD estimate"
229
+ /*City 230100 and 510400 have a large number of missing PM10 prior to automation.
230
+ Some Stata/rdrobust version still generate RD estimates for the two cities with a warning:
231
+ "Estimates might be unreliable due to low number of effective observations"
232
+ An earlier Stata 15 MP/rdrobust version (Winter 2020) does not generate RD estimates for the two cities with the following warning:
233
+ "Not enough observations to perform calculations"
234
+ Therefore, we replace the RD estimate for the two cities with missing values for compatibility and consistency.
235
+ */
236
+ replace rd_estimate_1116_raw="" if rd_estimate_1116_raw!="" & (code_city==230100 | code_city==510400)
237
+ replace rd_estimate_1116=. if rd_estimate_1116!=. & (code_city==230100 | code_city==510400)
238
+ save "$path/Data/temp/city_rd_estimate.dta",replace
239
+
240
+
241
+ *==============================================================================*
242
+ *6b. Generate RD (for AOD) estimates for each city
243
+ *==============================================================================*
244
+ ** Original
245
+ use "$path/Data/station_month.dta" ,clear
246
+ levelsof code_city, local (p)
247
+ cap qui erase "$path/Results/rd_AOD_city.txt"
248
+ foreach y of local p{
249
+ use "$path/Data/station_month.dta",clear
250
+ keep if code_city==`y'
251
+ cap qui reghdfe aod wind_speed rain temp rh, absorb(pm10_n month) res(resid_aod_`y'_smw)
252
+ rdrobust resid_aod_`y'_smw n_month, c(0) p(1) q(2) kernel(tri) vce(cluster code_city) masspoints(off)
253
+ }
254
+
255
+ outreg2 using "$path/Results/rd_aod_city", excel dec(4) append ctitle(`y') addtext(Kernel, Tri., Station FE, Y, Month FE, Y, Weather, Y) sortvar(RD_Estimate)
256
+
257
+ use "$path/Data/station_month.dta",clear
258
+ keep if code_city==340200
259
+ reghdfe aod wind_speed rain temp rh, absorb(pm10_n month) res(resid_aod_340200_smw)
260
+ rdrobust resid_aod_340200_smw n_month, c(0) p(1) q(2) kernel(tri) masspoints(off)
261
+
262
+ ***import the city-level RD AOD estimates
263
+ clear
264
+ import delimited "$path/Results/rd_aod_city", rowrange(2:5) colrange(2)
265
+ drop in 2
266
+ sxpose, clear //command sxpose is unrecognized, solution install sxpose
267
+ split _var2, parse("*")
268
+ split _var3, parse("(" ")")
269
+ drop _var3 _var22-_var31
270
+ rename _var1 code_city
271
+ rename _var2 rd_estimate_1116_raw
272
+ rename _var21 rd_estimate_1116
273
+ rename _var32 error_1116
274
+ destring code_city rd_estimate_1116 error_1116, replace
275
+ label variable rd_estimate_1116_raw "Raw RD Estimate"
276
+ label variable rd_estimate_1116 "RD_Estimate_1116"
277
+ label variable error_1116 "Standard error of RD estimate"
278
+
279
+ /*City 230100 and 510400 have a large number of missing PM10 prior to automation.
280
+ Some Stata/rdrobust version still generate RD estimates for the two cities with a warning:
281
+ "Estimates might be unreliable due to low number of effective observations"
282
+ An earlier Stata 15 MP/rdrobust version (Winter 2020) does not generate RD estimates for the two cities with the following warning:
283
+ "Not enough observations to perform calculations"
284
+ Therefore, we replace the RD estimate for the two cities with missing values for compatibility and consistency.
285
+ */
286
+ replace rd_estimate_1116_raw="" if rd_estimate_1116_raw!="" & (code_city==230100 | code_city==510400)
287
+ replace rd_estimate_1116=. if rd_estimate_1116!=. & (code_city==230100 | code_city==510400)
288
+ save "$path/Data/temp/city_rd_aod_estimate.dta",replace
289
+
290
+ *==============================================================================*
291
+ *7. Generate dummy list_76 indicating cities with fewer missing observations prior to automation
292
+ *==============================================================================*
293
+ use "$path/Data/station_day_1116.dta", clear
294
+ drop no2-rh
295
+ gen T=date-auto_date
296
+ keep if T<0 & T>=-120
297
+ xtset pm10_n date
298
+ tsspell pm10
299
+ keep if pm10==.
300
+ gsort code_city pm10_n -_seq
301
+ duplicates drop pm10_n,force
302
+ sort code_city _seq
303
+ duplicates drop code_city,force
304
+ gen list_76=(_seq<60)
305
+ /*city 650100 has 56 (or 21) missing days pre (or post) automation, with large
306
+ RD estimate and standard error, thus the estimate is unreliable and dropped.
307
+ */
308
+ replace list_76=0 if code_city==650100
309
+ keep code_city list_76
310
+ save "$path/Data/temp/city_list_76.dta",replace
311
+ *==============================================================================*
312
+ *8. Merge city characteristics with city-level RD and differences in PM10
313
+ *==============================================================================*
314
+ use "$path/Data/city_info.dta",clear
315
+ merge 1:1 code_city using "$path/Data/temp/city_list_76.dta", nogen
316
+ merge 1:1 code_city using "$path/Data/temp/city_rd_estimate.dta", nogen
317
+ merge 1:1 code_city using "$path/Data/temp/city_period_compare.dta", nogen
318
+ gen sig=(substr(rd_estimate_1116_raw,-2,2)=="**")
319
+ *define RD dummy: also used for Table 2A columns 3-4
320
+ gen rd=1 if list_76==1 & sig==1 & rd_estimate_1116>0, after(phase)
321
+ replace rd=1 if list_76==0 & diff_period>=35 & diff_period!=.
322
+ replace rd=0 if rd==.
323
+ label variable rd "underreporting dummy"
324
+ drop sig
325
+ save "$path/Data/city_info_rd.dta",replace
326
+
327
+
328
+ *==============================================================================*
329
+ *8b. Merge city characteristics with city-level RD and differences in aod
330
+ *==============================================================================*
331
+ use "$path/Data/city_info.dta",clear
332
+ merge 1:1 code_city using "$path/Data/temp/city_list_76.dta", nogen
333
+ merge 1:1 code_city using "$path/Data/temp/city_rd_aod_estimate.dta", nogen
334
+ merge 1:1 code_city using "$path/Data/temp/city_period_compare.dta", nogen
335
+ gen sig=(substr(rd_estimate_1116_raw,-2,2)=="**")
336
+ save "$path/Data/city_info_rd_aod.dta",replace
337
+
338
+ *==============================================================================*
339
+ *9. Generate city-daily deadline data and city-monthly search data (Table 2A)
340
+ *==============================================================================*
341
+ use "$path/Data/station_day_1116.dta", clear
342
+ foreach v of varlist pm10-rh{
343
+ bysort code_city date: egen `v'_m=mean(`v')
344
+ drop `v'
345
+ rename `v'_m `v'
346
+ }
347
+ gsort code_city date -auto_date
348
+ duplicates drop code_city date,force
349
+ drop pm10_n
350
+ merge 1:1 code_city date using "$path/Data/mask_filter_search.dta", keep(match) nogen
351
+
352
+ ***add city RD dummy info for Table 2A: column 3-4
353
+ merge m:1 code_city using "$path/Data/city_info_rd.dta",nogen
354
+ drop list_76 rd_estimate_1116_raw-diff_period
355
+ save "$path/Data/temp/search_city_day.dta",replace
356
+
357
+ ***generate city-daily search for deadline cities (Table 2B)
358
+ gen year=year(date)
359
+ keep if year>=2012 & year<=2013
360
+ drop year phase pm10-so2 rd
361
+ keep if auto_date==19724 | auto_date==19359
362
+ save "$path/Data/did_ddl_search.dta",replace
363
+
364
+ ***aggregate to city-monthly level (Table 2A)
365
+ use "$path/Data/temp/search_city_day.dta",clear
366
+ gen year=year(date)
367
+ gen month=month(date)
368
+ gen month_date = mofd(date)
369
+ gen month_auto_date = mofd(auto_date)
370
+ format month* %tm
371
+ gen n_month = month_date - month_auto_date
372
+ drop month_date month_auto_date
373
+
374
+ foreach v of varlist pm10-pmmask {
375
+ bysort code_city n_month: egen `v'_m=mean(`v')
376
+ drop `v'
377
+ rename `v'_m `v'
378
+ }
379
+ duplicates drop code_city n_month,force
380
+ drop date so2 no2
381
+ foreach v of varlist pmmask filter{
382
+ gen l_`v'=log(`v'+1)
383
+ }
384
+ save "$path/Data/search_city_month.dta",replace
385
+
386
+ *==============================================================================*
387
+ *10. Correct city-month PM10 using neural network
388
+ *==============================================================================*
389
+ *do "$path/Codes/PM_correction.do"
390
+ set seed 123456
391
+ use "$path/Data/city_month.dta",clear
392
+ foreach v of var aod wind_speed temp rh rain{
393
+ gen `v'2=`v'^2
394
+ gen `v'3=`v'^3
395
+ gen `v'4=`v'^4
396
+ }
397
+ *** separate into training (70%) and testing (30%) sets within after data
398
+ gen random = runiform()
399
+ sort after random
400
+ bysort after: gen test_set = (_n < 0.3*_N)
401
+ replace test_set = . if after == 0
402
+ *** save sst as local
403
+ summ pm10 if test_set==1
404
+ scalar pm10mean = r(mean)
405
+ egen sst = sum((pm10-pm10mean)^2) if test_set == 1
406
+ summ sst
407
+ local sst = r(mean)
408
+ *** neural net
409
+ xi: brain define, input(aod aod2 aod3 aod4 temp rain rh wind_speed temp2 rain2 rh2 wind_speed2 temp3 rain3 rh3 wind_speed3 temp4 rain4 rh4 wind_speed4 i.month i.code_city) output(pm10) hidden(20 20)
410
+ brain train if test_set == 0, iter(300) eta(.5)
411
+ brain think pm10_ann
412
+ egen rbrain_ann = sum((pm10-pm10_ann)^2) if test_set==1
413
+ summ rbrain_ann
414
+ local rbrain_ann = r(mean)
415
+ di "R-sq. brain: " 1-(`rbrain_ann'/`sst')
416
+ ***polynomial
417
+ reghdfe pm10 aod aod2 aod3 aod4 temp rain rh wind_speed temp2 rain2 rh2 wind_speed2 temp3 rain3 rh3 wind_speed3 temp4 rain4 rh4 wind_speed4 if test_set == 0, absorb(month code_city) vce(cl code_city)
418
+ predict pm10_ols, xb
419
+ egen r_ols = sum((pm10-pm10_ols)^2) if test_set==1
420
+ summ r_ols
421
+ local r_ols = r(mean)
422
+ di "R-sq. brain: " 1-`r_ols'/`sst'
423
+ drop _I*
424
+ ***Corrected PM10 as appendix data for future use
425
+ gen pm10_corrected=pm10
426
+ replace pm10_corrected=pm10_ann if after==0 & pm10_ann !=.
427
+ drop sst rbrain_ann r_ols
428
+ save "$path/Data/city_month.dta",replace
429
+
430
+ keep code_city year month pm10 pm10_corrected
431
+ sort code_city year month
432
+ format %9.1f pm10 pm10_corrected
433
+ label variable pm10 "Reported PM10 (ug/m3)"
434
+ label variable pm10_corrected "Corrected PM10 (ug/m3)"
435
+ save "$path/Data/pm10_corrected.dta",replace
436
+
437
+ *==============================================================================*
438
+ *11. Add city RD dummy to city_month.dta for plotting Appendix Figure C
439
+ *==============================================================================*
440
+ use "$path/Data/city_month.dta",clear
441
+ merge m:1 code_city using "$path/Data/city_info_rd.dta",nogen
442
+ drop list_76 rd_estimate_1116_raw-diff_period
443
+ compress
444
+ save "$path/Data/city_month.dta",replace
445
+
446
+
447
+ ***The End
9/replication_package/Code/TS.do ADDED
@@ -0,0 +1,301 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ****This is the main program for appendix tables generated using Stata 15 MP
2
+
3
+ clear all
4
+ set more off
5
+
6
+ *global path "/Users/`c(username)'/Dropbox/China_Pollution_Monitoring"
7
+
8
+ *==============================================================================*
9
+ *Table A2. Summary Statistics by Year
10
+ *==============================================================================*
11
+ ***AOD
12
+ use "$path/Data/station_month",clear
13
+ qui levelsof year, loc(y)
14
+ qui foreach v of loc y {
15
+ estpost summ aod if year==`v'
16
+ est sto y`v'
17
+ }
18
+ esttab * using "$path/Results/Table_A2.csv", cell(mean(fmt(%9.2f)) sd(par)) mti collabels(none) noobs replace
19
+
20
+ ***pollution and weather
21
+ use "$path/Data/station_day_1116",clear
22
+ gen year=year(date)
23
+ qui levelsof year, loc(y)
24
+ qui foreach v of loc y {
25
+ estpost summ pm10 so2 no2 temp rain rh wind_speed if year==`v'
26
+ est sto y`v'
27
+ }
28
+ esttab * using "$path/Results/Table_A2.csv", cell(mean(fmt(%9.1f)) sd(par)) mti collabels(none) noobs nonum append
29
+
30
+ *==============================================================================*
31
+ *Table B2. Changes in Weather Conditions after Automation
32
+ *==============================================================================*
33
+ use "$path/Data/station_day_1116",clear
34
+ gen T=date-auto_date
35
+ gen month=month(date)
36
+ foreach y in temp rain rh wind_speed{
37
+ qui reghdfe `y', absorb(pm10_n month) res(resid_`y'_sm)
38
+ *all sample
39
+ qui rdrobust resid_`y'_sm T if temp!=. & rain!=. & rh!=. & wind_speed !=., c(0) p(1) q(2) kernel(tri) vce(cluster code_city) masspoints(off)
40
+ outreg2 using "$path/Results/Table_B2", excel dec(2) append ctitle(`y') addtext(Sample, All, Kernel, Tri., Station FE, Y, Month FE, Y)
41
+ qui rdrobust resid_`y'_sm T if temp!=. & rain!=. & rh!=. & wind_speed !=., c(0) p(1) q(2) kernel(epa) vce(cluster code_city) masspoints(off)
42
+ outreg2 using "$path/Results/Table_B2", excel dec(2) append ctitle(`y') addtext(Sample, All, Kernel, Epa., Station FE, Y, Month FE, Y)
43
+ qui rdrobust resid_`y'_sm T if temp!=. & rain!=. & rh!=. & wind_speed !=., c(0) p(1) q(2) kernel(uni) vce(cluster code_city) masspoints(off)
44
+ outreg2 using "$path/Results/Table_B2", excel dec(2) append ctitle(`y') addtext(Sample, All, Kernel, Uni., Station FE, Y, Month FE, Y)
45
+ *no missing PM10
46
+ qui rdrobust resid_`y'_sm T if temp!=. & rain!=. & rh!=. & wind_speed !=. & pm10 !=., c(0) p(1) q(2) kernel(tri) vce(cluster code_city) masspoints(off)
47
+ outreg2 using "$path/Results/Table_B2", excel dec(2) append ctitle(`y') addtext(Sample, No Missing PM10, Kernel, Tri., Station FE, Y, Month FE, Y)
48
+ qui rdrobust resid_`y'_sm T if temp!=. & rain!=. & rh!=. & wind_speed !=. & pm10 !=., c(0) p(1) q(2) kernel(epa) vce(cluster code_city) masspoints(off)
49
+ outreg2 using "$path/Results/Table_B2", excel dec(2) append ctitle(`y') addtext(Sample, No Missing PM10, Kernel, Epa., Station FE, Y, Month FE, Y)
50
+ qui rdrobust resid_`y'_sm T if temp!=. & rain!=. & rh!=. & wind_speed !=. & pm10 !=., c(0) p(1) q(2) kernel(uni) vce(cluster code_city) masspoints(off)
51
+ outreg2 using "$path/Results/Table_B2", excel dec(2) append ctitle(`y') addtext(Sample, No Missing PM10, Kernel, Uni., Station FE, Y, Month FE, Y)
52
+ }
53
+
54
+ *==============================================================================*
55
+ *Table B3. RD Estimates Using Alternative Kernel Weightings and Polynomials
56
+ *==============================================================================*
57
+ ***Panel A: station-day PM10
58
+ use "$path/Data/station_day_1116",clear
59
+ gen T=date-auto_date
60
+ gen month=month(date)
61
+ gen after=(T>0)
62
+ gen T2=T^2
63
+ gen T3=T^3
64
+ gen T4=T^4
65
+ gen after_T=after*T
66
+ gen after_T2=after*T2
67
+ gen after_T3=after*T3
68
+ gen after_T4=after*T4
69
+
70
+ qui reghdfe pm10 wind_speed rain temp rh, absorb(pm10_n month) res(resid_pm10_smw)
71
+ *kernel
72
+ qui rdrobust resid_pm10_smw T, c(0) p(1) q(2) kernel(tri) vce(cluster code_city) masspoints(off)
73
+ outreg2 using "$path/Results/Table_B3A_kernel_parametric_day", excel dec(1) append addtext(Kernel/Polynomial, Tri., Station FE, Y, Month FE, Y, Weather Controls, Y) ctitle(pm10) addstat(Obs.(Daily), e(N_h_l)+e(N_h_r), Bandwidth (Days), floor(e(h_l)))
74
+ qui rdrobust resid_pm10_smw T, c(0) p(1) q(2) kernel(epa) vce(cluster code_city) masspoints(off)
75
+ outreg2 using "$path/Results/Table_B3A_kernel_parametric_day", excel dec(1) append addtext(Kernel/Polynomial, Epa., Station FE, Y, Month FE, Y, Weather Controls, Y) ctitle(pm10) addstat(Obs.(Daily), e(N_h_l)+e(N_h_r), Bandwidth (Days), floor(e(h_l)))
76
+ qui rdrobust resid_pm10_smw T, c(0) p(1) q(2) kernel(uni) vce(cluster code_city) masspoints(off)
77
+ outreg2 using "$path/Results/Table_B3A_kernel_parametric_day", excel dec(1) append addtext(Kernel/Polynomial, Uni., Station FE, Y, Month FE, Y, Weather Controls, Y) ctitle(pm10) addstat(Obs.(Daily), e(N_h_l)+e(N_h_r), Bandwidth (Days), floor(e(h_l)))
78
+ *parametric
79
+ qui reghdfe pm10 after T after_T wind_speed rain temp rh, absorb(pm10_n month) vce(cluster code_city)
80
+ outreg2 using "$path/Results/Table_B3A_kernel_parametric_day", excel dec(1) append keep (after) addtext(Kernel/Polynomial, Linear, Station FE, Y, Month FE, Y, Weather Controls, Y) ctitle(pm10)
81
+ qui reghdfe pm10 after T after_T T2 after_T2 wind_speed rain temp rh, absorb(pm10_n month) vce(cluster code_city)
82
+ outreg2 using "$path/Results/Table_B3A_kernel_parametric_day", excel dec(1) append keep (after) addtext(Kernel/Polynomial, Quadratic, Station FE, Y, Month FE, Y, Weather Controls, Y) ctitle(pm10)
83
+ qui reghdfe pm10 after T after_T T2 after_T2 T3 after_T3 wind_speed rain temp rh, absorb(pm10_n month) vce(cluster code_city)
84
+ outreg2 using "$path/Results/Table_B3A_kernel_parametric_day", excel dec(1) append keep (after) addtext(Kernel/Polynomial, Cubic, Station FE, Y, Month FE, Y, Weather Controls, Y) ctitle(pm10)
85
+ qui reghdfe pm10 after T after_T T2 after_T2 T3 after_T3 T4 after_T4 wind_speed rain temp rh, absorb(pm10_n month) vce(cluster code_city)
86
+ outreg2 using "$path/Results/Table_B3A_kernel_parametric_day", excel dec(1) append keep (after) addtext(Kernel/Polynomial, Quartic, Station FE, Y, Month FE, Y, Weather Controls, Y) ctitle(pm10)
87
+
88
+ ***Panel B: station-month PM10 and AOD
89
+ use "$path/Data/station_month.dta",clear
90
+ foreach v in pm10 aod{
91
+ qui reghdfe `v' wind_speed rain temp rh, absorb(pm10_n month) res(resid_`v'_smw)
92
+ }
93
+
94
+ gen m2=n_month^2
95
+ gen m3=n_month^3
96
+ gen m4=n_month^4
97
+ gen after_m=after*n_month
98
+ gen after_m2=after*m2
99
+ gen after_m3=after*m3
100
+ gen after_m4=after*m4
101
+
102
+ foreach y of var pm10 aod {
103
+ if "`y'" == "pm10" local dec = 1
104
+ if "`y'" == "aod" local dec = 3
105
+ *kernel
106
+ qui rdrobust resid_`y'_smw n_month, c(0) p(1) q(2) kernel(tri) vce(cluster code_city) masspoints(off)
107
+ outreg2 using "$path/Results/Table_B3B_kernel_parametric_month", excel dec(`dec') append addtext(Kernel/Polynomial, Tri., Station FE, Y, Month FE, Y, Weather Controls, Y) ctitle(`y') addstat(Obs.(Monthly), e(N_h_l)+e(N_h_r), Bandwidth (Months), floor(e(h_l)))
108
+ qui rdrobust resid_`y'_smw n_month, c(0) p(1) q(2) kernel(epa) vce(cluster code_city) masspoints(off)
109
+ outreg2 using "$path/Results/Table_B3B_kernel_parametric_month", excel dec(`dec') append addtext(Kernel/Polynomial, Epa., Station FE, Y, Month FE, Y, Weather Controls, Y) ctitle(`y') addstat(Obs.(Monthly), e(N_h_l)+e(N_h_r), Bandwidth (Months), floor(e(h_l)))
110
+ qui rdrobust resid_`y'_smw n_month, c(0) p(1) q(2) kernel(uni) vce(cluster code_city) masspoints(off)
111
+ outreg2 using "$path/Results/Table_B3B_kernel_parametric_month", excel dec(`dec') append addtext(Kernel/Polynomial, Uni., Station FE, Y, Month FE, Y, Weather Controls, Y) ctitle(`y') addstat(Obs.(Monthly), e(N_h_l)+e(N_h_r), Bandwidth (Months), floor(e(h_l)))
112
+ ***parametric
113
+ qui reghdfe `y' after n_month after_m wind_speed rain temp rh, absorb(pm10_n month) vce(cluster code_city)
114
+ outreg2 using "$path/Results/Table_B3B_kernel_parametric_month", excel dec(`dec') append keep(after) addtext(Kernel/Polynomial, Linear, Station FE, Y, Month FE, Y, Weather Controls, Y) ctitle(`y')
115
+ qui reghdfe `y' after n_month after_m m2 after_m2 wind_speed rain temp rh, absorb(pm10_n month) vce(cluster code_city)
116
+ outreg2 using "$path/Results/Table_B3B_kernel_parametric_month", excel dec(`dec') append keep(after) addtext(Kernel/Polynomial, Quadratic, Station FE, Y, Month FE, Y, Weather Controls, Y) ctitle(`y')
117
+ qui reghdfe `y' after n_month after_m m2 after_m2 m3 after_m3 wind_speed rain temp rh, absorb(pm10_n month) vce(cluster code_city)
118
+ outreg2 using "$path/Results/Table_B3B_kernel_parametric_month", excel dec(`dec') append keep(after) addtext(Kernel/Polynomial, Cubic, Station FE, Y, Month FE, Y, Weather Controls, Y) ctitle(`y')
119
+ qui reghdfe `y' after n_month after_m m2 after_m2 m3 after_m3 m4 after_m4 wind_speed rain temp rh, absorb(pm10_n month) vce(cluster code_city)
120
+ outreg2 using "$path/Results/Table_B3B_kernel_parametric_month", excel dec(`dec') append keep(after) addtext(Kernel/Polynomial, Quartic, Station FE, Y, Month FE, Y, Weather Controls, Y) ctitle(`y')
121
+ }
122
+
123
+ *==============================================================================*
124
+ *Table B4. Automation and Reported PM10 in 76 Cities
125
+ *==============================================================================*
126
+ use "$path/Data/station_day_1116",clear
127
+ merge m:1 code_city using "$path/Data/city_info_rd.dta"
128
+ keep if list_76==1
129
+ gen T=date-auto_date
130
+ gen month=month(date)
131
+ qui reghdfe pm10 wind_speed rain temp rh, absorb(pm10_n month) res(resid_pm10_smw)
132
+ *raw
133
+ qui rdrobust pm10 T if temp!=. & rain!=. & rh!=. & wind_speed !=., c(0) p(1) q(2) kernel(tri) vce(cluster code_city) masspoints(off)
134
+ outreg2 using "$path/Results/Table_B4_76", excel dec(1) append ctitle(pm10) addtext(Sample, All) addstat(Obs.(Daily), e(N_h_l)+e(N_h_r), Bandwidth (Days), floor(e(h_l)))
135
+ *residual
136
+ qui rdrobust resid_pm10_smw T, c(0) p(1) q(2) kernel(tri) vce(cluster code_city) masspoints(off)
137
+ outreg2 using "$path/Results/Table_B4_76", excel dec(1) append ctitle(pm10) addtext(Sample, All, Station FE, Y, Month FE, Y, Weather Controls, Y) addstat(Obs.(Daily), e(N_h_l)+e(N_h_r), Bandwidth (Days), floor(e(h_l)))
138
+ *wave 1
139
+ qui rdrobust resid_pm10_smw T if phase==1, c(0) p(1) q(2) kernel(tri) vce(cluster code_city) masspoints(off)
140
+ outreg2 using "$path/Results/Table_B4_76", excel dec(1) append ctitle(pm10) addtext(Sample, Wave 1, Station FE, Y, Month FE, Y, Weather Controls, Y) addstat(Obs.(Daily), e(N_h_l)+e(N_h_r), Bandwidth (Days), floor(e(h_l)))
141
+ *wave 2
142
+ qui rdrobust resid_pm10_smw T if phase==2, c(0) p(1) q(2) kernel(tri) vce(cluster code_city) masspoints(off)
143
+ outreg2 using "$path/Results/Table_B4_76", excel dec(1) append ctitle(pm10) addtext(Sample, Wave 2, Station FE, Y, Month FE, Y, Weather Controls, Y) addstat(Obs.(Daily), e(N_h_l)+e(N_h_r), Bandwidth (Days), floor(e(h_l)))
144
+ *deadline
145
+ qui rdrobust resid_pm10_smw T if auto_date==19359 | auto_date==19724, c(0) p(1) q(2) kernel(tri) vce(cluster code_city) masspoints(off)
146
+ outreg2 using "$path/Results/Table_B4_76", excel dec(1) append ctitle(pm10) addtext(Sample, Deadline, Station FE, Y, Month FE, Y, Weather Controls, Y) addstat(Obs.(Daily), e(N_h_l)+e(N_h_r), Bandwidth (Days), floor(e(h_l)))
147
+
148
+ *==============================================================================*
149
+ *Table B6. Automation and PM10 Variability
150
+ *==============================================================================*
151
+ use "$path/Data/station_day_1116.dta",clear
152
+ gen year=year(date)
153
+ gen month=month(date)
154
+ gen T = date - auto_date
155
+ gen n_month=floor(T/30)
156
+ bysort pm10_n n_month: egen sd_pm10=sd(pm10)
157
+ foreach v of var pm10-rh{
158
+ bysort pm10_n n_month: egen `v'_m=mean(`v')
159
+ drop `v'
160
+ rename `v'_m `v'
161
+ }
162
+ duplicates drop pm10_n n_month,force
163
+ qui reghdfe sd_pm10 wind_speed rain temp rh, absorb(pm10_n month) res(resid_sd_pm10_smw)
164
+ *residual
165
+ qui rdrobust resid_sd_pm10_smw n_month, c(0) p(1) q(2) kernel(tri) vce(cluster code_city) masspoints(off)
166
+ outreg2 using "$path/Results/Table_B6_SD", excel dec(1) append ctitle(All) addtext(Station FE, Y, Month FE, Y, Weather Controls, Y, Kernel Function, Tri.) addstat(Obs.(Monthly), e(N_h_l)+e(N_h_r), Bandwidth (Months), floor(e(h_l)))
167
+ *wave1
168
+ qui rdrobust resid_sd_pm10_smw n_month if phase==1, c(0) p(1) q(2) kernel(tri) vce(cluster code_city) masspoints(off)
169
+ outreg2 using "$path/Results/Table_B6_SD", excel dec(1) append ctitle(Wave 1) addtext(Station FE, Y, Month FE, Y, Weather Controls, Y, Kernel Function, Tri.) addstat(Obs.(Monthly), e(N_h_l)+e(N_h_r), Bandwidth (Months), floor(e(h_l)))
170
+ *wave2
171
+ qui rdrobust resid_sd_pm10_smw n_month if phase==2, c(0) p(1) q(2) kernel(tri) vce(cluster code_city) masspoints(off)
172
+ outreg2 using "$path/Results/Table_B6_SD", excel dec(1) append ctitle(Wave 2) addtext(Station FE, Y, Month FE, Y, Weather Controls, Y, Kernel Function, Tri.) addstat(Obs.(Monthly), e(N_h_l)+e(N_h_r), Bandwidth (Months), floor(e(h_l)))
173
+ *deadline
174
+ qui rdrobust resid_sd_pm10_smw n_month if auto_date==19359 | auto_date==19724, c(0) p(1) q(2) kernel(tri) vce(cluster code_city) masspoints(off)
175
+ outreg2 using "$path/Results/Table_B6_SD", excel dec(1) append ctitle(Deadline) addtext(Station FE, Y, Month FE, Y, Weather Controls, Y, Kernel Function, Tri.) addstat(Obs.(Monthly), e(N_h_l)+e(N_h_r), Bandwidth (Months), floor(e(h_l)))
176
+
177
+ *==============================================================================*
178
+ *Table B7. Automation and Reported SO2 and NO2
179
+ *==============================================================================*
180
+ use "$path/Data/station_day_1116",clear
181
+ gen T=date-auto_date
182
+ gen month=month(date)
183
+ foreach y of var so2 no2{
184
+ qui reghdfe `y' wind_speed rain temp rh, absorb(pm10_n month) res(resid_`y'_smw)
185
+ *residual
186
+ qui rdrobust resid_`y'_smw T, c(0) p(1) q(2) kernel(tri) vce(cluster code_city) masspoints(off)
187
+ outreg2 using "$path/Results/Table_B7_SO2_NO2", excel dec(2) append ctitle(`y'_All) addtext(Station FE, Y, Month FE, Y, Weather Controls, Y, Kernel Function, Tri.) addstat(`y' Obs., e(N_h_l)+e(N_h_r), `y' Bandwidth, floor(e(h_l)))
188
+ *wave1
189
+ qui rdrobust resid_`y'_smw T if phase==1, c(0) p(1) q(2) kernel(tri) vce(cluster code_city) masspoints(off)
190
+ outreg2 using "$path/Results/Table_B7_SO2_NO2", excel dec(2) append ctitle(`y'_Wave 1) addtext(Station FE, Y, Month FE, Y, Weather Controls, Y, Kernel Function, Tri.) addstat(`y' Obs., e(N_h_l)+e(N_h_r), `y' Bandwidth, floor(e(h_l)))
191
+ *wave2
192
+ qui rdrobust resid_`y'_smw T if phase==2, c(0) p(1) q(2) kernel(tri) vce(cluster code_city) masspoints(off)
193
+ outreg2 using "$path/Results/Table_B7_SO2_NO2", excel dec(2) append ctitle(`y'_Wave 2) addtext(Station FE, Y, Month FE, Y, Weather Controls, Y, Kernel Function, Tri.) addstat(`y' Obs., e(N_h_l)+e(N_h_r), `y' Bandwidth, floor(e(h_l)))
194
+ *deadline
195
+ qui rdrobust resid_`y'_smw T if auto_date==19359 | auto_date==19724, c(0) p(1) q(2) kernel(tri) vce(cluster code_city) masspoints(off)
196
+ outreg2 using "$path/Results/Table_B7_SO2_NO2", excel dec(2) append ctitle(`y'_Deadline) addtext(Station FE, Y, Month FE, Y, Weather Controls, Y, Kernel Function, Tri.) addstat(`y' Obs., e(N_h_l)+e(N_h_r), `y' Bandwidth, floor(e(h_l)))
197
+ }
198
+
199
+ *==============================================================================*
200
+ *Table B8. Change in PM10 Reporting Standard
201
+ *==============================================================================*
202
+ use "$path/Data/station_day_1116.dta",clear
203
+ gen T=date-auto_date
204
+ gen month=month(date)
205
+ gen miss1=1 if pm10==. & T <0 & T>=-365
206
+ gen miss2=1 if pm10==. & T >=0 & T<365
207
+ gen n1=1 if T <0 & T>=-365
208
+ gen n2=1 if T >=0 & T<365
209
+
210
+ bysort pm10_n: egen miss_before_y=sum(miss1)
211
+ bysort pm10_n: egen miss_after_y=sum(miss2)
212
+ bysort pm10_n: egen n_before_y=sum(n1)
213
+ bysort pm10_n: egen n_after_y=sum(n2)
214
+
215
+ gen miss_before_ratio=miss_before_y/n_before_y
216
+ qui reghdfe pm10 wind_speed rain temp rh, absorb(pm10_n month) res(resid_pm10_smw)
217
+
218
+ foreach v in 10 15 20 25 30{
219
+ *residual
220
+ qui rdrobust resid_pm10_smw T if miss_before_ratio<=`v'/100, c(0) p(1) q(2) kernel(tri) vce(cluster code_city) masspoints(off)
221
+ outreg2 using "$path/Results/Table_B8_miss_before_ratio_1y", excel dec(1) append ctitle(pm10) addtext(Pre-Missing PM10, ≤`v'%, Sample, All, Station FE, Y, Month FE, Y, Weather Controls, Y) addstat(Effective Obs, e(N_h_l)+e(N_h_r), Bandwidth, floor(e(h_l)))
222
+ }
223
+
224
+ *==============================================================================*
225
+ *Table B9. RD Density Test at Air Quality Thresholds
226
+ *==============================================================================*
227
+ use "$path/Data/station_day_1116.dta",clear
228
+ gen T=date-auto_date
229
+ log using "$path/Data/temp/temp1.log", replace
230
+ foreach v in 50 150 250 350 420 500 600 {
231
+ rddensity pm10 if T>=0, c(`v') p(1) q(2) kernel(triangular) nomasspoints
232
+ rddensity pm10 if T>=0, c(`v') p(1) q(2) kernel(epanechnikov) nomasspoints
233
+ rddensity pm10 if T>=0, c(`v') p(1) q(2) kernel(uniform) nomasspoints
234
+ }
235
+ log close
236
+
237
+ clear
238
+ infix str3 cutoff 6-18 str12 kernel 69-80 str6 T 24-30 str6 P_value 37-42 using "$path/Data/temp/temp1.log"
239
+ keep if trim(cutoff)=="c = 50.000" |trim(cutoff)=="c = 150.000" |trim(cutoff)=="c = 250.000" |trim(cutoff)=="c = 350.000" |trim(cutoff)=="c = 420.000" |trim(cutoff)=="c = 600.000" |trim(cutoff)=="Robust"| trim(kernel)=="triangular"| trim(kernel)=="epanechnikov"| trim(kernel)=="uniform"
240
+ replace cutoff=cutoff[_n-2] if cutoff=="Robust"
241
+ replace kernel=kernel[_n-1] if kernel==""
242
+ drop if cutoff=="Number of obs" | kernel=="709659"
243
+ export excel using "$path/Results/Table_B9_Threshold", replace firstrow(variables)
244
+
245
+ *==============================================================================*
246
+ *Table B10. Automation and Association between AOD and PM10 (Standardized)
247
+ *==============================================================================*
248
+ ***station-month
249
+ use "$path/Data/station_month.dta",clear
250
+ set matsize 5000
251
+ egen year_month=group(year month)
252
+
253
+ log using "$path/Data/temp/temp2.log", replace
254
+ pwcorr aod pm10 if after==0, sig
255
+ pcorr aod pm10 temp rh rain wind_speed if after==0
256
+ xi: pcorr aod pm10 temp rh rain wind_speed i.year_month if after==0
257
+ xi: pcorr aod pm10 temp rh rain wind_speed i.year_month i.pm10_n if after==0
258
+ pwcorr aod pm10 if after==1, sig
259
+ pcorr aod pm10 temp rh rain wind_speed if after==1
260
+ xi: pcorr aod pm10 temp rh rain wind_speed i.year_month if after==1
261
+ xi: pcorr aod pm10 temp rh rain wind_speed i.year_month i.pm10_n if after==1
262
+ log close
263
+
264
+ clear
265
+ infix str4 obs 1-4 str12 thecorr 1-12 str6 partcorr 17-23 str6 thesig 73-78 using "$path/Data/temp/temp2.log"
266
+ keep if trim(thecorr)=="pm10" | trim(obs)=="(obs"
267
+ export excel using "$path/Results/Table_B10_PM10_AOD", replace
268
+
269
+ *==============================================================================*
270
+ *Table D1. Association between Baidu Search Index and Taobao Sales Index
271
+ *==============================================================================*
272
+ use "$path/Data/search_sale.dta",clear
273
+ foreach v in mask filter{
274
+ qui reghdfe l_taobao_`v' l_`v' wind_speed rain temp rh, absorb(code_city) vce(cluster code_city)
275
+ qui outreg2 using "$path/Results/Table_D1_sale_search", excel dec(2) append drop(wind_speed rain temp rh) ctitle(l_taobao_`v') addtext(Weather Controls, Y, City FE, Y)
276
+ qui reghdfe l_taobao_`v' l_`v' wind_speed rain temp rh, absorb(code_city month) vce(cluster code_city)
277
+ qui outreg2 using "$path/Results/Table_D1_sale_search", excel dec(2) append drop(wind_speed rain temp rh) ctitle(l_taobao_`v') addtext(Weather Controls, Y, City FE, Y, Month FE, Y)
278
+ }
279
+
280
+ *==============================================================================*
281
+ *Table D3: City-Month Online Search in Deadline and Non-Deadline Cities
282
+ *==============================================================================*
283
+ use "$path/Data/search_city_month.dta",clear
284
+ foreach y in pmmask filter l_pmmask l_filter {
285
+ cap qui reghdfe `y', absorb(code_city month) res(resid_`y'_sm)
286
+ cap qui reghdfe `y' wind_speed rain temp rh, absorb(code_city month) res(resid_`y'_smw)
287
+ *ddl in normal and manipulated
288
+ qui rdrobust resid_`y'_sm n_month if auto_date==19359 | auto_date==19724, c(0) p(1) q(2) kernel(tri) vce(cluster code_city) masspoints(off)
289
+ outreg2 using "$path/Results/Table_D3_ddl_non_ddl", excel dec(2) append ctitle(`y') addtext(Deadline, Y, Sample, All, City FE, Y, Month FE, Y) addstat(Effective Obs, e(N_h_l)+e(N_h_r), Bandwidth, floor(e(h_l)))
290
+ qui rdrobust resid_`y'_smw n_month if auto_date==19359 | auto_date==19724, c(0) p(1) q(2) kernel(tri) vce(cluster code_city) masspoints(off)
291
+ outreg2 using "$path/Results/Table_D3_ddl_non_ddl", excel dec(2) append ctitle(`y') addtext(Deadline, Y, Sample, All, City FE, Y, Month FE, Y, Weather Controls, Y) addstat(Effective Obs, e(N_h_l)+e(N_h_r), Bandwidth, floor(e(h_l)))
292
+
293
+ *non_ddl in normal and manipulated
294
+ qui rdrobust resid_`y'_sm n_month if auto_date!=19359 & auto_date!=19724, c(0) p(1) q(2) kernel(tri) vce(cluster code_city) masspoints(off)
295
+ outreg2 using "$path/Results/Table_D3_ddl_non_ddl", excel dec(2) append ctitle(`y') addtext(Deadline, N, Sample, All, City FE, Y, Month FE, Y) addstat(Effective Obs, e(N_h_l)+e(N_h_r), Bandwidth, floor(e(h_l)))
296
+ qui rdrobust resid_`y'_smw n_month if auto_date!=19359 & auto_date!=19724, c(0) p(1) q(2) kernel(tri) vce(cluster code_city) masspoints(off)
297
+ outreg2 using "$path/Results/Table_D3_ddl_non_ddl", excel dec(2) append ctitle(`y') addtext(Deadline, N, Sample, All, City FE, Y, Month FE, Y, Weather Controls, Y) addstat(Effective Obs, e(N_h_l)+e(N_h_r), Bandwidth, floor(e(h_l)))
298
+ }
299
+
300
+
301
+ ***The End
9/replication_package/Code/TS_NEW_1.do ADDED
@@ -0,0 +1,393 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ****This is the main program for appendix tables generated using Stata 15 MP
2
+
3
+ clear all
4
+ set more off
5
+
6
+ *global path "/Users/`c(username)'/Dropbox/China_Pollution_Monitoring"
7
+ *==============================================================================*
8
+ *Table 1. Robustness Test of Table 1 - Panel C - Only Near by stations.
9
+ *==============================================================================*
10
+ ** Only Stations within 500km
11
+ use "$path/Data/station_day_1116",clear
12
+ gen T=date-auto_date
13
+ gen month=month(date)
14
+ qui reghdfe pm10 wind_speed_DWA_500 rain_DWA_500 temp_DWA_500 rh_DWA_500, absorb(pm10_n month) res(resid_pm10_smw)
15
+ *raw
16
+ qui rdrobust pm10 T if temp_DWA_500!=. & rain_DWA_500!=. & rh_DWA_500!=. & wind_speed_DWA_500 !=., c(0) p(1) q(2) kernel(tri) vce(cluster code_city) masspoints(off)
17
+ outreg2 using "$path2/Table1_A1_GG_PC_A1", excel replace ctitle(pm10) addtext(Sample, All) addstat(Obs.(Daily), e(N_h_l)+e(N_h_r), Bandwidth (Days), floor(e(h_l))) tex pvalue
18
+ *residual
19
+ qui rdrobust resid_pm10_smw T, c(0) p(1) q(2) kernel(tri) vce(cluster code_city) masspoints(off)
20
+ outreg2 using "$path2/Table1_A1_GG_PC_A1", excel append ctitle(pm10) addtext(Sample, All, Station FE, Y, Month FE, Y, Weather Controls, Y) addstat(Obs.(Daily), e(N_h_l)+e(N_h_r), Bandwidth (Days), floor(e(h_l))) tex pvalue
21
+ *wave 1
22
+ qui rdrobust resid_pm10_smw T if phase==1, c(0) p(1) q(2) kernel(tri) vce(cluster code_city) masspoints(off)
23
+ outreg2 using "$path2/Table1_A1_GG_PC_A1", excel append ctitle(pm10) addtext(Sample, Wave 1, Station FE, Y, Month FE, Y, Weather Controls, Y) addstat(Obs.(Daily), e(N_h_l)+e(N_h_r), Bandwidth (Days), floor(e(h_l))) tex pvalue
24
+ *wave 2
25
+ qui rdrobust resid_pm10_smw T if phase==2, c(0) p(1) q(2) kernel(tri) vce(cluster code_city) masspoints(off)
26
+ outreg2 using "$path2/Table1_A1_GG_PC_A1", excel append ctitle(pm10) addtext(Sample, Wave 2, Station FE, Y, Month FE, Y, Weather Controls, Y) addstat(Obs.(Daily), e(N_h_l)+e(N_h_r), Bandwidth (Days), floor(e(h_l))) tex pvalue
27
+ *deadline
28
+ qui rdrobust resid_pm10_smw T if auto_date==19359 | auto_date==19724, c(0) p(1) q(2) kernel(tri) vce(cluster code_city) masspoints(off)
29
+ outreg2 using "$path2/Table1_A1_GG_PC_A1", excel append ctitle(pm10) addtext(Sample, Deadline, Station FE, Y, Month FE, Y, Weather Controls, Y) addstat(Obs.(Daily), e(N_h_l)+e(N_h_r), Bandwidth (Days), floor(e(h_l))) tex pvalue
30
+
31
+ ***Row 2: Monthly AOD
32
+ use "$path/Data/station_month.dta",clear
33
+ qui reghdfe aod wind_speed_DWA_500 rain_DWA_500 temp_DWA_500 rh_DWA_500, absorb(pm10_n month) res(resid_aod_smw)
34
+ *raw
35
+ qui rdrobust aod n_month if temp_DWA_500!=. & rain_DWA_500!=. & rh_DWA_500!=. & wind_speed_DWA_500 !=. & resid_aod_smw!=., c(0) p(1) q(2) kernel(tri) vce(cluster code_city) masspoints(off)
36
+ outreg2 using "$path2/Table1_A2_GG_PC_A1", excel replace ctitle(aod) addtext(Sample, All) addstat(Obs.(Monthly), e(N_h_l)+e(N_h_r), Bandwidth (Months), floor(e(h_l))) tex pvalue
37
+ *residual
38
+ qui rdrobust resid_aod_smw n_month, c(0) p(1) q(2) kernel(tri) vce(cluster code_city) masspoints(off)
39
+ outreg2 using "$path2/Table1_A2_GG_PC_A1", excel append ctitle(aod) addtext(Sample, All, Station FE, Y, Month FE, Y, Weather Controls, Y) addstat(Obs.(Monthly), e(N_h_l)+e(N_h_r), Bandwidth (Months), floor(e(h_l))) tex pvalue
40
+ *wave 1
41
+ qui rdrobust resid_aod_smw n_month if phase==1, c(0) p(1) q(2) kernel(tri) vce(cluster code_city) masspoints(off)
42
+ outreg2 using "$path2/Table1_A2_GG_PC_A1", excel append ctitle(aod) addtext(Sample, Wave 1, Station FE, Y, Month FE, Y, Weather Controls, Y) addstat(Obs.(Monthly), e(N_h_l)+e(N_h_r), Bandwidth (Months), floor(e(h_l))) tex pvalue
43
+ *wave 2
44
+ qui rdrobust resid_aod_smw n_month if phase==2, c(0) p(1) q(2) kernel(tri) vce(cluster code_city) masspoints(off)
45
+ outreg2 using "$path2/Table1_A2_GG_PC_A1", excel append ctitle(aod) addtext(Sample, Wave 2, Station FE, Y, Month FE, Y, Weather Controls, Y) addstat(Obs.(Monthly), e(N_h_l)+e(N_h_r), Bandwidth (Months), floor(e(h_l))) tex pvalue
46
+ *deadline
47
+ qui rdrobust resid_aod_smw n_month if auto_date==19359 | auto_date==19724, c(0) p(1) q(2) kernel(tri) vce(cluster code_city) masspoints(off)
48
+ outreg2 using "$path2/Table1_A2_GG_PC_A1", excel append ctitle(aod) addtext(Sample, Deadline, Station FE, Y, Month FE, Y, Weather Controls, Y) addstat(Obs.(Monthly), e(N_h_l)+e(N_h_r), Bandwidth (Months), floor(e(h_l))) tex pvalue
49
+
50
+
51
+ ** Only Stations within 100km
52
+ use "$path/Data/station_day_1116",clear
53
+ gen T=date-auto_date
54
+ gen month=month(date)
55
+ qui reghdfe pm10 wind_speed_DWA_100 rain_DWA_100 temp_DWA_100 rh_DWA_100, absorb(pm10_n month) res(resid_pm10_smw)
56
+ *raw
57
+ qui rdrobust pm10 T if temp_DWA_100!=. & rain_DWA_100!=. & rh_DWA_100!=. & wind_speed_DWA_100 !=., c(0) p(1) q(2) kernel(tri) vce(cluster code_city) masspoints(off)
58
+ outreg2 using "$path2/Table1_A1_GG_PC_A2", excel replace ctitle(pm10) addtext(Sample, All) addstat(Obs.(Daily), e(N_h_l)+e(N_h_r), Bandwidth (Days), floor(e(h_l))) tex pvalue
59
+ *residual
60
+ qui rdrobust resid_pm10_smw T, c(0) p(1) q(2) kernel(tri) vce(cluster code_city) masspoints(off)
61
+ outreg2 using "$path2/Table1_A1_GG_PC_A2", excel append ctitle(pm10) addtext(Sample, All, Station FE, Y, Month FE, Y, Weather Controls, Y) addstat(Obs.(Daily), e(N_h_l)+e(N_h_r), Bandwidth (Days), floor(e(h_l))) tex pvalue
62
+ *wave 1
63
+ qui rdrobust resid_pm10_smw T if phase==1, c(0) p(1) q(2) kernel(tri) vce(cluster code_city) masspoints(off)
64
+ outreg2 using "$path2/Table1_A1_GG_PC_A2", excel append ctitle(pm10) addtext(Sample, Wave 1, Station FE, Y, Month FE, Y, Weather Controls, Y) addstat(Obs.(Daily), e(N_h_l)+e(N_h_r), Bandwidth (Days), floor(e(h_l))) tex pvalue
65
+ *wave 2
66
+ qui rdrobust resid_pm10_smw T if phase==2, c(0) p(1) q(2) kernel(tri) vce(cluster code_city) masspoints(off)
67
+ outreg2 using "$path2/Table1_A1_GG_PC_A2", excel append ctitle(pm10) addtext(Sample, Wave 2, Station FE, Y, Month FE, Y, Weather Controls, Y) addstat(Obs.(Daily), e(N_h_l)+e(N_h_r), Bandwidth (Days), floor(e(h_l))) tex pvalue
68
+ *deadline
69
+ qui rdrobust resid_pm10_smw T if auto_date==19359 | auto_date==19724, c(0) p(1) q(2) kernel(tri) vce(cluster code_city) masspoints(off)
70
+ outreg2 using "$path2/Table1_A1_GG_PC_A2", excel append ctitle(pm10) addtext(Sample, Deadline, Station FE, Y, Month FE, Y, Weather Controls, Y) addstat(Obs.(Daily), e(N_h_l)+e(N_h_r), Bandwidth (Days), floor(e(h_l))) tex pvalue
71
+
72
+ ***Row 2: Monthly AOD
73
+ use "$path/Data/station_month.dta",clear
74
+ qui reghdfe aod wind_speed_DWA_100 rain_DWA_100 temp_DWA_100 rh_DWA_100, absorb(pm10_n month) res(resid_aod_smw)
75
+ *raw
76
+ qui rdrobust aod n_month if temp_DWA_100!=. & rain_DWA_100!=. & rh_DWA_100!=. & wind_speed_DWA_100 !=. & resid_aod_smw!=., c(0) p(1) q(2) kernel(tri) vce(cluster code_city) masspoints(off)
77
+ outreg2 using "$path2/Table1_A2_GG_PC_A2", excel replace ctitle(aod) addtext(Sample, All) addstat(Obs.(Monthly), e(N_h_l)+e(N_h_r), Bandwidth (Months), floor(e(h_l))) tex pvalue
78
+ *residual
79
+ qui rdrobust resid_aod_smw n_month, c(0) p(1) q(2) kernel(tri) vce(cluster code_city) masspoints(off)
80
+ outreg2 using "$path2/Table1_A2_GG_PC_A2", excel append ctitle(aod) addtext(Sample, All, Station FE, Y, Month FE, Y, Weather Controls, Y) addstat(Obs.(Monthly), e(N_h_l)+e(N_h_r), Bandwidth (Months), floor(e(h_l))) tex pvalue
81
+ *wave 1
82
+ qui rdrobust resid_aod_smw n_month if phase==1, c(0) p(1) q(2) kernel(tri) vce(cluster code_city) masspoints(off)
83
+ outreg2 using "$path2/Table1_A2_GG_PC_A2", excel append ctitle(aod) addtext(Sample, Wave 1, Station FE, Y, Month FE, Y, Weather Controls, Y) addstat(Obs.(Monthly), e(N_h_l)+e(N_h_r), Bandwidth (Months), floor(e(h_l))) tex pvalue
84
+ *wave 2
85
+ qui rdrobust resid_aod_smw n_month if phase==2, c(0) p(1) q(2) kernel(tri) vce(cluster code_city) masspoints(off)
86
+ outreg2 using "$path2/Table1_A2_GG_PC_A2", excel append ctitle(aod) addtext(Sample, Wave 2, Station FE, Y, Month FE, Y, Weather Controls, Y) addstat(Obs.(Monthly), e(N_h_l)+e(N_h_r), Bandwidth (Months), floor(e(h_l))) tex pvalue
87
+ *deadline
88
+ qui rdrobust resid_aod_smw n_month if auto_date==19359 | auto_date==19724, c(0) p(1) q(2) kernel(tri) vce(cluster code_city) masspoints(off)
89
+ outreg2 using "$path2/Table1_A2_GG_PC_A2", excel append ctitle(aod) addtext(Sample, Deadline, Station FE, Y, Month FE, Y, Weather Controls, Y) addstat(Obs.(Monthly), e(N_h_l)+e(N_h_r), Bandwidth (Months), floor(e(h_l))) tex pvalue
90
+
91
+
92
+ *==============================================================================*
93
+ *Table **. Summary Statistics by weather varibles (NEW)
94
+ *==============================================================================*
95
+ use "$path/Data/station_day_1116",clear
96
+ foreach y in "temp" "rain" "wind_speed" "rh" {
97
+ sum `y' `y'_n `y'_DWA `y'_DWA_500 `y'_DWA_100
98
+ }
99
+
100
+ *==============================================================================*
101
+ *Table A2. Summary Statistics by Year
102
+ *==============================================================================*
103
+ ***AOD
104
+ use "$path/Data/station_month",clear
105
+ qui levelsof year, loc(y)
106
+ qui foreach v of loc y {
107
+ estpost summ aod if year==`v'
108
+ est sto y`v'
109
+ }
110
+ esttab * using "$path/Results/Table_A2.csv", cell(mean(fmt(%9.2f)) sd(par)) mti collabels(none) noobs replace
111
+
112
+ ***pollution and weather
113
+ use "$path/Data/station_day_1116",clear
114
+ gen year=year(date)
115
+ qui levelsof year, loc(y)
116
+ qui foreach v of loc y {
117
+ estpost summ pm10 so2 no2 temp rain rh wind_speed if year==`v'
118
+ est sto y`v'
119
+ }
120
+ esttab * using "$path/Results/Table_A2.csv", cell(mean(fmt(%9.1f)) sd(par)) mti collabels(none) noobs nonum append
121
+
122
+ *==============================================================================*
123
+ *Table B2. Changes in Weather Conditions after Automation
124
+ *==============================================================================*
125
+ use "$path/Data/station_day_1116",clear
126
+ gen T=date-auto_date
127
+ gen month=month(date)
128
+ foreach y in temp rain rh wind_speed{
129
+ qui reghdfe `y', absorb(pm10_n month) res(resid_`y'_sm)
130
+ *all sample
131
+ qui rdrobust resid_`y'_sm T if temp!=. & rain!=. & rh!=. & wind_speed !=., c(0) p(1) q(2) kernel(tri) vce(cluster code_city) masspoints(off)
132
+ outreg2 using "$path/Results/Table_B2", excel dec(2) append ctitle(`y') addtext(Sample, All, Kernel, Tri., Station FE, Y, Month FE, Y)
133
+ qui rdrobust resid_`y'_sm T if temp!=. & rain!=. & rh!=. & wind_speed !=., c(0) p(1) q(2) kernel(epa) vce(cluster code_city) masspoints(off)
134
+ outreg2 using "$path/Results/Table_B2", excel dec(2) append ctitle(`y') addtext(Sample, All, Kernel, Epa., Station FE, Y, Month FE, Y)
135
+ qui rdrobust resid_`y'_sm T if temp!=. & rain!=. & rh!=. & wind_speed !=., c(0) p(1) q(2) kernel(uni) vce(cluster code_city) masspoints(off)
136
+ outreg2 using "$path/Results/Table_B2", excel dec(2) append ctitle(`y') addtext(Sample, All, Kernel, Uni., Station FE, Y, Month FE, Y)
137
+ *no missing PM10
138
+ qui rdrobust resid_`y'_sm T if temp!=. & rain!=. & rh!=. & wind_speed !=. & pm10 !=., c(0) p(1) q(2) kernel(tri) vce(cluster code_city) masspoints(off)
139
+ outreg2 using "$path/Results/Table_B2", excel dec(2) append ctitle(`y') addtext(Sample, No Missing PM10, Kernel, Tri., Station FE, Y, Month FE, Y)
140
+ qui rdrobust resid_`y'_sm T if temp!=. & rain!=. & rh!=. & wind_speed !=. & pm10 !=., c(0) p(1) q(2) kernel(epa) vce(cluster code_city) masspoints(off)
141
+ outreg2 using "$path/Results/Table_B2", excel dec(2) append ctitle(`y') addtext(Sample, No Missing PM10, Kernel, Epa., Station FE, Y, Month FE, Y)
142
+ qui rdrobust resid_`y'_sm T if temp!=. & rain!=. & rh!=. & wind_speed !=. & pm10 !=., c(0) p(1) q(2) kernel(uni) vce(cluster code_city) masspoints(off)
143
+ outreg2 using "$path/Results/Table_B2", excel dec(2) append ctitle(`y') addtext(Sample, No Missing PM10, Kernel, Uni., Station FE, Y, Month FE, Y)
144
+ }
145
+
146
+ *==============================================================================*
147
+ *Table B3. RD Estimates Using Alternative Kernel Weightings and Polynomials
148
+ *==============================================================================*
149
+ ***Panel A: station-day PM10
150
+ use "$path/Data/station_day_1116",clear
151
+ gen T=date-auto_date
152
+ gen month=month(date)
153
+ gen after=(T>0)
154
+ gen T2=T^2
155
+ gen T3=T^3
156
+ gen T4=T^4
157
+ gen after_T=after*T
158
+ gen after_T2=after*T2
159
+ gen after_T3=after*T3
160
+ gen after_T4=after*T4
161
+
162
+ qui reghdfe pm10 wind_speed rain temp rh, absorb(pm10_n month) res(resid_pm10_smw)
163
+ *kernel
164
+ qui rdrobust resid_pm10_smw T, c(0) p(1) q(2) kernel(tri) vce(cluster code_city) masspoints(off)
165
+ outreg2 using "$path/Results/Table_B3A_kernel_parametric_day", excel dec(1) append addtext(Kernel/Polynomial, Tri., Station FE, Y, Month FE, Y, Weather Controls, Y) ctitle(pm10) addstat(Obs.(Daily), e(N_h_l)+e(N_h_r), Bandwidth (Days), floor(e(h_l)))
166
+ qui rdrobust resid_pm10_smw T, c(0) p(1) q(2) kernel(epa) vce(cluster code_city) masspoints(off)
167
+ outreg2 using "$path/Results/Table_B3A_kernel_parametric_day", excel dec(1) append addtext(Kernel/Polynomial, Epa., Station FE, Y, Month FE, Y, Weather Controls, Y) ctitle(pm10) addstat(Obs.(Daily), e(N_h_l)+e(N_h_r), Bandwidth (Days), floor(e(h_l)))
168
+ qui rdrobust resid_pm10_smw T, c(0) p(1) q(2) kernel(uni) vce(cluster code_city) masspoints(off)
169
+ outreg2 using "$path/Results/Table_B3A_kernel_parametric_day", excel dec(1) append addtext(Kernel/Polynomial, Uni., Station FE, Y, Month FE, Y, Weather Controls, Y) ctitle(pm10) addstat(Obs.(Daily), e(N_h_l)+e(N_h_r), Bandwidth (Days), floor(e(h_l)))
170
+ *parametric
171
+ qui reghdfe pm10 after T after_T wind_speed rain temp rh, absorb(pm10_n month) vce(cluster code_city)
172
+ outreg2 using "$path/Results/Table_B3A_kernel_parametric_day", excel dec(1) append keep (after) addtext(Kernel/Polynomial, Linear, Station FE, Y, Month FE, Y, Weather Controls, Y) ctitle(pm10)
173
+ qui reghdfe pm10 after T after_T T2 after_T2 wind_speed rain temp rh, absorb(pm10_n month) vce(cluster code_city)
174
+ outreg2 using "$path/Results/Table_B3A_kernel_parametric_day", excel dec(1) append keep (after) addtext(Kernel/Polynomial, Quadratic, Station FE, Y, Month FE, Y, Weather Controls, Y) ctitle(pm10)
175
+ qui reghdfe pm10 after T after_T T2 after_T2 T3 after_T3 wind_speed rain temp rh, absorb(pm10_n month) vce(cluster code_city)
176
+ outreg2 using "$path/Results/Table_B3A_kernel_parametric_day", excel dec(1) append keep (after) addtext(Kernel/Polynomial, Cubic, Station FE, Y, Month FE, Y, Weather Controls, Y) ctitle(pm10)
177
+ qui reghdfe pm10 after T after_T T2 after_T2 T3 after_T3 T4 after_T4 wind_speed rain temp rh, absorb(pm10_n month) vce(cluster code_city)
178
+ outreg2 using "$path/Results/Table_B3A_kernel_parametric_day", excel dec(1) append keep (after) addtext(Kernel/Polynomial, Quartic, Station FE, Y, Month FE, Y, Weather Controls, Y) ctitle(pm10)
179
+
180
+ ***Panel B: station-month PM10 and AOD
181
+ use "$path/Data/station_month.dta",clear
182
+ foreach v in pm10 aod{
183
+ qui reghdfe `v' wind_speed rain temp rh, absorb(pm10_n month) res(resid_`v'_smw)
184
+ }
185
+
186
+ gen m2=n_month^2
187
+ gen m3=n_month^3
188
+ gen m4=n_month^4
189
+ gen after_m=after*n_month
190
+ gen after_m2=after*m2
191
+ gen after_m3=after*m3
192
+ gen after_m4=after*m4
193
+
194
+ foreach y of var pm10 aod {
195
+ if "`y'" == "pm10" local dec = 1
196
+ if "`y'" == "aod" local dec = 3
197
+ *kernel
198
+ qui rdrobust resid_`y'_smw n_month, c(0) p(1) q(2) kernel(tri) vce(cluster code_city) masspoints(off)
199
+ outreg2 using "$path/Results/Table_B3B_kernel_parametric_month", excel dec(`dec') append addtext(Kernel/Polynomial, Tri., Station FE, Y, Month FE, Y, Weather Controls, Y) ctitle(`y') addstat(Obs.(Monthly), e(N_h_l)+e(N_h_r), Bandwidth (Months), floor(e(h_l)))
200
+ qui rdrobust resid_`y'_smw n_month, c(0) p(1) q(2) kernel(epa) vce(cluster code_city) masspoints(off)
201
+ outreg2 using "$path/Results/Table_B3B_kernel_parametric_month", excel dec(`dec') append addtext(Kernel/Polynomial, Epa., Station FE, Y, Month FE, Y, Weather Controls, Y) ctitle(`y') addstat(Obs.(Monthly), e(N_h_l)+e(N_h_r), Bandwidth (Months), floor(e(h_l)))
202
+ qui rdrobust resid_`y'_smw n_month, c(0) p(1) q(2) kernel(uni) vce(cluster code_city) masspoints(off)
203
+ outreg2 using "$path/Results/Table_B3B_kernel_parametric_month", excel dec(`dec') append addtext(Kernel/Polynomial, Uni., Station FE, Y, Month FE, Y, Weather Controls, Y) ctitle(`y') addstat(Obs.(Monthly), e(N_h_l)+e(N_h_r), Bandwidth (Months), floor(e(h_l)))
204
+ ***parametric
205
+ qui reghdfe `y' after n_month after_m wind_speed rain temp rh, absorb(pm10_n month) vce(cluster code_city)
206
+ outreg2 using "$path/Results/Table_B3B_kernel_parametric_month", excel dec(`dec') append keep(after) addtext(Kernel/Polynomial, Linear, Station FE, Y, Month FE, Y, Weather Controls, Y) ctitle(`y')
207
+ qui reghdfe `y' after n_month after_m m2 after_m2 wind_speed rain temp rh, absorb(pm10_n month) vce(cluster code_city)
208
+ outreg2 using "$path/Results/Table_B3B_kernel_parametric_month", excel dec(`dec') append keep(after) addtext(Kernel/Polynomial, Quadratic, Station FE, Y, Month FE, Y, Weather Controls, Y) ctitle(`y')
209
+ qui reghdfe `y' after n_month after_m m2 after_m2 m3 after_m3 wind_speed rain temp rh, absorb(pm10_n month) vce(cluster code_city)
210
+ outreg2 using "$path/Results/Table_B3B_kernel_parametric_month", excel dec(`dec') append keep(after) addtext(Kernel/Polynomial, Cubic, Station FE, Y, Month FE, Y, Weather Controls, Y) ctitle(`y')
211
+ qui reghdfe `y' after n_month after_m m2 after_m2 m3 after_m3 m4 after_m4 wind_speed rain temp rh, absorb(pm10_n month) vce(cluster code_city)
212
+ outreg2 using "$path/Results/Table_B3B_kernel_parametric_month", excel dec(`dec') append keep(after) addtext(Kernel/Polynomial, Quartic, Station FE, Y, Month FE, Y, Weather Controls, Y) ctitle(`y')
213
+ }
214
+
215
+ *==============================================================================*
216
+ *Table B4. Automation and Reported PM10 in 76 Cities
217
+ *==============================================================================*
218
+ use "$path/Data/station_day_1116",clear
219
+ merge m:1 code_city using "$path/Data/city_info_rd.dta"
220
+ keep if list_76==1
221
+ gen T=date-auto_date
222
+ gen month=month(date)
223
+ qui reghdfe pm10 wind_speed rain temp rh, absorb(pm10_n month) res(resid_pm10_smw)
224
+ *raw
225
+ qui rdrobust pm10 T if temp!=. & rain!=. & rh!=. & wind_speed !=., c(0) p(1) q(2) kernel(tri) vce(cluster code_city) masspoints(off)
226
+ outreg2 using "$path/Results/Table_B4_76", excel dec(1) append ctitle(pm10) addtext(Sample, All) addstat(Obs.(Daily), e(N_h_l)+e(N_h_r), Bandwidth (Days), floor(e(h_l)))
227
+ *residual
228
+ qui rdrobust resid_pm10_smw T, c(0) p(1) q(2) kernel(tri) vce(cluster code_city) masspoints(off)
229
+ outreg2 using "$path/Results/Table_B4_76", excel dec(1) append ctitle(pm10) addtext(Sample, All, Station FE, Y, Month FE, Y, Weather Controls, Y) addstat(Obs.(Daily), e(N_h_l)+e(N_h_r), Bandwidth (Days), floor(e(h_l)))
230
+ *wave 1
231
+ qui rdrobust resid_pm10_smw T if phase==1, c(0) p(1) q(2) kernel(tri) vce(cluster code_city) masspoints(off)
232
+ outreg2 using "$path/Results/Table_B4_76", excel dec(1) append ctitle(pm10) addtext(Sample, Wave 1, Station FE, Y, Month FE, Y, Weather Controls, Y) addstat(Obs.(Daily), e(N_h_l)+e(N_h_r), Bandwidth (Days), floor(e(h_l)))
233
+ *wave 2
234
+ qui rdrobust resid_pm10_smw T if phase==2, c(0) p(1) q(2) kernel(tri) vce(cluster code_city) masspoints(off)
235
+ outreg2 using "$path/Results/Table_B4_76", excel dec(1) append ctitle(pm10) addtext(Sample, Wave 2, Station FE, Y, Month FE, Y, Weather Controls, Y) addstat(Obs.(Daily), e(N_h_l)+e(N_h_r), Bandwidth (Days), floor(e(h_l)))
236
+ *deadline
237
+ qui rdrobust resid_pm10_smw T if auto_date==19359 | auto_date==19724, c(0) p(1) q(2) kernel(tri) vce(cluster code_city) masspoints(off)
238
+ outreg2 using "$path/Results/Table_B4_76", excel dec(1) append ctitle(pm10) addtext(Sample, Deadline, Station FE, Y, Month FE, Y, Weather Controls, Y) addstat(Obs.(Daily), e(N_h_l)+e(N_h_r), Bandwidth (Days), floor(e(h_l)))
239
+
240
+ *==============================================================================*
241
+ *Table B6. Automation and PM10 Variability
242
+ *==============================================================================*
243
+ use "$path/Data/station_day_1116.dta",clear
244
+ gen year=year(date)
245
+ gen month=month(date)
246
+ gen T = date - auto_date
247
+ gen n_month=floor(T/30)
248
+ bysort pm10_n n_month: egen sd_pm10=sd(pm10)
249
+ foreach v of var pm10-rh{
250
+ bysort pm10_n n_month: egen `v'_m=mean(`v')
251
+ drop `v'
252
+ rename `v'_m `v'
253
+ }
254
+ duplicates drop pm10_n n_month,force
255
+ qui reghdfe sd_pm10 wind_speed rain temp rh, absorb(pm10_n month) res(resid_sd_pm10_smw)
256
+ *residual
257
+ qui rdrobust resid_sd_pm10_smw n_month, c(0) p(1) q(2) kernel(tri) vce(cluster code_city) masspoints(off)
258
+ outreg2 using "$path/Results/Table_B6_SD", excel dec(1) append ctitle(All) addtext(Station FE, Y, Month FE, Y, Weather Controls, Y, Kernel Function, Tri.) addstat(Obs.(Monthly), e(N_h_l)+e(N_h_r), Bandwidth (Months), floor(e(h_l)))
259
+ *wave1
260
+ qui rdrobust resid_sd_pm10_smw n_month if phase==1, c(0) p(1) q(2) kernel(tri) vce(cluster code_city) masspoints(off)
261
+ outreg2 using "$path/Results/Table_B6_SD", excel dec(1) append ctitle(Wave 1) addtext(Station FE, Y, Month FE, Y, Weather Controls, Y, Kernel Function, Tri.) addstat(Obs.(Monthly), e(N_h_l)+e(N_h_r), Bandwidth (Months), floor(e(h_l)))
262
+ *wave2
263
+ qui rdrobust resid_sd_pm10_smw n_month if phase==2, c(0) p(1) q(2) kernel(tri) vce(cluster code_city) masspoints(off)
264
+ outreg2 using "$path/Results/Table_B6_SD", excel dec(1) append ctitle(Wave 2) addtext(Station FE, Y, Month FE, Y, Weather Controls, Y, Kernel Function, Tri.) addstat(Obs.(Monthly), e(N_h_l)+e(N_h_r), Bandwidth (Months), floor(e(h_l)))
265
+ *deadline
266
+ qui rdrobust resid_sd_pm10_smw n_month if auto_date==19359 | auto_date==19724, c(0) p(1) q(2) kernel(tri) vce(cluster code_city) masspoints(off)
267
+ outreg2 using "$path/Results/Table_B6_SD", excel dec(1) append ctitle(Deadline) addtext(Station FE, Y, Month FE, Y, Weather Controls, Y, Kernel Function, Tri.) addstat(Obs.(Monthly), e(N_h_l)+e(N_h_r), Bandwidth (Months), floor(e(h_l)))
268
+
269
+ *==============================================================================*
270
+ *Table B7. Automation and Reported SO2 and NO2
271
+ *==============================================================================*
272
+ use "$path/Data/station_day_1116",clear
273
+ gen T=date-auto_date
274
+ gen month=month(date)
275
+ foreach y of var so2 no2{
276
+ qui reghdfe `y' wind_speed rain temp rh, absorb(pm10_n month) res(resid_`y'_smw)
277
+ *residual
278
+ qui rdrobust resid_`y'_smw T, c(0) p(1) q(2) kernel(tri) vce(cluster code_city) masspoints(off)
279
+ outreg2 using "$path/Results/Table_B7_SO2_NO2", excel dec(2) append ctitle(`y'_All) addtext(Station FE, Y, Month FE, Y, Weather Controls, Y, Kernel Function, Tri.) addstat(`y' Obs., e(N_h_l)+e(N_h_r), `y' Bandwidth, floor(e(h_l)))
280
+ *wave1
281
+ qui rdrobust resid_`y'_smw T if phase==1, c(0) p(1) q(2) kernel(tri) vce(cluster code_city) masspoints(off)
282
+ outreg2 using "$path/Results/Table_B7_SO2_NO2", excel dec(2) append ctitle(`y'_Wave 1) addtext(Station FE, Y, Month FE, Y, Weather Controls, Y, Kernel Function, Tri.) addstat(`y' Obs., e(N_h_l)+e(N_h_r), `y' Bandwidth, floor(e(h_l)))
283
+ *wave2
284
+ qui rdrobust resid_`y'_smw T if phase==2, c(0) p(1) q(2) kernel(tri) vce(cluster code_city) masspoints(off)
285
+ outreg2 using "$path/Results/Table_B7_SO2_NO2", excel dec(2) append ctitle(`y'_Wave 2) addtext(Station FE, Y, Month FE, Y, Weather Controls, Y, Kernel Function, Tri.) addstat(`y' Obs., e(N_h_l)+e(N_h_r), `y' Bandwidth, floor(e(h_l)))
286
+ *deadline
287
+ qui rdrobust resid_`y'_smw T if auto_date==19359 | auto_date==19724, c(0) p(1) q(2) kernel(tri) vce(cluster code_city) masspoints(off)
288
+ outreg2 using "$path/Results/Table_B7_SO2_NO2", excel dec(2) append ctitle(`y'_Deadline) addtext(Station FE, Y, Month FE, Y, Weather Controls, Y, Kernel Function, Tri.) addstat(`y' Obs., e(N_h_l)+e(N_h_r), `y' Bandwidth, floor(e(h_l)))
289
+ }
290
+
291
+ *==============================================================================*
292
+ *Table B8. Change in PM10 Reporting Standard
293
+ *==============================================================================*
294
+ use "$path/Data/station_day_1116.dta",clear
295
+ gen T=date-auto_date
296
+ gen month=month(date)
297
+ gen miss1=1 if pm10==. & T <0 & T>=-365
298
+ gen miss2=1 if pm10==. & T >=0 & T<365
299
+ gen n1=1 if T <0 & T>=-365
300
+ gen n2=1 if T >=0 & T<365
301
+
302
+ bysort pm10_n: egen miss_before_y=sum(miss1)
303
+ bysort pm10_n: egen miss_after_y=sum(miss2)
304
+ bysort pm10_n: egen n_before_y=sum(n1)
305
+ bysort pm10_n: egen n_after_y=sum(n2)
306
+
307
+ gen miss_before_ratio=miss_before_y/n_before_y
308
+ qui reghdfe pm10 wind_speed rain temp rh, absorb(pm10_n month) res(resid_pm10_smw)
309
+
310
+ foreach v in 10 15 20 25 30{
311
+ *residual
312
+ qui rdrobust resid_pm10_smw T if miss_before_ratio<=`v'/100, c(0) p(1) q(2) kernel(tri) vce(cluster code_city) masspoints(off)
313
+ outreg2 using "$path/Results/Table_B8_miss_before_ratio_1y", excel dec(1) append ctitle(pm10) addtext(Pre-Missing PM10, ≤`v'%, Sample, All, Station FE, Y, Month FE, Y, Weather Controls, Y) addstat(Effective Obs, e(N_h_l)+e(N_h_r), Bandwidth, floor(e(h_l)))
314
+ }
315
+
316
+ *==============================================================================*
317
+ *Table B9. RD Density Test at Air Quality Thresholds
318
+ *==============================================================================*
319
+ use "$path/Data/station_day_1116.dta",clear
320
+ gen T=date-auto_date
321
+ log using "$path/Data/temp/temp1.log", replace
322
+ foreach v in 50 150 250 350 420 500 600 {
323
+ rddensity pm10 if T>=0, c(`v') p(1) q(2) kernel(triangular) nomasspoints
324
+ rddensity pm10 if T>=0, c(`v') p(1) q(2) kernel(epanechnikov) nomasspoints
325
+ rddensity pm10 if T>=0, c(`v') p(1) q(2) kernel(uniform) nomasspoints
326
+ }
327
+ log close
328
+
329
+ clear
330
+ infix str3 cutoff 6-18 str12 kernel 69-80 str6 T 24-30 str6 P_value 37-42 using "$path/Data/temp/temp1.log"
331
+ keep if trim(cutoff)=="c = 50.000" |trim(cutoff)=="c = 150.000" |trim(cutoff)=="c = 250.000" |trim(cutoff)=="c = 350.000" |trim(cutoff)=="c = 420.000" |trim(cutoff)=="c = 600.000" |trim(cutoff)=="Robust"| trim(kernel)=="triangular"| trim(kernel)=="epanechnikov"| trim(kernel)=="uniform"
332
+ replace cutoff=cutoff[_n-2] if cutoff=="Robust"
333
+ replace kernel=kernel[_n-1] if kernel==""
334
+ drop if cutoff=="Number of obs" | kernel=="709659"
335
+ export excel using "$path/Results/Table_B9_Threshold", replace firstrow(variables)
336
+
337
+ *==============================================================================*
338
+ *Table B10. Automation and Association between AOD and PM10 (Standardized)
339
+ *==============================================================================*
340
+ ***station-month
341
+ use "$path/Data/station_month.dta",clear
342
+ set matsize 5000
343
+ egen year_month=group(year month)
344
+
345
+ log using "$path/Data/temp/temp2.log", replace
346
+ pwcorr aod pm10 if after==0, sig
347
+ pcorr aod pm10 temp rh rain wind_speed if after==0
348
+ xi: pcorr aod pm10 temp rh rain wind_speed i.year_month if after==0
349
+ xi: pcorr aod pm10 temp rh rain wind_speed i.year_month i.pm10_n if after==0
350
+ pwcorr aod pm10 if after==1, sig
351
+ pcorr aod pm10 temp rh rain wind_speed if after==1
352
+ xi: pcorr aod pm10 temp rh rain wind_speed i.year_month if after==1
353
+ xi: pcorr aod pm10 temp rh rain wind_speed i.year_month i.pm10_n if after==1
354
+ log close
355
+
356
+ clear
357
+ infix str4 obs 1-4 str12 thecorr 1-12 str6 partcorr 17-23 str6 thesig 73-78 using "$path/Data/temp/temp2.log"
358
+ keep if trim(thecorr)=="pm10" | trim(obs)=="(obs"
359
+ export excel using "$path/Results/Table_B10_PM10_AOD", replace
360
+
361
+ *==============================================================================*
362
+ *Table D1. Association between Baidu Search Index and Taobao Sales Index
363
+ *==============================================================================*
364
+ use "$path/Data/search_sale.dta",clear
365
+ foreach v in mask filter{
366
+ qui reghdfe l_taobao_`v' l_`v' wind_speed rain temp rh, absorb(code_city) vce(cluster code_city)
367
+ qui outreg2 using "$path/Results/Table_D1_sale_search", excel dec(2) append drop(wind_speed rain temp rh) ctitle(l_taobao_`v') addtext(Weather Controls, Y, City FE, Y)
368
+ qui reghdfe l_taobao_`v' l_`v' wind_speed rain temp rh, absorb(code_city month) vce(cluster code_city)
369
+ qui outreg2 using "$path/Results/Table_D1_sale_search", excel dec(2) append drop(wind_speed rain temp rh) ctitle(l_taobao_`v') addtext(Weather Controls, Y, City FE, Y, Month FE, Y)
370
+ }
371
+
372
+ *==============================================================================*
373
+ *Table D3: City-Month Online Search in Deadline and Non-Deadline Cities
374
+ *==============================================================================*
375
+ use "$path/Data/search_city_month.dta",clear
376
+ foreach y in pmmask filter l_pmmask l_filter {
377
+ cap qui reghdfe `y', absorb(code_city month) res(resid_`y'_sm)
378
+ cap qui reghdfe `y' wind_speed rain temp rh, absorb(code_city month) res(resid_`y'_smw)
379
+ *ddl in normal and manipulated
380
+ qui rdrobust resid_`y'_sm n_month if auto_date==19359 | auto_date==19724, c(0) p(1) q(2) kernel(tri) vce(cluster code_city) masspoints(off)
381
+ outreg2 using "$path/Results/Table_D3_ddl_non_ddl", excel dec(2) append ctitle(`y') addtext(Deadline, Y, Sample, All, City FE, Y, Month FE, Y) addstat(Effective Obs, e(N_h_l)+e(N_h_r), Bandwidth, floor(e(h_l)))
382
+ qui rdrobust resid_`y'_smw n_month if auto_date==19359 | auto_date==19724, c(0) p(1) q(2) kernel(tri) vce(cluster code_city) masspoints(off)
383
+ outreg2 using "$path/Results/Table_D3_ddl_non_ddl", excel dec(2) append ctitle(`y') addtext(Deadline, Y, Sample, All, City FE, Y, Month FE, Y, Weather Controls, Y) addstat(Effective Obs, e(N_h_l)+e(N_h_r), Bandwidth, floor(e(h_l)))
384
+
385
+ *non_ddl in normal and manipulated
386
+ qui rdrobust resid_`y'_sm n_month if auto_date!=19359 & auto_date!=19724, c(0) p(1) q(2) kernel(tri) vce(cluster code_city) masspoints(off)
387
+ outreg2 using "$path/Results/Table_D3_ddl_non_ddl", excel dec(2) append ctitle(`y') addtext(Deadline, N, Sample, All, City FE, Y, Month FE, Y) addstat(Effective Obs, e(N_h_l)+e(N_h_r), Bandwidth, floor(e(h_l)))
388
+ qui rdrobust resid_`y'_smw n_month if auto_date!=19359 & auto_date!=19724, c(0) p(1) q(2) kernel(tri) vce(cluster code_city) masspoints(off)
389
+ outreg2 using "$path/Results/Table_D3_ddl_non_ddl", excel dec(2) append ctitle(`y') addtext(Deadline, N, Sample, All, City FE, Y, Month FE, Y, Weather Controls, Y) addstat(Effective Obs, e(N_h_l)+e(N_h_r), Bandwidth, floor(e(h_l)))
390
+ }
391
+
392
+
393
+ ***The End
9/replication_package/Code/Tables.do ADDED
@@ -0,0 +1,163 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ***This is the main program for Tables 1, 2, 3 generated using Stata 15 MP
2
+
3
+ clear all
4
+ set more off
5
+
6
+ *global path "/Users/`c(username)'/Dropbox/China_Pollution_Monitoring"
7
+
8
+ *==============================================================================*
9
+ *Table 1A: RD
10
+ *==============================================================================*
11
+ ***Row 1. Daily PM10
12
+ use "$path/Data/station_day_1116",clear
13
+ gen T=date-auto_date
14
+ gen month=month(date)
15
+ qui reghdfe pm10 wind_speed rain temp rh, absorb(pm10_n month) res(resid_pm10_smw)
16
+ *raw
17
+ qui rdrobust pm10 T if temp!=. & rain!=. & rh!=. & wind_speed !=., c(0) p(1) q(2) kernel(tri) vce(cluster code_city) masspoints(off)
18
+ outreg2 using "$path/Results/Table1_A1", excel dec(1) replace ctitle(pm10) addtext(Sample, All) addstat(Obs.(Daily), e(N_h_l)+e(N_h_r), Bandwidth (Days), floor(e(h_l)))
19
+ *residual
20
+ qui rdrobust resid_pm10_smw T, c(0) p(1) q(2) kernel(tri) vce(cluster code_city) masspoints(off)
21
+ outreg2 using "$path/Results/Table1_A1", excel dec(1) append ctitle(pm10) addtext(Sample, All, Station FE, Y, Month FE, Y, Weather Controls, Y) addstat(Obs.(Daily), e(N_h_l)+e(N_h_r), Bandwidth (Days), floor(e(h_l)))
22
+ *wave 1
23
+ qui rdrobust resid_pm10_smw T if phase==1, c(0) p(1) q(2) kernel(tri) vce(cluster code_city) masspoints(off)
24
+ outreg2 using "$path/Results/Table1_A1", excel dec(1) append ctitle(pm10) addtext(Sample, Wave 1, Station FE, Y, Month FE, Y, Weather Controls, Y) addstat(Obs.(Daily), e(N_h_l)+e(N_h_r), Bandwidth (Days), floor(e(h_l)))
25
+ *wave 2
26
+ qui rdrobust resid_pm10_smw T if phase==2, c(0) p(1) q(2) kernel(tri) vce(cluster code_city) masspoints(off)
27
+ outreg2 using "$path/Results/Table1_A1", excel dec(1) append ctitle(pm10) addtext(Sample, Wave 2, Station FE, Y, Month FE, Y, Weather Controls, Y) addstat(Obs.(Daily), e(N_h_l)+e(N_h_r), Bandwidth (Days), floor(e(h_l)))
28
+ *deadline
29
+ qui rdrobust resid_pm10_smw T if auto_date==19359 | auto_date==19724, c(0) p(1) q(2) kernel(tri) vce(cluster code_city) masspoints(off)
30
+ outreg2 using "$path/Results/Table1_A1", excel dec(1) append ctitle(pm10) addtext(Sample, Deadline, Station FE, Y, Month FE, Y, Weather Controls, Y) addstat(Obs.(Daily), e(N_h_l)+e(N_h_r), Bandwidth (Days), floor(e(h_l)))
31
+
32
+ ***Row 2: Monthly AOD
33
+ use "$path/Data/station_month.dta",clear
34
+ qui reghdfe aod wind_speed rain temp rh, absorb(pm10_n month) res(resid_aod_smw)
35
+ *raw
36
+ qui rdrobust aod n_month if temp!=. & rain!=. & rh!=. & wind_speed !=. & resid_aod_smw!=., c(0) p(1) q(2) kernel(tri) vce(cluster code_city) masspoints(off)
37
+ outreg2 using "$path/Results/Table1_A2", excel dec(3) append ctitle(aod) addtext(Sample, All) addstat(Obs.(Monthly), e(N_h_l)+e(N_h_r), Bandwidth (Months), floor(e(h_l)))
38
+ *residual
39
+ qui rdrobust resid_aod_smw n_month, c(0) p(1) q(2) kernel(tri) vce(cluster code_city) masspoints(off)
40
+ outreg2 using "$path/Results/Table1_A2", excel dec(3) append ctitle(aod) addtext(Sample, All, Station FE, Y, Month FE, Y, Weather Controls, Y) addstat(Obs.(Monthly), e(N_h_l)+e(N_h_r), Bandwidth (Months), floor(e(h_l)))
41
+ *wave 1
42
+ qui rdrobust resid_aod_smw n_month if phase==1, c(0) p(1) q(2) kernel(tri) vce(cluster code_city) masspoints(off)
43
+ outreg2 using "$path/Results/Table1_A2", excel dec(3) append ctitle(aod) addtext(Sample, Wave 1, Station FE, Y, Month FE, Y, Weather Controls, Y) addstat(Obs.(Monthly), e(N_h_l)+e(N_h_r), Bandwidth (Months), floor(e(h_l)))
44
+ *wave 2
45
+ qui rdrobust resid_aod_smw n_month if phase==2, c(0) p(1) q(2) kernel(tri) vce(cluster code_city) masspoints(off)
46
+ outreg2 using "$path/Results/Table1_A2", excel dec(3) append ctitle(aod) addtext(Sample, Wave 2, Station FE, Y, Month FE, Y, Weather Controls, Y) addstat(Obs.(Monthly), e(N_h_l)+e(N_h_r), Bandwidth (Months), floor(e(h_l)))
47
+ *deadline
48
+ qui rdrobust resid_aod_smw n_month if auto_date==19359 | auto_date==19724, c(0) p(1) q(2) kernel(tri) vce(cluster code_city) masspoints(off)
49
+ outreg2 using "$path/Results/Table1_A2", excel dec(3) append ctitle(aod) addtext(Sample, Deadline, Station FE, Y, Month FE, Y, Weather Controls, Y) addstat(Obs.(Monthly), e(N_h_l)+e(N_h_r), Bandwidth (Months), floor(e(h_l)))
50
+ *==============================================================================*
51
+ *Table 1B: Event-Study Estimates
52
+ *==============================================================================*
53
+ ***Deadline
54
+ use "$path/Data/station_day_1116.dta",clear
55
+ gen year=year(date)
56
+ gen month=month(date)
57
+ egen year_month=group(year month)
58
+ keep if year>=2012 & year<=2013
59
+ keep if auto_date==19724 | auto_date==19359
60
+ gen treat=(auto_date==19359)
61
+ gen after2=(year>=2013)
62
+ gen m12_before2=(year==2012 & month>=11 & month<=12)
63
+ gen m34_before2=(year==2012 & month>=9 & month<=10)
64
+ gen m56_before2=(year==2012 & month>=7 & month<=8)
65
+ gen m712_before2=(year==2012 & month>=1 & month<=6)
66
+ gen m12_after2=(year==2013 & month>=1 & month<=2)
67
+ gen m34_after2=(year==2013 & month>=3 & month<=4)
68
+ gen m56_after2=(year==2013 & month>=5 & month<=6)
69
+ gen m712_after2=(year==2013 & month>=7 & month<=12)
70
+
71
+ foreach v in 12 34 56 712{
72
+ gen treat_m`v'_before2=treat*m`v'_before2
73
+ gen treat_m`v'_after2=treat*m`v'_after2
74
+ }
75
+
76
+ qui reghdfe pm10 treat_m712_before2 treat_m56_before2 treat_m34_before2 treat_m12_after2 treat_m34_after2 treat_m56_after2 treat_m712_after2 wind_speed rain temp rh, absorb(pm10_n month) vce(cluster code_city)
77
+ outreg2 using "$path/Results/Table1_B", excel dec(1) append keep (treat_m712_before2 treat_m56_before2 treat_m34_before2 treat_m12_after2 treat_m34_after2 treat_m56_after2 treat_m712_after2) ctitle(PM10) addtext(Sample, Deadline, Weather Controls, Y, Station FE, Y, Month FE, Y)
78
+ qui reghdfe pm10 treat_m712_before2 treat_m56_before2 treat_m34_before2 treat_m12_after2 treat_m34_after2 treat_m56_after2 treat_m712_after2 wind_speed rain temp rh, absorb(pm10_n year_month) vce(cluster code_city)
79
+ outreg2 using "$path/Results/Table1_B", excel dec(1) append keep (treat_m712_before2 treat_m56_before2 treat_m34_before2 treat_m12_after2 treat_m34_after2 treat_m56_after2 treat_m712_after2) ctitle(PM10) addtext(Sample, Deadline, Weather Controls, Y, Station FE, Y, Year-Month FE, Y)
80
+
81
+ ***nearest matching
82
+ use "$path/Data/did_ddl_match.dta" ,clear
83
+ gen year=year(date)
84
+ gen month=month(date)
85
+ egen year_month=group(year month)
86
+ gen treat=(auto_date==19359)
87
+ gen after2=(year>=2013)
88
+ gen m12_before2=(year==2012 & month>=11 & month<=12)
89
+ gen m34_before2=(year==2012 & month>=9 & month<=10)
90
+ gen m56_before2=(year==2012 & month>=7 & month<=8)
91
+ gen m712_before2=(year==2012 & month>=1 & month<=6)
92
+ gen m12_after2=(year==2013 & month>=1 & month<=2)
93
+ gen m34_after2=(year==2013 & month>=3 & month<=4)
94
+ gen m56_after2=(year==2013 & month>=5 & month<=6)
95
+ gen m712_after2=(year==2013 & month>=7 & month<=12)
96
+
97
+ foreach v in 12 34 56 712{
98
+ gen treat_m`v'_before2=treat*m`v'_before2
99
+ gen treat_m`v'_after2=treat*m`v'_after2
100
+ }
101
+
102
+ qui reghdfe pm10 treat_m712_before2 treat_m56_before2 treat_m34_before2 treat_m12_after2 treat_m34_after2 treat_m56_after2 treat_m712_after2 wind_speed rain temp rh, absorb(pm10_n month) vce(cluster code_city)
103
+ outreg2 using "$path/Results/Table1_B", excel dec(1) append keep (treat_m712_before2 treat_m56_before2 treat_m34_before2 treat_m12_after2 treat_m34_after2 treat_m56_after2 treat_m712_after2) ctitle(PM10) addtext(Sample, +Matching, Weather Controls, Y, Station FE, Y, Month FE, Y)
104
+ qui reghdfe pm10 treat_m712_before2 treat_m56_before2 treat_m34_before2 treat_m12_after2 treat_m34_after2 treat_m56_after2 treat_m712_after2 wind_speed rain temp rh, absorb(pm10_n year_month) vce(cluster code_city)
105
+ outreg2 using "$path/Results/Table1_B", excel dec(1) append keep (treat_m712_before2 treat_m56_before2 treat_m34_before2 treat_m12_after2 treat_m34_after2 treat_m56_after2 treat_m712_after2) ctitle(PM10) addtext(Sample, +Matching, Weather Controls, Y, Station FE, Y, Year-Month FE, Y)
106
+ *log_pm10
107
+ qui reghdfe l_pm10 treat_m712_before2 treat_m56_before2 treat_m34_before2 treat_m12_after2 treat_m34_after2 treat_m56_after2 treat_m712_after2 wind_speed rain temp rh, absorb(pm10_n year_month) vce(cluster code_city)
108
+ outreg2 using "$path/Results/Table1_B", excel dec(2) append keep (treat_m712_before2 treat_m56_before2 treat_m34_before2 treat_m12_after2 treat_m34_after2 treat_m56_after2 treat_m712_after2) ctitle(log_PM10) addtext(Sample, +Matching, Weather Controls, Y, Station FE, Y, Year-Month FE, Y)
109
+
110
+ *==============================================================================*
111
+ *Table 2A: City-Month Online Search
112
+ *==============================================================================*
113
+ use "$path/Data/search_city_month.dta",clear
114
+ foreach y in pmmask filter l_pmmask l_filter {
115
+ qui reghdfe `y' wind_speed rain temp rh, absorb(code_city month) res(resid_`y'_smw)
116
+ *raw
117
+ qui rdrobust `y' n_month if temp!=. & rain!=. & rh!=. & wind_speed !=., c(0) p(1) q(2) kernel(tri) vce(cluster code_city) masspoints(off)
118
+ outreg2 using "$path/Results/Table2_A", excel dec(2) append ctitle(`y') addtext(Sample, All) addstat(Effective Obs, e(N_h_l)+e(N_h_r), Bandwidth, floor(e(h_l)))
119
+ *residual
120
+ qui rdrobust resid_`y'_smw n_month, c(0) p(1) q(2) kernel(tri) vce(cluster code_city) masspoints(off)
121
+ outreg2 using "$path/Results/Table2_A", excel dec(2) append ctitle(`y') addtext(Sample, All, City FE, Y, Month FE, Y, Weather Controls, Y) addstat(Effective Obs, e(N_h_l)+e(N_h_r), Bandwidth, floor(e(h_l)))
122
+ *normal
123
+ qui rdrobust resid_`y'_smw n_month if rd==0, c(0) p(1) q(2) kernel(tri) vce(cluster code_city) masspoints(off)
124
+ outreg2 using "$path/Results/Table2_A", excel dec(2) append ctitle(`y') addtext(Sample, Normal, City FE, Y, Month FE, Y, Weather Controls, Y) addstat(Effective Obs, e(N_h_l)+e(N_h_r), Bandwidth, floor(e(h_l)))
125
+ *manipulated
126
+ qui rdrobust resid_`y'_smw n_month if rd==1, c(0) p(1) q(2) kernel(tri) vce(cluster code_city) masspoints(off)
127
+ outreg2 using "$path/Results/Table2_A", excel dec(2) append ctitle(`y') addtext(Sample, Manipulate, City FE, Y, Month FE, Y, Weather Controls, Y) addstat(Effective Obs, e(N_h_l)+e(N_h_r), Bandwidth, floor(e(h_l)))
128
+ }
129
+
130
+ *==============================================================================*
131
+ *Table 2B: DID Search for Deadline Cities
132
+ *==============================================================================*
133
+ use "$path/Data/did_ddl_search.dta" ,clear
134
+ gen year=year(date)
135
+ gen month=month(date)
136
+ egen year_month=group(year month)
137
+ gen treat=(auto_date==19359)
138
+ gen after2=(year>=2013)
139
+ gen m12_before2=(year==2012 & month>=11 & month<=12)
140
+ gen m34_before2=(year==2012 & month>=9 & month<=10)
141
+ gen m56_before2=(year==2012 & month>=7 & month<=8)
142
+ gen m712_before2=(year==2012 & month>=1 & month<=6)
143
+ gen m12_after2=(year==2013 & month>=1 & month<=2)
144
+ gen m34_after2=(year==2013 & month>=3 & month<=4)
145
+ gen m56_after2=(year==2013 & month>=5 & month<=6)
146
+ gen m712_after2=(year==2013 & month>=7 & month<=12)
147
+
148
+ foreach v in 12 34 56 712{
149
+ gen treat_m`v'_before2=treat*m`v'_before2
150
+ gen treat_m`v'_after2=treat*m`v'_after2
151
+ }
152
+
153
+ foreach y of var pmmask filter{
154
+ *City FE and year-month FE
155
+ qui xi: areg `y' treat_m712_before2 treat_m56_before2 treat_m34_before2 treat_m12_after2 treat_m34_after2 treat_m56_after2 treat_m712_after2 i.year_month , absorb(code_city) vce(cluster code_city)
156
+ outreg2 using "$path/Results/Table2_B", excel dec(2) append keep(treat_m712_before2 treat_m56_before2 treat_m34_before2 treat_m12_after2 treat_m34_after2 treat_m56_after2 treat_m712_after2) ctitle(`y') addtext(Sample, Deadline, City FE, Y, Year-Month FE, Y)
157
+ *City FE and year-month FE +weather
158
+ qui xi: areg `y' treat_m712_before2 treat_m56_before2 treat_m34_before2 treat_m12_after2 treat_m34_after2 treat_m56_after2 treat_m712_after2 wind_speed rain temp rh i.year_month , absorb(code_city) vce(cluster code_city)
159
+ outreg2 using "$path/Results/Table2_B", excel dec(2) append keep(treat_m712_before2 treat_m56_before2 treat_m34_before2 treat_m12_after2 treat_m34_after2 treat_m56_after2 treat_m712_after2) ctitle(`y') addtext(Sample, Deadline, City FE, Y, Year-Month FE, Y, Weather Controls, Y)
160
+ }
161
+
162
+
163
+ ***The End
9/replication_package/Code/Tables_NEW_1.do ADDED
@@ -0,0 +1,503 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ***This is the main program for Tables 1, 2, 3 generated using Stata 15 MP
2
+
3
+ clear all
4
+ set more off
5
+
6
+ *global path "/Users/`c(username)'/Dropbox/China_Pollution_Monitoring"
7
+
8
+
9
+ *==============================================================================*
10
+ *Table 1A: RD
11
+ *==============================================================================*
12
+ ***Row 1. Daily PM10
13
+ use "$path/Data/station_day_1116",clear
14
+ gen T=date-auto_date
15
+ gen month=month(date)
16
+
17
+ foreach x in wind_speed rain temp rh {
18
+ gen `x'2= `x'*`x'
19
+ gen `x'3= `x'2*`x'
20
+ }
21
+
22
+ qui reghdfe pm10 wind_speed rain temp rh, absorb(pm10_n month) res(resid_pm10_smw)
23
+ *raw
24
+ qui rdrobust pm10 T if temp!=. & rain!=. & rh!=. & wind_speed !=., c(0) p(1) q(2) kernel(tri) vce(cluster code_city) masspoints(off)
25
+ outreg2 using "$path/Results/Table1_A1", excel dec(1) replace ctitle(pm10) addtext(Sample, All) addstat(Obs.(Daily), e(N_h_l)+e(N_h_r), Bandwidth (Days), floor(e(h_l))) title(Table 1 - original) tex
26
+ *residual
27
+ qui rdrobust resid_pm10_smw T, c(0) p(1) q(2) kernel(tri) vce(cluster code_city) masspoints(off)
28
+ outreg2 using "$path/Results/Table1_A1", excel dec(1) append ctitle(pm10) addtext(Sample, All, Station FE, Y, Month FE, Y, Weather Controls, Y) addstat(Obs.(Daily), e(N_h_l)+e(N_h_r), Bandwidth (Days), floor(e(h_l))) tex
29
+ *wave 1
30
+ qui rdrobust resid_pm10_smw T if phase==1, c(0) p(1) q(2) kernel(tri) vce(cluster code_city) masspoints(off)
31
+ outreg2 using "$path/Results/Table1_A1", excel dec(1) append ctitle(pm10) addtext(Sample, Wave 1, Station FE, Y, Month FE, Y, Weather Controls, Y) addstat(Obs.(Daily), e(N_h_l)+e(N_h_r), Bandwidth (Days), floor(e(h_l))) tex
32
+ *wave 2
33
+ qui rdrobust resid_pm10_smw T if phase==2, c(0) p(1) q(2) kernel(tri) vce(cluster code_city) masspoints(off)
34
+ outreg2 using "$path/Results/Table1_A1", excel dec(1) append ctitle(pm10) addtext(Sample, Wave 2, Station FE, Y, Month FE, Y, Weather Controls, Y) addstat(Obs.(Daily), e(N_h_l)+e(N_h_r), Bandwidth (Days), floor(e(h_l))) tex
35
+ *deadline
36
+ qui rdrobust resid_pm10_smw T if auto_date==19359 | auto_date==19724, c(0) p(1) q(2) kernel(tri) vce(cluster code_city) masspoints(off)
37
+ outreg2 using "$path/Results/Table1_A1", excel dec(1) append ctitle(pm10) addtext(Sample, Deadline, Station FE, Y, Month FE, Y, Weather Controls, Y) addstat(Obs.(Daily), e(N_h_l)+e(N_h_r), Bandwidth (Days), floor(e(h_l))) tex
38
+
39
+
40
+ *** NEW Panel: quadratic polynomial of weather variables
41
+ qui reghdfe pm10 wind_speed rain temp rh wind_speed2 rain2 temp2 rh2 , absorb(pm10_n month) res(resid_pm10_smw2)
42
+ *raw
43
+ qui rdrobust pm10 T if temp!=. & rain!=. & rh!=. & wind_speed !=., c(0) p(1) q(2) covs(wind_speed rain temp rh) kernel(tri) vce(cluster code_city) masspoints(off)
44
+ outreg2 using "$path/Results/Table1_A1_cg0", excel dec(1) replace ctitle(pm10) addtext(Sample, All) addstat(Obs.(Daily), e(N_h_l)+e(N_h_r), Bandwidth (Days), floor(e(h_l))) tex
45
+ *residual
46
+ * NEW
47
+ qui rdrobust resid_pm10_smw2 T, c(0) p(1) q(2) kernel(tri) vce(cluster code_city) masspoints(off)
48
+ outreg2 using "$path/Results/Table1_A1_cg0", excel dec(1) append ctitle(pm10) addtext(Sample, All, Station FE, Y, Month FE, Y, Weather Controls, Y) addstat(Obs.(Daily), e(N_h_l)+e(N_h_r), Bandwidth (Days), floor(e(h_l))) tex
49
+ *wave 1
50
+ * NEW
51
+ qui rdrobust resid_pm10_smw2 T if phase==1, c(0) p(1) q(2) kernel(tri) vce(cluster code_city) masspoints(off)
52
+ outreg2 using "$path/Results/Table1_A1_cg0", excel dec(1) append ctitle(pm10) addtext(Sample, Wave 1, Station FE, Y, Month FE, Y, Weather Controls, Y) addstat(Obs.(Daily), e(N_h_l)+e(N_h_r), Bandwidth (Days), floor(e(h_l))) tex
53
+ *wave 2
54
+ * NEW
55
+ qui rdrobust resid_pm10_smw2 T if phase==2, c(0) p(1) q(2) kernel(tri) vce(cluster code_city) masspoints(off)
56
+ outreg2 using "$path/Results/Table1_A1_cg0", excel dec(1) append ctitle(pm10) addtext(Sample, Wave 2, Station FE, Y, Month FE, Y, Weather Controls, Y) addstat(Obs.(Daily), e(N_h_l)+e(N_h_r), Bandwidth (Days), floor(e(h_l))) tex
57
+ *deadline
58
+ * NEW
59
+ qui rdrobust resid_pm10_smw2 T if auto_date==19359 | auto_date==19724, c(0) p(1) q(2) kernel(tri) vce(cluster code_city) masspoints(off)
60
+ outreg2 using "$path/Results/Table1_A1_cg0", excel dec(1) append ctitle(pm10) addtext(Sample, Deadline, Station FE, Y, Month FE, Y, Weather Controls, Y) addstat(Obs.(Daily), e(N_h_l)+e(N_h_r), Bandwidth (Days), floor(e(h_l))) tex
61
+
62
+ *** NEW Panel2: cubic polynomial of weather variables
63
+ qui reghdfe pm10 wind_speed* rain* temp* rh* , absorb(pm10_n month) res(resid_pm10_smw3)
64
+ *raw
65
+ qui rdrobust pm10 T if temp!=. & rain!=. & rh!=. & wind_speed !=., c(0) p(1) q(2) covs(wind_speed rain temp rh) kernel(tri) vce(cluster code_city) masspoints(off)
66
+ outreg2 using "$path/Results/Table1_A1_cg00", excel dec(1) replace ctitle(pm10) addtext(Sample, All) addstat(Obs.(Daily), e(N_h_l)+e(N_h_r), Bandwidth (Days), floor(e(h_l))) tex
67
+ *residual
68
+ * NEW
69
+ qui rdrobust resid_pm10_smw3 T, c(0) p(1) q(2) kernel(tri) vce(cluster code_city) masspoints(off)
70
+ outreg2 using "$path/Results/Table1_A1_cg00", excel dec(1) append ctitle(pm10) addtext(Sample, All, Station FE, Y, Month FE, Y, Weather Controls, Y) addstat(Obs.(Daily), e(N_h_l)+e(N_h_r), Bandwidth (Days), floor(e(h_l))) tex
71
+ *wave 1
72
+ * NEW
73
+ qui rdrobust resid_pm10_smw3 T if phase==1, c(0) p(1) q(2) kernel(tri) vce(cluster code_city) masspoints(off)
74
+ outreg2 using "$path/Results/Table1_A1_cg00", excel dec(1) append ctitle(pm10) addtext(Sample, Wave 1, Station FE, Y, Month FE, Y, Weather Controls, Y) addstat(Obs.(Daily), e(N_h_l)+e(N_h_r), Bandwidth (Days), floor(e(h_l))) tex
75
+ *wave 2
76
+ * NEW
77
+ qui rdrobust resid_pm10_smw3 T if phase==2, c(0) p(1) q(2) kernel(tri) vce(cluster code_city) masspoints(off)
78
+ outreg2 using "$path/Results/Table1_A1_cg00", excel dec(1) append ctitle(pm10) addtext(Sample, Wave 2, Station FE, Y, Month FE, Y, Weather Controls, Y) addstat(Obs.(Daily), e(N_h_l)+e(N_h_r), Bandwidth (Days), floor(e(h_l))) tex
79
+ *deadline
80
+ * NEW
81
+ qui rdrobust resid_pm10_smw3 T if auto_date==19359 | auto_date==19724, c(0) p(1) q(2) kernel(tri) vce(cluster code_city) masspoints(off)
82
+ outreg2 using "$path/Results/Table1_A1_cg00", excel dec(1) append ctitle(pm10) addtext(Sample, Deadline, Station FE, Y, Month FE, Y, Weather Controls, Y) addstat(Obs.(Daily), e(N_h_l)+e(N_h_r), Bandwidth (Days), floor(e(h_l))) tex
83
+
84
+
85
+
86
+ ***Row 2: Monthly AOD
87
+ use "$path/Data/station_month.dta",clear
88
+ qui reghdfe aod wind_speed rain temp rh, absorb(pm10_n month) res(resid_aod_smw)
89
+ *raw
90
+ qui rdrobust aod n_month if temp!=. & rain!=. & rh!=. & wind_speed !=. & resid_aod_smw!=., c(0) p(1) q(2) kernel(tri) vce(cluster code_city) masspoints(off)
91
+ outreg2 using "$path/Results/Table1_A2", excel dec(3) replace ctitle(aod) addtext(Sample, All) addstat(Obs.(Monthly), e(N_h_l)+e(N_h_r), Bandwidth (Months), floor(e(h_l))) tex
92
+ *residual
93
+ qui rdrobust resid_aod_smw n_month, c(0) p(1) q(2) kernel(tri) vce(cluster code_city) masspoints(off)
94
+ outreg2 using "$path/Results/Table1_A2", excel dec(3) append ctitle(aod) addtext(Sample, All, Station FE, Y, Month FE, Y, Weather Controls, Y) addstat(Obs.(Monthly), e(N_h_l)+e(N_h_r), Bandwidth (Months), floor(e(h_l))) tex
95
+ *wave 1
96
+ qui rdrobust resid_aod_smw n_month if phase==1, c(0) p(1) q(2) kernel(tri) vce(cluster code_city) masspoints(off)
97
+ outreg2 using "$path/Results/Table1_A2", excel dec(3) append ctitle(aod) addtext(Sample, Wave 1, Station FE, Y, Month FE, Y, Weather Controls, Y) addstat(Obs.(Monthly), e(N_h_l)+e(N_h_r), Bandwidth (Months), floor(e(h_l))) tex
98
+ *wave 2
99
+ qui rdrobust resid_aod_smw n_month if phase==2, c(0) p(1) q(2) kernel(tri) vce(cluster code_city) masspoints(off)
100
+ outreg2 using "$path/Results/Table1_A2", excel dec(3) append ctitle(aod) addtext(Sample, Wave 2, Station FE, Y, Month FE, Y, Weather Controls, Y) addstat(Obs.(Monthly), e(N_h_l)+e(N_h_r), Bandwidth (Months), floor(e(h_l))) tex
101
+ *deadline
102
+ qui rdrobust resid_aod_smw n_month if auto_date==19359 | auto_date==19724, c(0) p(1) q(2) kernel(tri) vce(cluster code_city) masspoints(off)
103
+ outreg2 using "$path/Results/Table1_A2", excel dec(3) append ctitle(aod) addtext(Sample, Deadline, Station FE, Y, Month FE, Y, Weather Controls, Y) addstat(Obs.(Monthly), e(N_h_l)+e(N_h_r), Bandwidth (Months), floor(e(h_l))) tex
104
+
105
+ *** NEW panel: quadratic polynomial of weather variables
106
+ foreach x in wind_speed rain temp rh {
107
+ gen `x'2= `x'*`x'
108
+ gen `x'3= `x'2*`x'
109
+ }
110
+ qui reghdfe aod wind_speed rain temp rh wind_speed2 rain2 temp2 rh2, absorb(pm10_n month) res(resid_aod_smw2)
111
+ *raw
112
+ qui rdrobust aod n_month if temp!=. & rain!=. & rh!=. & wind_speed !=. & resid_aod_smw2!=., c(0) p(1) q(2) covs(wind_speed rain temp rh) kernel(tri) vce(cluster code_city) masspoints(off)
113
+ outreg2 using "$path/Results/Table1_A2_cg0", excel dec(3) replace ctitle(aod) addtext(Sample, All) addstat(Obs.(Monthly), e(N_h_l)+e(N_h_r), Bandwidth (Months), floor(e(h_l))) tex
114
+ *residual
115
+ qui rdrobust resid_aod_smw2 n_month, c(0) p(1) q(2) kernel(tri) vce(cluster code_city) masspoints(off)
116
+ outreg2 using "$path/Results/Table1_A2_cg0", excel dec(3) append ctitle(aod) addtext(Sample, All, Station FE, Y, Month FE, Y, Weather Controls, Y) addstat(Obs.(Monthly), e(N_h_l)+e(N_h_r), Bandwidth (Months), floor(e(h_l))) tex
117
+ *wave 1
118
+ qui rdrobust resid_aod_smw2 n_month if phase==1, c(0) p(1) q(2) kernel(tri) vce(cluster code_city) masspoints(off)
119
+ outreg2 using "$path/Results/Table1_A2_cg0", excel dec(3) append ctitle(aod) addtext(Sample, Wave 1, Station FE, Y, Month FE, Y, Weather Controls, Y) addstat(Obs.(Monthly), e(N_h_l)+e(N_h_r), Bandwidth (Months), floor(e(h_l))) tex
120
+ *wave 2
121
+ qui rdrobust resid_aod_smw2 n_month if phase==2, c(0) p(1) q(2) kernel(tri) vce(cluster code_city) masspoints(off)
122
+ outreg2 using "$path/Results/Table1_A2_cg0", excel dec(3) append ctitle(aod) addtext(Sample, Wave 2, Station FE, Y, Month FE, Y, Weather Controls, Y) addstat(Obs.(Monthly), e(N_h_l)+e(N_h_r), Bandwidth (Months), floor(e(h_l))) tex
123
+ *deadline
124
+ qui rdrobust resid_aod_smw2 n_month if auto_date==19359 | auto_date==19724, c(0) p(1) q(2) kernel(tri) vce(cluster code_city) masspoints(off)
125
+ outreg2 using "$path/Results/Table1_A2_cg0", excel dec(3) append ctitle(aod) addtext(Sample, Deadline, Station FE, Y, Month FE, Y, Weather Controls, Y) addstat(Obs.(Monthly), e(N_h_l)+e(N_h_r), Bandwidth (Months), floor(e(h_l))) tex
126
+
127
+ * NEW panel2: cubic polynomial of weather variables
128
+ qui reghdfe aod wind_speed* rain* temp* rh*, absorb(pm10_n month) res(resid_aod_smw3)
129
+ *raw
130
+ qui rdrobust aod n_month if temp!=. & rain!=. & rh!=. & wind_speed !=. & resid_aod_smw3!=., c(0) p(1) q(2) covs(wind_speed rain temp rh) kernel(tri) vce(cluster code_city) masspoints(off)
131
+ outreg2 using "$path/Results/Table1_A2_cg00", excel dec(3) replace ctitle(aod) addtext(Sample, All) addstat(Obs.(Monthly), e(N_h_l)+e(N_h_r), Bandwidth (Months), floor(e(h_l))) tex
132
+ *residual
133
+ qui rdrobust resid_aod_smw3 n_month, c(0) p(1) q(2) kernel(tri) vce(cluster code_city) masspoints(off)
134
+ outreg2 using "$path/Results/Table1_A2_cg00", excel dec(3) append ctitle(aod) addtext(Sample, All, Station FE, Y, Month FE, Y, Weather Controls, Y) addstat(Obs.(Monthly), e(N_h_l)+e(N_h_r), Bandwidth (Months), floor(e(h_l))) tex
135
+ *wave 1
136
+ qui rdrobust resid_aod_smw3 n_month if phase==1, c(0) p(1) q(2) kernel(tri) vce(cluster code_city) masspoints(off)
137
+ outreg2 using "$path/Results/Table1_A2_cg00", excel dec(3) append ctitle(aod) addtext(Sample, Wave 1, Station FE, Y, Month FE, Y, Weather Controls, Y) addstat(Obs.(Monthly), e(N_h_l)+e(N_h_r), Bandwidth (Months), floor(e(h_l))) tex
138
+ *wave 2
139
+ qui rdrobust resid_aod_smw3 n_month if phase==2, c(0) p(1) q(2) kernel(tri) vce(cluster code_city) masspoints(off)
140
+ outreg2 using "$path/Results/Table1_A2_cg00", excel dec(3) append ctitle(aod) addtext(Sample, Wave 2, Station FE, Y, Month FE, Y, Weather Controls, Y) addstat(Obs.(Monthly), e(N_h_l)+e(N_h_r), Bandwidth (Months), floor(e(h_l))) tex
141
+ *deadline
142
+ qui rdrobust resid_aod_smw3 n_month if auto_date==19359 | auto_date==19724, c(0) p(1) q(2) kernel(tri) vce(cluster code_city) masspoints(off)
143
+ outreg2 using "$path/Results/Table1_A2_cg00", excel dec(3) append ctitle(aod) addtext(Sample, Deadline, Station FE, Y, Month FE, Y, Weather Controls, Y) addstat(Obs.(Monthly), e(N_h_l)+e(N_h_r), Bandwidth (Months), floor(e(h_l))) tex
144
+
145
+
146
+ *==============================================================================*
147
+ *Table 1B: Event-Study Estimates
148
+ *==============================================================================*
149
+ ***Deadline
150
+ use "$path/Data/station_day_1116.dta",clear
151
+ gen year=year(date)
152
+ gen month=month(date)
153
+ egen year_month=group(year month)
154
+ keep if year>=2012 & year<=2013
155
+ keep if auto_date==19724 | auto_date==19359
156
+ gen treat=(auto_date==19359)
157
+ gen after2=(year>=2013)
158
+ gen m12_before2=(year==2012 & month>=11 & month<=12)
159
+ gen m34_before2=(year==2012 & month>=9 & month<=10)
160
+ gen m56_before2=(year==2012 & month>=7 & month<=8)
161
+ gen m712_before2=(year==2012 & month>=1 & month<=6)
162
+ gen m12_after2=(year==2013 & month>=1 & month<=2)
163
+ gen m34_after2=(year==2013 & month>=3 & month<=4)
164
+ gen m56_after2=(year==2013 & month>=5 & month<=6)
165
+ gen m712_after2=(year==2013 & month>=7 & month<=12)
166
+
167
+ foreach v in 12 34 56 712{
168
+ gen treat_m`v'_before2=treat*m`v'_before2
169
+ gen treat_m`v'_after2=treat*m`v'_after2
170
+ }
171
+
172
+ foreach x in wind_speed rain temp rh {
173
+ gen `x'2= `x'*`x'
174
+ gen `x'3= `x'2*`x'
175
+ }
176
+
177
+ qui reghdfe pm10 treat_m712_before2 treat_m56_before2 treat_m34_before2 treat_m12_after2 treat_m34_after2 treat_m56_after2 treat_m712_after2 wind_speed rain temp rh, absorb(pm10_n month) vce(cluster code_city)
178
+ outreg2 using "$path/Results/Table1_B", excel dec(1) replace keep (treat_m712_before2 treat_m56_before2 treat_m34_before2 treat_m12_after2 treat_m34_after2 treat_m56_after2 treat_m712_after2) ctitle(PM10) addtext(Sample, Deadline, Weather Controls, Y, Station FE, Y, Month FE, Y) tex
179
+ qui reghdfe pm10 treat_m712_before2 treat_m56_before2 treat_m34_before2 treat_m12_after2 treat_m34_after2 treat_m56_after2 treat_m712_after2 wind_speed rain temp rh, absorb(pm10_n year_month) vce(cluster code_city)
180
+ outreg2 using "$path/Results/Table1_B", excel dec(1) append keep (treat_m712_before2 treat_m56_before2 treat_m34_before2 treat_m12_after2 treat_m34_after2 treat_m56_after2 treat_m712_after2) ctitle(PM10) addtext(Sample, Deadline, Weather Controls, Y, Station FE, Y, Year-Month FE, Y) tex
181
+
182
+ * NEW panel: quadratic polynomial of weather variables
183
+ qui reghdfe pm10 treat_m712_before2 treat_m56_before2 treat_m34_before2 treat_m12_after2 treat_m34_after2 treat_m56_after2 treat_m712_after2 wind_speed rain temp rh wind_speed2 rain2 temp2 rh2, absorb(pm10_n month) vce(cluster code_city)
184
+ outreg2 using "$path/Results/Table1_B_cg0", excel dec(1) replace keep (treat_m712_before2 treat_m56_before2 treat_m34_before2 treat_m12_after2 treat_m34_after2 treat_m56_after2 treat_m712_after2) ctitle(PM10) addtext(Sample, Deadline, Weather Controls, Y, Station FE, Y, Month FE, Y) tex
185
+ qui reghdfe pm10 treat_m712_before2 treat_m56_before2 treat_m34_before2 treat_m12_after2 treat_m34_after2 treat_m56_after2 treat_m712_after2 wind_speed rain temp rh wind_speed2 rain2 temp2 rh2, absorb(pm10_n year_month) vce(cluster code_city)
186
+ outreg2 using "$path/Results/Table1_B_cg0", excel dec(1) append keep (treat_m712_before2 treat_m56_before2 treat_m34_before2 treat_m12_after2 treat_m34_after2 treat_m56_after2 treat_m712_after2) ctitle(PM10) addtext(Sample, Deadline, Weather Controls, Y, Station FE, Y, Year-Month FE, Y) tex
187
+ * NEW panel2: cubic polynomial of weather variables
188
+ qui reghdfe pm10 treat_m712_before2 treat_m56_before2 treat_m34_before2 treat_m12_after2 treat_m34_after2 treat_m56_after2 treat_m712_after2 wind_speed* rain temp* rh* , absorb(pm10_n month) vce(cluster code_city)
189
+ outreg2 using "$path/Results/Table1_B_cg00", excel dec(1) append keep (treat_m712_before2 treat_m56_before2 treat_m34_before2 treat_m12_after2 treat_m34_after2 treat_m56_after2 treat_m712_after2) ctitle(PM10) addtext(Sample, Deadline, Weather Controls, Y, Station FE, Y, Month FE, Y) tex
190
+ qui reghdfe pm10 treat_m712_before2 treat_m56_before2 treat_m34_before2 treat_m12_after2 treat_m34_after2 treat_m56_after2 treat_m712_after2 wind_speed* rain* temp* rh*, absorb(pm10_n year_month) vce(cluster code_city)
191
+ outreg2 using "$path/Results/Table1_B_cg00", excel dec(1) append keep (treat_m712_before2 treat_m56_before2 treat_m34_before2 treat_m12_after2 treat_m34_after2 treat_m56_after2 treat_m712_after2) ctitle(PM10) addtext(Sample, Deadline, Weather Controls, Y, Station FE, Y, Year-Month FE, Y) tex
192
+
193
+ * NEW panel with time trend
194
+ qui egen cityxyear = group(code_city year)
195
+ qui egen cityxmonth = group(code_city year_month)
196
+
197
+ qui reghdfe pm10 treat_m712_before2 treat_m56_before2 treat_m34_before2 treat_m12_after2 treat_m34_after2 treat_m56_after2 treat_m712_after2 wind_speed rain temp rh i.code_city#c.year_month, absorb(pm10_n month) vce(cluster code_city)
198
+ outreg2 using "$path/Results/Table1_B_cg1", excel dec(1) replace keep (treat_m712_before2 treat_m56_before2 treat_m34_before2 treat_m12_after2 treat_m34_after2 treat_m56_after2 treat_m712_after2) ctitle(PM10) addtext(Sample, Deadline, Weather Controls, Y, Station FE, Y, Month FE, Y, Yearly city trend, Y) tex
199
+ qui reghdfe pm10 treat_m712_before2 treat_m56_before2 treat_m34_before2 treat_m12_after2 treat_m34_after2 treat_m56_after2 treat_m712_after2 wind_speed rain temp rh , absorb(pm10_n month cityxyear) vce(cluster code_city)
200
+ outreg2 using "$path/Results/Table1_B_cg1", excel dec(1) append keep (treat_m712_before2 treat_m56_before2 treat_m34_before2 treat_m12_after2 treat_m34_after2 treat_m56_after2 treat_m712_after2) ctitle(PM10) addtext(Sample, Deadline, Weather Controls, Y, Station FE, Y, Month FE, Y, City-Year FE, Y) tex
201
+ qui reghdfe pm10 treat_m712_before2 treat_m56_before2 treat_m34_before2 treat_m12_after2 treat_m34_after2 treat_m56_after2 treat_m712_after2 wind_speed rain temp rh , absorb(pm10_n cityxmonth) vce(cluster code_city)
202
+ outreg2 using "$path/Results/Table1_B_cg1", excel dec(1) append keep (treat_m712_before2 treat_m56_before2 treat_m34_before2 treat_m12_after2 treat_m34_after2 treat_m56_after2 treat_m712_after2) ctitle(PM10) addtext(Sample, Deadline, Weather Controls, Y, Station FE, Y, City-Year-Month FE, Y) tex
203
+
204
+ ***nearest matching
205
+ use "$path/Data/did_ddl_match.dta" ,clear
206
+ gen year=year(date)
207
+ gen month=month(date)
208
+ egen year_month=group(year month)
209
+ gen treat=(auto_date==19359)
210
+ gen after2=(year>=2013)
211
+ gen m12_before2=(year==2012 & month>=11 & month<=12)
212
+ gen m34_before2=(year==2012 & month>=9 & month<=10)
213
+ gen m56_before2=(year==2012 & month>=7 & month<=8)
214
+ gen m712_before2=(year==2012 & month>=1 & month<=6)
215
+ gen m12_after2=(year==2013 & month>=1 & month<=2)
216
+ gen m34_after2=(year==2013 & month>=3 & month<=4)
217
+ gen m56_after2=(year==2013 & month>=5 & month<=6)
218
+ gen m712_after2=(year==2013 & month>=7 & month<=12)
219
+
220
+ foreach v in 12 34 56 712{
221
+ gen treat_m`v'_before2=treat*m`v'_before2
222
+ gen treat_m`v'_after2=treat*m`v'_after2
223
+ }
224
+
225
+ foreach x in wind_speed rain temp rh {
226
+ gen `x'2= `x'*`x'
227
+ gen `x'3= `x'2*`x'
228
+ }
229
+
230
+ qui reghdfe pm10 treat_m712_before2 treat_m56_before2 treat_m34_before2 treat_m12_after2 treat_m34_after2 treat_m56_after2 treat_m712_after2 wind_speed rain temp rh, absorb(pm10_n month) vce(cluster code_city)
231
+ outreg2 using "$path/Results/Table1_B", excel dec(1) append keep (treat_m712_before2 treat_m56_before2 treat_m34_before2 treat_m12_after2 treat_m34_after2 treat_m56_after2 treat_m712_after2) ctitle(PM10) addtext(Sample, +Matching, Weather Controls, Y, Station FE, Y, Month FE, Y) tex
232
+ qui reghdfe pm10 treat_m712_before2 treat_m56_before2 treat_m34_before2 treat_m12_after2 treat_m34_after2 treat_m56_after2 treat_m712_after2 wind_speed rain temp rh, absorb(pm10_n year_month) vce(cluster code_city)
233
+ outreg2 using "$path/Results/Table1_B", excel dec(1) append keep (treat_m712_before2 treat_m56_before2 treat_m34_before2 treat_m12_after2 treat_m34_after2 treat_m56_after2 treat_m712_after2) ctitle(PM10) addtext(Sample, +Matching, Weather Controls, Y, Station FE, Y, Year-Month FE, Y) tex
234
+ *log_pm10
235
+ qui reghdfe l_pm10 treat_m712_before2 treat_m56_before2 treat_m34_before2 treat_m12_after2 treat_m34_after2 treat_m56_after2 treat_m712_after2 wind_speed rain temp rh, absorb(pm10_n year_month) vce(cluster code_city)
236
+ outreg2 using "$path/Results/Table1_B", excel dec(2) append keep (treat_m712_before2 treat_m56_before2 treat_m34_before2 treat_m12_after2 treat_m34_after2 treat_m56_after2 treat_m712_after2) ctitle(log_PM10) addtext(Sample, +Matching, Weather Controls, Y, Station FE, Y, Year-Month FE, Y) tex
237
+
238
+ * NEW panel: quadratic polynomial of weather variables
239
+ qui reghdfe pm10 treat_m712_before2 treat_m56_before2 treat_m34_before2 treat_m12_after2 treat_m34_after2 treat_m56_after2 treat_m712_after2 wind_speed rain temp rh wind_speed2 rain2 temp2 rh2, absorb(pm10_n month) vce(cluster code_city)
240
+ outreg2 using "$path/Results/Table1_B_cg0", excel dec(1) append keep (treat_m712_before2 treat_m56_before2 treat_m34_before2 treat_m12_after2 treat_m34_after2 treat_m56_after2 treat_m712_after2) ctitle(PM10) addtext(Sample, +Matching, Weather Controls, Y, Station FE, Y, Month FE, Y) tex
241
+ qui reghdfe pm10 treat_m712_before2 treat_m56_before2 treat_m34_before2 treat_m12_after2 treat_m34_after2 treat_m56_after2 treat_m712_after2 wind_speed rain temp rh wind_speed2 rain2 temp2 rh2, absorb(pm10_n year_month) vce(cluster code_city)
242
+ outreg2 using "$path/Results/Table1_B_cg0", excel dec(1) append keep (treat_m712_before2 treat_m56_before2 treat_m34_before2 treat_m12_after2 treat_m34_after2 treat_m56_after2 treat_m712_after2) ctitle(PM10) addtext(Sample, +Matching, Weather Controls, Y, Station FE, Y, Year-Month FE, Y) tex
243
+ *log_pm10
244
+ qui reghdfe l_pm10 treat_m712_before2 treat_m56_before2 treat_m34_before2 treat_m12_after2 treat_m34_after2 treat_m56_after2 treat_m712_after2 wind_speed rain temp rh wind_speed2 rain2 temp2 rh2, absorb(pm10_n year_month) vce(cluster code_city)
245
+ outreg2 using "$path/Results/Table1_B_cg0", excel dec(2) append keep (treat_m712_before2 treat_m56_before2 treat_m34_before2 treat_m12_after2 treat_m34_after2 treat_m56_after2 treat_m712_after2) ctitle(log_PM10) addtext(Sample, +Matching, Weather Controls, Y, Station FE, Y, Year-Month FE, Y) tex
246
+
247
+ * NEW panel2: cubic polynomial of weather variables
248
+ qui reghdfe pm10 treat_m712_before2 treat_m56_before2 treat_m34_before2 treat_m12_after2 treat_m34_after2 treat_m56_after2 treat_m712_after2 wind_speed* rain* temp* rh*, absorb(pm10_n month) vce(cluster code_city)
249
+ outreg2 using "$path/Results/Table1_B_cg00", excel dec(1) append keep (treat_m712_before2 treat_m56_before2 treat_m34_before2 treat_m12_after2 treat_m34_after2 treat_m56_after2 treat_m712_after2) ctitle(PM10) addtext(Sample, +Matching, Weather Controls, Y, Station FE, Y, Month FE, Y) tex
250
+ qui reghdfe pm10 treat_m712_before2 treat_m56_before2 treat_m34_before2 treat_m12_after2 treat_m34_after2 treat_m56_after2 treat_m712_after2 wind_speed* rain* temp* rh*, absorb(pm10_n year_month) vce(cluster code_city)
251
+ outreg2 using "$path/Results/Table1_B_cg00", excel dec(1) append keep (treat_m712_before2 treat_m56_before2 treat_m34_before2 treat_m12_after2 treat_m34_after2 treat_m56_after2 treat_m712_after2) ctitle(PM10) addtext(Sample, +Matching, Weather Controls, Y, Station FE, Y, Year-Month FE, Y) tex
252
+ *log_pm10
253
+ qui reghdfe l_pm10 treat_m712_before2 treat_m56_before2 treat_m34_before2 treat_m12_after2 treat_m34_after2 treat_m56_after2 treat_m712_after2 wind_speed* rain* temp* rh*, absorb(pm10_n year_month) vce(cluster code_city)
254
+ outreg2 using "$path/Results/Table1_B_cg00", excel dec(2) append keep (treat_m712_before2 treat_m56_before2 treat_m34_before2 treat_m12_after2 treat_m34_after2 treat_m56_after2 treat_m712_after2) ctitle(log_PM10) addtext(Sample, +Matching, Weather Controls, Y, Station FE, Y, Year-Month FE, Y) tex
255
+
256
+
257
+ * NEW panel with time trend
258
+ qui egen cityxyear = group(code_city year)
259
+ qui egen cityxmonth = group(code_city year_month)
260
+
261
+ qui reghdfe pm10 treat_m712_before2 treat_m56_before2 treat_m34_before2 treat_m12_after2 treat_m34_after2 treat_m56_after2 treat_m712_after2 wind_speed rain temp rh i.code_city#c.year_month, absorb(pm10_n month) vce(cluster code_city)
262
+ outreg2 using "$path/Results/Table1_B_cg1", excel dec(1) append keep (treat_m712_before2 treat_m56_before2 treat_m34_before2 treat_m12_after2 treat_m34_after2 treat_m56_after2 treat_m712_after2) ctitle(PM10) addtext(Sample, +Matching, Weather Controls, Y, Station FE, Y, Month FE, Y, Yearly city trend, Y) tex
263
+ qui reghdfe pm10 treat_m712_before2 treat_m56_before2 treat_m34_before2 treat_m12_after2 treat_m34_after2 treat_m56_after2 treat_m712_after2 wind_speed rain temp rh , absorb(pm10_n month cityxyear) vce(cluster code_city)
264
+ outreg2 using "$path/Results/Table1_B_cg1", excel dec(1) append keep (treat_m712_before2 treat_m56_before2 treat_m34_before2 treat_m12_after2 treat_m34_after2 treat_m56_after2 treat_m712_after2) ctitle(PM10) addtext(Sample, +Matching, Weather Controls, Y, Station FE, Y, Month FE, Y, City-Year FE, Y) tex
265
+ qui reghdfe pm10 treat_m712_before2 treat_m56_before2 treat_m34_before2 treat_m12_after2 treat_m34_after2 treat_m56_after2 treat_m712_after2 wind_speed rain temp rh , absorb(pm10_n cityxmonth) vce(cluster code_city)
266
+ outreg2 using "$path/Results/Table1_B_cg1", excel dec(1) append keep (treat_m712_before2 treat_m56_before2 treat_m34_before2 treat_m12_after2 treat_m34_after2 treat_m56_after2 treat_m712_after2) ctitle(PM10) addtext(Sample, +Matching, Weather Controls, Y, Station FE, Y, City-Year-Month FE, Y) tex
267
+ *log_pm10
268
+ qui reghdfe l_pm10 treat_m712_before2 treat_m56_before2 treat_m34_before2 treat_m12_after2 treat_m34_after2 treat_m56_after2 treat_m712_after2 wind_speed rain temp rh i.code_city#c.year_month, absorb(pm10_n month) vce(cluster code_city)
269
+ outreg2 using "$path/Results/Table1_B_cg1", excel dec(2) append keep (treat_m712_before2 treat_m56_before2 treat_m34_before2 treat_m12_after2 treat_m34_after2 treat_m56_after2 treat_m712_after2) ctitle(log_PM10) addtext(Sample, +Matching, Weather Controls, Y, Station FE, Y, Month FE, Y, Yearly city trend) tex
270
+ *log_pm10
271
+ qui reghdfe l_pm10 treat_m712_before2 treat_m56_before2 treat_m34_before2 treat_m12_after2 treat_m34_after2 treat_m56_after2 treat_m712_after2 wind_speed rain temp rh, absorb(pm10_n month cityxyear) vce(cluster code_city)
272
+ outreg2 using "$path/Results/Table1_B_cg1", excel dec(2) append keep (treat_m712_before2 treat_m56_before2 treat_m34_before2 treat_m12_after2 treat_m34_after2 treat_m56_after2 treat_m712_after2) ctitle(log_PM10) addtext(Sample, +Matching, Weather Controls, Y, Station FE, Y, Month FE, Y, City-Year FE, Y) tex
273
+ *log_pm10
274
+ qui reghdfe l_pm10 treat_m712_before2 treat_m56_before2 treat_m34_before2 treat_m12_after2 treat_m34_after2 treat_m56_after2 treat_m712_after2 wind_speed rain temp rh, absorb(pm10_n cityxmonth) vce(cluster code_city)
275
+ outreg2 using "$path/Results/Table1_B_cg1", excel dec(2) append keep (treat_m712_before2 treat_m56_before2 treat_m34_before2 treat_m12_after2 treat_m34_after2 treat_m56_after2 treat_m712_after2) ctitle(log_PM10) addtext(Sample, +Matching, Weather Controls, Y, Station FE, Y, City-Year-Month FE, Y) tex
276
+
277
+
278
+ * NEW nearest neighbor matching
279
+ use "$path/Data/station_day_1116.dta",clear
280
+ gen year=year(date)
281
+ gen month=month(date)
282
+ egen year_month=group(year month)
283
+ keep if year>=2012 & year<=2013
284
+ keep if auto_date==19724 | auto_date==19359
285
+ gen treat=(auto_date==19359)
286
+ gen after2=(year>=2013)
287
+ gen m12_before2=(year==2012 & month>=11 & month<=12)
288
+ gen m34_before2=(year==2012 & month>=9 & month<=10)
289
+ gen m56_before2=(year==2012 & month>=7 & month<=8)
290
+ gen m712_before2=(year==2012 & month>=1 & month<=6)
291
+ gen m12_after2=(year==2013 & month>=1 & month<=2)
292
+ gen m34_after2=(year==2013 & month>=3 & month<=4)
293
+ gen m56_after2=(year==2013 & month>=5 & month<=6)
294
+ gen m712_after2=(year==2013 & month>=7 & month<=12)
295
+
296
+ foreach v in 12 34 56 712{
297
+ gen treat_m`v'_before2=treat*m`v'_before2
298
+ gen treat_m`v'_after2=treat*m`v'_after2
299
+ }
300
+
301
+ merge m:1 pm10_n using "$path/Data/station_list.dta"
302
+ keep if _merge==3
303
+ drop _merge
304
+ collapse year, by(pm10_n treat)
305
+
306
+ *cem station_lat station_lon , treatment(treat)
307
+
308
+
309
+
310
+
311
+ *==============================================================================*
312
+ *Table 2A: City-Month Online Search
313
+ *==============================================================================*
314
+ use "$path/Data/search_city_month.dta",clear
315
+
316
+ foreach x in wind_speed rain temp rh {
317
+ gen `x'2= `x'*`x'
318
+ gen `x'3= `x'2*`x'
319
+ }
320
+
321
+ foreach y in pmmask filter l_pmmask l_filter {
322
+ qui reghdfe `y' wind_speed rain temp rh, absorb(code_city month) res(resid_`y'_smw)
323
+ *raw
324
+ qui rdrobust `y' n_month if temp!=. & rain!=. & rh!=. & wind_speed !=., c(0) p(1) q(2) kernel(tri) vce(cluster code_city) masspoints(off)
325
+ outreg2 using "$path/Results/Table2_A`y'", excel dec(2) replace ctitle(`y') addtext(Sample, All) addstat(Effective Obs, e(N_h_l)+e(N_h_r), Bandwidth, floor(e(h_l))) tex
326
+ *residual
327
+ qui rdrobust resid_`y'_smw n_month, c(0) p(1) q(2) kernel(tri) vce(cluster code_city) masspoints(off)
328
+ outreg2 using "$path/Results/Table2_A`y'", excel dec(2) append ctitle(`y') addtext(Sample, All, City FE, Y, Month FE, Y, Weather Controls, Y) addstat(Effective Obs, e(N_h_l)+e(N_h_r), Bandwidth, floor(e(h_l))) tex
329
+ *normal
330
+ qui rdrobust resid_`y'_smw n_month if rd==0, c(0) p(1) q(2) kernel(tri) vce(cluster code_city) masspoints(off)
331
+ outreg2 using "$path/Results/Table2_A`y'", excel dec(2) append ctitle(`y') addtext(Sample, Normal, City FE, Y, Month FE, Y, Weather Controls, Y) addstat(Effective Obs, e(N_h_l)+e(N_h_r), Bandwidth, floor(e(h_l))) tex
332
+ *manipulated
333
+ qui rdrobust resid_`y'_smw n_month if rd==1, c(0) p(1) q(2) kernel(tri) vce(cluster code_city) masspoints(off)
334
+ outreg2 using "$path/Results/Table2_A`y'", excel dec(2) append ctitle(`y') addtext(Sample, Manipulate, City FE, Y, Month FE, Y, Weather Controls, Y) addstat(Effective Obs, e(N_h_l)+e(N_h_r), Bandwidth, floor(e(h_l))) tex
335
+
336
+ * NEW PANEL: using 1% significance for selecting manipulating cities - variable rd2 defined in section 8. of Prepare_Data_cg0
337
+ *normal
338
+ qui rdrobust resid_`y'_smw n_month if rd2==0, c(0) p(1) q(2) kernel(tri) vce(cluster code_city) masspoints(off)
339
+ outreg2 using "$path/Results/Table2_A`y'_cg3", excel dec(2) replace ctitle(`y') addtext(Sample, Normal, City FE, Y, Month FE, Y, Weather Controls, Y) addstat(Effective Obs, e(N_h_l)+e(N_h_r), Bandwidth, floor(e(h_l))) tex
340
+ *manipulated
341
+ qui rdrobust resid_`y'_smw n_month if rd2==1, c(0) p(1) q(2) kernel(tri) vce(cluster code_city) masspoints(off)
342
+ outreg2 using "$path/Results/Table2_A`y'_cg3", excel dec(2) append ctitle(`y') addtext(Sample, Manipulate, City FE, Y, Month FE, Y, Weather Controls, Y) addstat(Effective Obs, e(N_h_l)+e(N_h_r), Bandwidth, floor(e(h_l))) tex
343
+ * NEW 2SD: using above 2SD for selecting manipulating cities - variable rd3 defined in section 8. of Prepare_Data_cg0
344
+ *normal
345
+ qui rdrobust resid_`y'_smw n_month if rd3==0, c(0) p(1) q(2) kernel(tri) vce(cluster code_city) masspoints(off)
346
+ outreg2 using "$path/Results/Table2_A`y'_cg3", excel dec(2) append ctitle(`y') addtext(Sample, Normal, City FE, Y, Month FE, Y, Weather Controls, Y) addstat(Effective Obs, e(N_h_l)+e(N_h_r), Bandwidth, floor(e(h_l))) tex
347
+ *manipulated
348
+ qui rdrobust resid_`y'_smw n_month if rd3==1, c(0) p(1) q(2) kernel(tri) vce(cluster code_city) masspoints(off)
349
+ outreg2 using "$path/Results/Table2_A`y'_cg3", excel dec(2) append ctitle(`y') addtext(Sample, Manipulate, City FE, Y, Month FE, Y, Weather Controls, Y) addstat(Effective Obs, e(N_h_l)+e(N_h_r), Bandwidth, floor(e(h_l))) tex
350
+
351
+ * NEW panel: quadratic polynomial of weather variables
352
+ qui reghdfe `y' wind_speed rain temp rh wind_speed2 rain2 temp2 rh2, absorb(code_city month) res(resid_`y'_smw2)
353
+ *raw
354
+ qui rdrobust `y' n_month if temp!=. & rain!=. & rh!=. & wind_speed !=., c(0) p(1) q(2) covs(wind_speed rain temp rh) kernel(tri) vce(cluster code_city) masspoints(off)
355
+ outreg2 using "$path/Results/Table2_A`y'_cg0", excel dec(2) replace ctitle(`y') addtext(Sample, All) addstat(Effective Obs, e(N_h_l)+e(N_h_r), Bandwidth, floor(e(h_l))) tex
356
+ *residual
357
+ qui rdrobust resid_`y'_smw2 n_month, c(0) p(1) q(2) kernel(tri) vce(cluster code_city) masspoints(off)
358
+ outreg2 using "$path/Results/Table2_A`y'_cg0", excel dec(2) append ctitle(`y') addtext(Sample, All, City FE, Y, Month FE, Y, Weather Controls, Y) addstat(Effective Obs, e(N_h_l)+e(N_h_r), Bandwidth, floor(e(h_l))) tex
359
+ *normal
360
+ qui rdrobust resid_`y'_smw2 n_month if rd==0, c(0) p(1) q(2) kernel(tri) vce(cluster code_city) masspoints(off)
361
+ outreg2 using "$path/Results/Table2_A`y'_cg0", excel dec(2) append ctitle(`y') addtext(Sample, Normal, City FE, Y, Month FE, Y, Weather Controls, Y) addstat(Effective Obs, e(N_h_l)+e(N_h_r), Bandwidth, floor(e(h_l))) tex
362
+ *manipulated
363
+ qui rdrobust resid_`y'_smw2 n_month if rd==1, c(0) p(1) q(2) kernel(tri) vce(cluster code_city) masspoints(off)
364
+ outreg2 using "$path/Results/Table2_A`y'_cg0", excel dec(2) append ctitle(`y') addtext(Sample, Manipulate, City FE, Y, Month FE, Y, Weather Controls, Y) addstat(Effective Obs, e(N_h_l)+e(N_h_r), Bandwidth, floor(e(h_l))) tex
365
+
366
+ * NEW panel2: cubic polynomial of weather variables
367
+ qui reghdfe `y' wind_speed* rain* temp* rh*, absorb(code_city month) res(resid_`y'_smw3)
368
+ *raw
369
+ qui rdrobust `y' n_month if temp!=. & rain!=. & rh!=. & wind_speed !=., c(0) p(1) q(2) covs(wind_speed rain temp rh) kernel(tri) vce(cluster code_city) masspoints(off)
370
+ outreg2 using "$path/Results/Table2_A`y'_cg00", excel dec(2) replace ctitle(`y') addtext(Sample, All) addstat(Effective Obs, e(N_h_l)+e(N_h_r), Bandwidth, floor(e(h_l))) tex
371
+ *residual
372
+ qui rdrobust resid_`y'_smw3 n_month, c(0) p(1) q(2) kernel(tri) vce(cluster code_city) masspoints(off)
373
+ outreg2 using "$path/Results/Table2_A`y'_cg00", excel dec(2) append ctitle(`y') addtext(Sample, All, City FE, Y, Month FE, Y, Weather Controls, Y) addstat(Effective Obs, e(N_h_l)+e(N_h_r), Bandwidth, floor(e(h_l))) tex
374
+ *normal
375
+ qui rdrobust resid_`y'_smw3 n_month if rd==0, c(0) p(1) q(2) kernel(tri) vce(cluster code_city) masspoints(off)
376
+ outreg2 using "$path/Results/Table2_A`y'_cg00", excel dec(2) append ctitle(`y') addtext(Sample, Normal, City FE, Y, Month FE, Y, Weather Controls, Y) addstat(Effective Obs, e(N_h_l)+e(N_h_r), Bandwidth, floor(e(h_l))) tex
377
+ *manipulated
378
+ qui rdrobust resid_`y'_smw3 n_month if rd==1, c(0) p(1) q(2) kernel(tri) vce(cluster code_city) masspoints(off)
379
+ outreg2 using "$path/Results/Table2_A`y'_cg00", excel dec(2) append ctitle(`y') addtext(Sample, Manipulate, City FE, Y, Month FE, Y, Weather Controls, Y) addstat(Effective Obs, e(N_h_l)+e(N_h_r), Bandwidth, floor(e(h_l))) tex
380
+ }
381
+
382
+ *==============================================================================*
383
+ *Table 2B: DID Search for Deadline Cities
384
+ *==============================================================================*
385
+ use "$path/Data/did_ddl_search.dta" ,clear
386
+ gen year=year(date)
387
+ gen month=month(date)
388
+ egen year_month=group(year month)
389
+ gen treat=(auto_date==19359)
390
+ gen after2=(year>=2013)
391
+ gen m12_before2=(year==2012 & month>=11 & month<=12)
392
+ gen m34_before2=(year==2012 & month>=9 & month<=10)
393
+ gen m56_before2=(year==2012 & month>=7 & month<=8)
394
+ gen m712_before2=(year==2012 & month>=1 & month<=6)
395
+ gen m12_after2=(year==2013 & month>=1 & month<=2)
396
+ gen m34_after2=(year==2013 & month>=3 & month<=4)
397
+ gen m56_after2=(year==2013 & month>=5 & month<=6)
398
+ gen m712_after2=(year==2013 & month>=7 & month<=12)
399
+
400
+ foreach v in 12 34 56 712{
401
+ gen treat_m`v'_before2=treat*m`v'_before2
402
+ gen treat_m`v'_after2=treat*m`v'_after2
403
+ }
404
+
405
+ qui egen cityxyear = group(code_city year)
406
+ qui egen cityxmonth = group(code_city year_month)
407
+
408
+ foreach x in wind_speed rain temp rh {
409
+ gen `x'2= `x'*`x'
410
+ gen `x'3= `x'2*`x'
411
+ }
412
+
413
+ foreach y of var pmmask filter{
414
+ *City FE and year-month FE
415
+ qui reghdfe `y' treat_m712_before2 treat_m56_before2 treat_m34_before2 treat_m12_after2 treat_m34_after2 treat_m56_after2 treat_m712_after2 i.year_month , absorb(code_city) vce(cluster code_city)
416
+ outreg2 using "$path/Results/Table2_B", excel dec(2) append keep(treat_m712_before2 treat_m56_before2 treat_m34_before2 treat_m12_after2 treat_m34_after2 treat_m56_after2 treat_m712_after2) ctitle(`y') addtext(Sample, Deadline, City FE, Y, Year-Month FE, Y) tex
417
+ *City FE and year-month FE +weather
418
+ qui reghdfe `y' treat_m712_before2 treat_m56_before2 treat_m34_before2 treat_m12_after2 treat_m34_after2 treat_m56_after2 treat_m712_after2 wind_speed rain temp rh i.year_month , absorb(code_city) vce(cluster code_city)
419
+ outreg2 using "$path/Results/Table2_B", excel dec(2) append keep(treat_m712_before2 treat_m56_before2 treat_m34_before2 treat_m12_after2 treat_m34_after2 treat_m56_after2 treat_m712_after2) ctitle(`y') addtext(Sample, Deadline, City FE, Y, Year-Month FE, Y, Weather Controls, Y) tex
420
+
421
+ * NEW Panel - City FE and year-month FE +quadratic polynomial of weather variables
422
+ qui reghdfe `y' treat_m712_before2 treat_m56_before2 treat_m34_before2 treat_m12_after2 treat_m34_after2 treat_m56_after2 treat_m712_after2 wind_speed rain temp rh wind_speed2 rain2 temp2 rh2 i.year_month , absorb(code_city) vce(cluster code_city)
423
+ outreg2 using "$path/Results/Table2_B_cg0", excel dec(2) append keep(treat_m712_before2 treat_m56_before2 treat_m34_before2 treat_m12_after2 treat_m34_after2 treat_m56_after2 treat_m712_after2) ctitle(`y') addtext(Sample, Deadline, City FE, Y, Year-Month FE, Y, Weather Controls, Y) tex
424
+
425
+ * NEW Panel2 - City FE and year-month FE +cubic polynomial of weather variables
426
+ qui reghdfe `y' treat_m712_before2 treat_m56_before2 treat_m34_before2 treat_m12_after2 treat_m34_after2 treat_m56_after2 treat_m712_after2 wind_speed* rain* temp* rh* i.year_month , absorb(code_city) vce(cluster code_city)
427
+ outreg2 using "$path/Results/Table2_B_cg0", excel dec(2) append keep(treat_m712_before2 treat_m56_before2 treat_m34_before2 treat_m12_after2 treat_m34_after2 treat_m56_after2 treat_m712_after2) ctitle(`y') addtext(Sample, Deadline, City FE, Y, Year-Month FE, Y, Weather Controls, Y) tex
428
+ }
429
+
430
+ foreach y of var pmmask filter{
431
+ * NEW city trend - City FE and year-month FE
432
+ qui reghdfe `y' treat_m712_before2 treat_m56_before2 treat_m34_before2 treat_m12_after2 treat_m34_after2 treat_m56_after2 treat_m712_after2 wind_speed rain temp rh i.code_city#c.year_month, absorb(month ) vce(cluster code_city)
433
+ outreg2 using "$path/Results/Table2_B_cg1", excel dec(2) append keep(treat_m712_before2 treat_m56_before2 treat_m34_before2 treat_m12_after2 treat_m34_after2 treat_m56_after2 treat_m712_after2) ctitle(`y') addtext(Sample, Deadline, Month FE, Y, Yearly city trend, Y, Weather Controls, Y) tex
434
+ * NEW city year FE and month FE
435
+ qui reghdfe `y' treat_m712_before2 treat_m56_before2 treat_m34_before2 treat_m12_after2 treat_m34_after2 treat_m56_after2 treat_m712_after2 wind_speed rain temp rh, absorb(cityxyear month) vce(cluster code_city)
436
+ outreg2 using "$path/Results/Table2_B_cg1", excel dec(2) append keep(treat_m712_before2 treat_m56_before2 treat_m34_before2 treat_m12_after2 treat_m34_after2 treat_m56_after2 treat_m712_after2) ctitle(`y') addtext(Sample, Deadline, Month FE, Y, City-Year FE, Y, Weather Controls, Y) tex
437
+ }
438
+
439
+
440
+
441
+ foreach y of var pmmask filter{
442
+ *** rd
443
+ * NEW: normal cities
444
+ *City FE and year-month FE
445
+ qui reghdfe `y' treat_m712_before2 treat_m56_before2 treat_m34_before2 treat_m12_after2 treat_m34_after2 treat_m56_after2 treat_m712_after2 i.year_month if rd==0, absorb(code_city) vce(cluster code_city)
446
+ outreg2 using "$path/Results/Table2_B_cg30", excel dec(2) append keep(treat_m712_before2 treat_m56_before2 treat_m34_before2 treat_m12_after2 treat_m34_after2 treat_m56_after2 treat_m712_after2) ctitle(`y') addtext(Sample, Deadline, City FE, Y, Year-Month FE, Y) tex
447
+ *City FE and year-month FE +weather
448
+ qui reghdfe `y' treat_m712_before2 treat_m56_before2 treat_m34_before2 treat_m12_after2 treat_m34_after2 treat_m56_after2 treat_m712_after2 wind_speed rain temp rh i.year_month if rd==0, absorb(code_city) vce(cluster code_city)
449
+ outreg2 using "$path/Results/Table2_B_cg30", excel dec(2) append keep(treat_m712_before2 treat_m56_before2 treat_m34_before2 treat_m12_after2 treat_m34_after2 treat_m56_after2 treat_m712_after2) ctitle(`y') addtext(Sample, Deadline, City FE, Y, Year-Month FE, Y, Weather Controls, Y) tex
450
+ }
451
+
452
+ foreach y of var pmmask filter{
453
+ * NEW: manipulating cities
454
+ *City FE and year-month FE
455
+ qui reghdfe `y' treat_m712_before2 treat_m56_before2 treat_m34_before2 treat_m12_after2 treat_m34_after2 treat_m56_after2 treat_m712_after2 i.year_month if rd==1, absorb(code_city) vce(cluster code_city)
456
+ outreg2 using "$path/Results/Table2_B_cg31", excel dec(2) append keep(treat_m712_before2 treat_m56_before2 treat_m34_before2 treat_m12_after2 treat_m34_after2 treat_m56_after2 treat_m712_after2) ctitle(`y') addtext(Sample, Deadline, City FE, Y, Year-Month FE, Y) tex
457
+ *City FE and year-month FE +weather
458
+ qui reghdfe `y' treat_m712_before2 treat_m56_before2 treat_m34_before2 treat_m12_after2 treat_m34_after2 treat_m56_after2 treat_m712_after2 wind_speed rain temp rh i.year_month if rd==1, absorb(code_city) vce(cluster code_city)
459
+ outreg2 using "$path/Results/Table2_B_cg31", excel dec(2) append keep(treat_m712_before2 treat_m56_before2 treat_m34_before2 treat_m12_after2 treat_m34_after2 treat_m56_after2 treat_m712_after2) ctitle(`y') addtext(Sample, Deadline, City FE, Y, Year-Month FE, Y, Weather Controls, Y) tex
460
+ }
461
+
462
+ foreach y of var pmmask filter{
463
+ *** rd2: using 1% significance for selecting manipulating cities - variable rd2 defined in section 8. of Prepare_Data_cg0
464
+ * NEW: normal cities
465
+ *City FE and year-month FE
466
+ qui reghdfe `y' treat_m712_before2 treat_m56_before2 treat_m34_before2 treat_m12_after2 treat_m34_after2 treat_m56_after2 treat_m712_after2 i.year_month if rd2==0, absorb(code_city) vce(cluster code_city)
467
+ outreg2 using "$path/Results/Table2_B_cg32", excel dec(2) append keep(treat_m712_before2 treat_m56_before2 treat_m34_before2 treat_m12_after2 treat_m34_after2 treat_m56_after2 treat_m712_after2) ctitle(`y') addtext(Sample, Deadline, City FE, Y, Year-Month FE, Y) tex
468
+ *City FE and year-month FE +weather
469
+ qui reghdfe `y' treat_m712_before2 treat_m56_before2 treat_m34_before2 treat_m12_after2 treat_m34_after2 treat_m56_after2 treat_m712_after2 wind_speed rain temp rh i.year_month if rd2==0, absorb(code_city) vce(cluster code_city)
470
+ outreg2 using "$path/Results/Table2_B_cg32", excel dec(2) append keep(treat_m712_before2 treat_m56_before2 treat_m34_before2 treat_m12_after2 treat_m34_after2 treat_m56_after2 treat_m712_after2) ctitle(`y') addtext(Sample, Deadline, City FE, Y, Year-Month FE, Y, Weather Controls, Y) tex
471
+ }
472
+
473
+ foreach y of var pmmask filter{
474
+ * NEW manipulating cities
475
+ *City FE and year-month FE
476
+ qui reghdfe `y' treat_m712_before2 treat_m56_before2 treat_m34_before2 treat_m12_after2 treat_m34_after2 treat_m56_after2 treat_m712_after2 i.year_month if rd2==1, absorb(code_city) vce(cluster code_city)
477
+ outreg2 using "$path/Results/Table2_B_cg321", excel dec(2) append keep(treat_m712_before2 treat_m56_before2 treat_m34_before2 treat_m12_after2 treat_m34_after2 treat_m56_after2 treat_m712_after2) ctitle(`y') addtext(Sample, Deadline, City FE, Y, Year-Month FE, Y) tex
478
+ *City FE and year-month FE +weather
479
+ qui reghdfe `y' treat_m712_before2 treat_m56_before2 treat_m34_before2 treat_m12_after2 treat_m34_after2 treat_m56_after2 treat_m712_after2 wind_speed rain temp rh i.year_month if rd2==1, absorb(code_city) vce(cluster code_city)
480
+ outreg2 using "$path/Results/Table2_B_cg321", excel dec(2) append keep(treat_m712_before2 treat_m56_before2 treat_m34_before2 treat_m12_after2 treat_m34_after2 treat_m56_after2 treat_m712_after2) ctitle(`y') addtext(Sample, Deadline, City FE, Y, Year-Month FE, Y, Weather Controls, Y) tex
481
+ }
482
+ foreach y of var pmmask filter{
483
+ *** rd3: using above 2SD for selecting manipulating cities - variable rd3 defined in section 8. of Prepare_Data_cg0
484
+ * NEW normal cities
485
+ *City FE and year-month FE
486
+ qui reghdfe `y' treat_m712_before2 treat_m56_before2 treat_m34_before2 treat_m12_after2 treat_m34_after2 treat_m56_after2 treat_m712_after2 i.year_month if rd3==0, absorb(code_city) vce(cluster code_city)
487
+ outreg2 using "$path/Results/Table2_B_cg33", excel dec(2) append keep(treat_m712_before2 treat_m56_before2 treat_m34_before2 treat_m12_after2 treat_m34_after2 treat_m56_after2 treat_m712_after2) ctitle(`y') addtext(Sample, Deadline, City FE, Y, Year-Month FE, Y) tex
488
+ *City FE and year-month FE +weather
489
+ qui reghdfe `y' treat_m712_before2 treat_m56_before2 treat_m34_before2 treat_m12_after2 treat_m34_after2 treat_m56_after2 treat_m712_after2 wind_speed rain temp rh i.year_month if rd3==0, absorb(code_city) vce(cluster code_city)
490
+ outreg2 using "$path/Results/Table2_B_cg33", excel dec(2) append keep(treat_m712_before2 treat_m56_before2 treat_m34_before2 treat_m12_after2 treat_m34_after2 treat_m56_after2 treat_m712_after2) ctitle(`y') addtext(Sample, Deadline, City FE, Y, Year-Month FE, Y, Weather Controls, Y) tex
491
+ }
492
+ foreach y of var pmmask filter{
493
+ * NEW manipulating cities
494
+ *City FE and year-month FE
495
+ qui reghdfe `y' treat_m712_before2 treat_m56_before2 treat_m34_before2 treat_m12_after2 treat_m34_after2 treat_m56_after2 treat_m712_after2 i.year_month if rd3==1, absorb(code_city) vce(cluster code_city)
496
+ outreg2 using "$path/Results/Table2_B_cg331", excel dec(2) append keep(treat_m712_before2 treat_m56_before2 treat_m34_before2 treat_m12_after2 treat_m34_after2 treat_m56_after2 treat_m712_after2) ctitle(`y') addtext(Sample, Deadline, City FE, Y, Year-Month FE, Y) tex
497
+ *City FE and year-month FE +weather
498
+ qui reghdfe `y' treat_m712_before2 treat_m56_before2 treat_m34_before2 treat_m12_after2 treat_m34_after2 treat_m56_after2 treat_m712_after2 wind_speed rain temp rh i.year_month if rd3==1, absorb(code_city) vce(cluster code_city)
499
+ outreg2 using "$path/Results/Table2_B_cg331", excel dec(2) append keep(treat_m712_before2 treat_m56_before2 treat_m34_before2 treat_m12_after2 treat_m34_after2 treat_m56_after2 treat_m712_after2) ctitle(`y') addtext(Sample, Deadline, City FE, Y, Year-Month FE, Y, Weather Controls, Y) tex
500
+ }
501
+
502
+
503
+ ***The End
9/replication_package/Code/Tables_NEW_2.do ADDED
@@ -0,0 +1,436 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ***This is the main program for Tables 1, 2, 3 generated using Stata 15 MP
2
+
3
+ clear all
4
+ set more off
5
+
6
+ *global path "/Users/`c(username)'/Dropbox/China_Pollution_Monitoring"
7
+
8
+
9
+ use "$path/Data/station_day_1116",clear
10
+ foreach var of varlist temp rain wind_speed rh {
11
+ count if `var' == `var'_n
12
+ }
13
+
14
+ *==============================================================================*
15
+ *Table 1A: RD
16
+ *==============================================================================*
17
+ ***Row 1. Daily PM10 (Original) - Panel A - Table 1*
18
+ use "$path/Data/station_day_1116",clear
19
+ gen T=date-auto_date
20
+ gen month=month(date)
21
+ qui reghdfe pm10 wind_speed rain temp rh, absorb(pm10_n month) res(resid_pm10_smw)
22
+ *raw
23
+ qui rdrobust pm10 T if temp!=. & rain!=. & rh!=. & wind_speed !=., c(0) p(1) q(2) kernel(tri) vce(cluster code_city) masspoints(off)
24
+ outreg2 using "$path/Results/Table1_A1_GG_PA", excel dec(1) replace ctitle(pm10) addtext(Sample, All) addstat(Obs.(Daily), e(N_h_l)+e(N_h_r), Bandwidth (Days), floor(e(h_l))) tex
25
+ *residual
26
+ qui rdrobust resid_pm10_smw T, c(0) p(1) q(2) kernel(tri) vce(cluster code_city) masspoints(off)
27
+ outreg2 using "$path/Results/Table1_A1_GG_PA", excel dec(1) append ctitle(pm10) addtext(Sample, All, Station FE, Y, Month FE, Y, Weather Controls, Y) addstat(Obs.(Daily), e(N_h_l)+e(N_h_r), Bandwidth (Days), floor(e(h_l))) tex
28
+ *wave 1
29
+ qui rdrobust resid_pm10_smw T if phase==1, c(0) p(1) q(2) kernel(tri) vce(cluster code_city) masspoints(off)
30
+ outreg2 using "$path/Results/Table1_A1_GG_PA", excel dec(1) append ctitle(pm10) addtext(Sample, Wave 1, Station FE, Y, Month FE, Y, Weather Controls, Y) addstat(Obs.(Daily), e(N_h_l)+e(N_h_r), Bandwidth (Days), floor(e(h_l))) tex
31
+ *wave 2
32
+ qui rdrobust resid_pm10_smw T if phase==2, c(0) p(1) q(2) kernel(tri) vce(cluster code_city) masspoints(off)
33
+ outreg2 using "$path/Results/Table1_A1_GG_PA", excel dec(1) append ctitle(pm10) addtext(Sample, Wave 2, Station FE, Y, Month FE, Y, Weather Controls, Y) addstat(Obs.(Daily), e(N_h_l)+e(N_h_r), Bandwidth (Days), floor(e(h_l))) tex
34
+ *deadline
35
+ qui rdrobust resid_pm10_smw T if auto_date==19359 | auto_date==19724, c(0) p(1) q(2) kernel(tri) vce(cluster code_city) masspoints(off)
36
+ outreg2 using "$path/Results/Table1_A1_GG_PA", excel dec(1) append ctitle(pm10) addtext(Sample, Deadline, Station FE, Y, Month FE, Y, Weather Controls, Y) addstat(Obs.(Daily), e(N_h_l)+e(N_h_r), Bandwidth (Days), floor(e(h_l))) tex
37
+
38
+ ***Row 2: Monthly AOD
39
+ use "$path/Data/station_month.dta",clear
40
+ qui reghdfe aod wind_speed rain temp rh, absorb(pm10_n month) res(resid_aod_smw)
41
+ *raw
42
+ qui rdrobust aod n_month if temp!=. & rain!=. & rh!=. & wind_speed !=. & resid_aod_smw!=., c(0) p(1) q(2) kernel(tri) vce(cluster code_city) masspoints(off)
43
+ outreg2 using "$path/Results/Table1_A2_GG_PA", excel dec(3) replace ctitle(aod) addtext(Sample, All) addstat(Obs.(Monthly), e(N_h_l)+e(N_h_r), Bandwidth (Months), floor(e(h_l))) tex
44
+ *residual
45
+ qui rdrobust resid_aod_smw n_month, c(0) p(1) q(2) kernel(tri) vce(cluster code_city) masspoints(off)
46
+ outreg2 using "$path/Results/Table1_A2_GG_PA", excel dec(3) append ctitle(aod) addtext(Sample, All, Station FE, Y, Month FE, Y, Weather Controls, Y) addstat(Obs.(Monthly), e(N_h_l)+e(N_h_r), Bandwidth (Months), floor(e(h_l))) tex
47
+ *wave 1
48
+ qui rdrobust resid_aod_smw n_month if phase==1, c(0) p(1) q(2) kernel(tri) vce(cluster code_city) masspoints(off)
49
+ outreg2 using "$path/Results/Table1_A2_GG_PA", excel dec(3) append ctitle(aod) addtext(Sample, Wave 1, Station FE, Y, Month FE, Y, Weather Controls, Y) addstat(Obs.(Monthly), e(N_h_l)+e(N_h_r), Bandwidth (Months), floor(e(h_l))) tex
50
+ *wave 2
51
+ qui rdrobust resid_aod_smw n_month if phase==2, c(0) p(1) q(2) kernel(tri) vce(cluster code_city) masspoints(off)
52
+ outreg2 using "$path/Results/Table1_A2_GG_PA", excel dec(3) append ctitle(aod) addtext(Sample, Wave 2, Station FE, Y, Month FE, Y, Weather Controls, Y) addstat(Obs.(Monthly), e(N_h_l)+e(N_h_r), Bandwidth (Months), floor(e(h_l))) tex
53
+ *deadline
54
+ qui rdrobust resid_aod_smw n_month if auto_date==19359 | auto_date==19724, c(0) p(1) q(2) kernel(tri) vce(cluster code_city) masspoints(off)
55
+ outreg2 using "$path/Results/Table1_A2_GG_PA", excel dec(3) append ctitle(aod) addtext(Sample, Deadline, Station FE, Y, Month FE, Y, Weather Controls, Y) addstat(Obs.(Monthly), e(N_h_l)+e(N_h_r), Bandwidth (Months), floor(e(h_l))) tex
56
+
57
+ ***Row 1. Daily PM10 (Nearest) - Panel B - Table 1*
58
+ use "$path/Data/station_day_1116",clear
59
+ gen T=date-auto_date
60
+ gen month=month(date)
61
+ qui reghdfe pm10 wind_speed_n rain_n temp_n rh_n, absorb(pm10_n month) res(resid_pm10_smw)
62
+ *raw
63
+ qui rdrobust pm10 T if temp_n!=. & rain_n!=. & rh_n!=. & wind_speed_n !=., c(0) p(1) q(2) kernel(tri) vce(cluster code_city) masspoints(off)
64
+ outreg2 using "$path/Results/Table1_A1_GG_PB", excel dec(1) replace ctitle(pm10) addtext(Sample, All) addstat(Obs.(Daily), e(N_h_l)+e(N_h_r), Bandwidth (Days), floor(e(h_l))) tex
65
+ *residual
66
+ qui rdrobust resid_pm10_smw T, c(0) p(1) q(2) kernel(tri) vce(cluster code_city) masspoints(off)
67
+ outreg2 using "$path/Results/Table1_A1_GG_PB", excel dec(1) append ctitle(pm10) addtext(Sample, All, Station FE, Y, Month FE, Y, Weather Controls, Y) addstat(Obs.(Daily), e(N_h_l)+e(N_h_r), Bandwidth (Days), floor(e(h_l))) tex
68
+ *wave 1
69
+ qui rdrobust resid_pm10_smw T if phase==1, c(0) p(1) q(2) kernel(tri) vce(cluster code_city) masspoints(off)
70
+ outreg2 using "$path/Results/Table1_A1_GG_PB", excel dec(1) append ctitle(pm10) addtext(Sample, Wave 1, Station FE, Y, Month FE, Y, Weather Controls, Y) addstat(Obs.(Daily), e(N_h_l)+e(N_h_r), Bandwidth (Days), floor(e(h_l))) tex
71
+ *wave 2
72
+ qui rdrobust resid_pm10_smw T if phase==2, c(0) p(1) q(2) kernel(tri) vce(cluster code_city) masspoints(off)
73
+ outreg2 using "$path/Results/Table1_A1_GG_PB", excel dec(1) append ctitle(pm10) addtext(Sample, Wave 2, Station FE, Y, Month FE, Y, Weather Controls, Y) addstat(Obs.(Daily), e(N_h_l)+e(N_h_r), Bandwidth (Days), floor(e(h_l))) tex
74
+ *deadline
75
+ qui rdrobust resid_pm10_smw T if auto_date==19359 | auto_date==19724, c(0) p(1) q(2) kernel(tri) vce(cluster code_city) masspoints(off)
76
+ outreg2 using "$path/Results/Table1_A1_GG_PB", excel dec(1) append ctitle(pm10) addtext(Sample, Deadline, Station FE, Y, Month FE, Y, Weather Controls, Y) addstat(Obs.(Daily), e(N_h_l)+e(N_h_r), Bandwidth (Days), floor(e(h_l))) tex
77
+
78
+ ***Row 2: Monthly AOD
79
+ use "$path/Data/station_month.dta",clear
80
+ qui reghdfe aod wind_speed_n rain_n temp_n rh_n, absorb(pm10_n month) res(resid_aod_smw)
81
+ *raw
82
+ qui rdrobust aod n_month if temp_n!=. & rain_n!=. & rh_n!=. & wind_speed_n !=. & resid_aod_smw!=., c(0) p(1) q(2) kernel(tri) vce(cluster code_city) masspoints(off)
83
+ outreg2 using "$path/Results/Table1_A2_GG_PB", excel dec(3) replace ctitle(aod) addtext(Sample, All) addstat(Obs.(Monthly), e(N_h_l)+e(N_h_r), Bandwidth (Months), floor(e(h_l))) tex
84
+ *residual
85
+ qui rdrobust resid_aod_smw n_month, c(0) p(1) q(2) kernel(tri) vce(cluster code_city) masspoints(off)
86
+ outreg2 using "$path/Results/Table1_A2_GG_PB", excel dec(3) append ctitle(aod) addtext(Sample, All, Station FE, Y, Month FE, Y, Weather Controls, Y) addstat(Obs.(Monthly), e(N_h_l)+e(N_h_r), Bandwidth (Months), floor(e(h_l))) tex
87
+ *wave 1
88
+ qui rdrobust resid_aod_smw n_month if phase==1, c(0) p(1) q(2) kernel(tri) vce(cluster code_city) masspoints(off)
89
+ outreg2 using "$path/Results/Table1_A2_GG_PB", excel dec(3) append ctitle(aod) addtext(Sample, Wave 1, Station FE, Y, Month FE, Y, Weather Controls, Y) addstat(Obs.(Monthly), e(N_h_l)+e(N_h_r), Bandwidth (Months), floor(e(h_l))) tex
90
+ *wave 2
91
+ qui rdrobust resid_aod_smw n_month if phase==2, c(0) p(1) q(2) kernel(tri) vce(cluster code_city) masspoints(off)
92
+ outreg2 using "$path/Results/Table1_A2_GG_PB", excel dec(3) append ctitle(aod) addtext(Sample, Wave 2, Station FE, Y, Month FE, Y, Weather Controls, Y) addstat(Obs.(Monthly), e(N_h_l)+e(N_h_r), Bandwidth (Months), floor(e(h_l))) tex
93
+ *deadline
94
+ qui rdrobust resid_aod_smw n_month if auto_date==19359 | auto_date==19724, c(0) p(1) q(2) kernel(tri) vce(cluster code_city) masspoints(off)
95
+ outreg2 using "$path/Results/Table1_A2_GG_PB", excel dec(3) append ctitle(aod) addtext(Sample, Deadline, Station FE, Y, Month FE, Y, Weather Controls, Y) addstat(Obs.(Monthly), e(N_h_l)+e(N_h_r), Bandwidth (Months), floor(e(h_l))) tex
96
+
97
+ ***Row 1. Daily PM10 (DWA) - Panel C - Table 1*
98
+ use "$path/Data/station_day_1116",clear
99
+ gen T=date-auto_date
100
+ gen month=month(date)
101
+ qui reghdfe pm10 wind_speed_DWA rain_DWA temp_DWA rh_DWA, absorb(pm10_n month) res(resid_pm10_smw)
102
+ *raw
103
+ qui rdrobust pm10 T if temp_DWA!=. & rain_DWA!=. & rh_DWA!=. & wind_speed_DWA !=., c(0) p(1) q(2) kernel(tri) vce(cluster code_city) masspoints(off)
104
+ outreg2 using "$path/Results/Table1_A1_GG_PC", excel dec(1) replace ctitle(pm10) addtext(Sample, All) addstat(Obs.(Daily), e(N_h_l)+e(N_h_r), Bandwidth (Days), floor(e(h_l))) tex
105
+ *residual
106
+ qui rdrobust resid_pm10_smw T, c(0) p(1) q(2) kernel(tri) vce(cluster code_city) masspoints(off)
107
+ outreg2 using "$path/Results/Table1_A1_GG_PC", excel dec(1) append ctitle(pm10) addtext(Sample, All, Station FE, Y, Month FE, Y, Weather Controls, Y) addstat(Obs.(Daily), e(N_h_l)+e(N_h_r), Bandwidth (Days), floor(e(h_l))) tex
108
+ *wave 1
109
+ qui rdrobust resid_pm10_smw T if phase==1, c(0) p(1) q(2) kernel(tri) vce(cluster code_city) masspoints(off)
110
+ outreg2 using "$path/Results/Table1_A1_GG_PC", excel dec(1) append ctitle(pm10) addtext(Sample, Wave 1, Station FE, Y, Month FE, Y, Weather Controls, Y) addstat(Obs.(Daily), e(N_h_l)+e(N_h_r), Bandwidth (Days), floor(e(h_l))) tex
111
+ *wave 2
112
+ qui rdrobust resid_pm10_smw T if phase==2, c(0) p(1) q(2) kernel(tri) vce(cluster code_city) masspoints(off)
113
+ outreg2 using "$path/Results/Table1_A1_GG_PC", excel dec(1) append ctitle(pm10) addtext(Sample, Wave 2, Station FE, Y, Month FE, Y, Weather Controls, Y) addstat(Obs.(Daily), e(N_h_l)+e(N_h_r), Bandwidth (Days), floor(e(h_l))) tex
114
+ *deadline
115
+ qui rdrobust resid_pm10_smw T if auto_date==19359 | auto_date==19724, c(0) p(1) q(2) kernel(tri) vce(cluster code_city) masspoints(off)
116
+ outreg2 using "$path/Results/Table1_A1_GG_PC", excel dec(1) append ctitle(pm10) addtext(Sample, Deadline, Station FE, Y, Month FE, Y, Weather Controls, Y) addstat(Obs.(Daily), e(N_h_l)+e(N_h_r), Bandwidth (Days), floor(e(h_l))) tex
117
+
118
+ ***Row 2: Monthly AOD
119
+ use "$path/Data/station_month.dta",clear
120
+ qui reghdfe aod wind_speed_DWA rain_DWA temp_DWA rh_DWA, absorb(pm10_n month) res(resid_aod_smw)
121
+ *raw
122
+ qui rdrobust aod n_month if temp_DWA!=. & rain_DWA!=. & rh_DWA!=. & wind_speed_DWA !=. & resid_aod_smw!=., c(0) p(1) q(2) kernel(tri) vce(cluster code_city) masspoints(off)
123
+ outreg2 using "$path/Results/Table1_A2_GG_PC", excel dec(3) replace ctitle(aod) addtext(Sample, All) addstat(Obs.(Monthly), e(N_h_l)+e(N_h_r), Bandwidth (Months), floor(e(h_l))) tex
124
+ *residual
125
+ qui rdrobust resid_aod_smw n_month, c(0) p(1) q(2) kernel(tri) vce(cluster code_city) masspoints(off)
126
+ outreg2 using "$path/Results/Table1_A2_GG_PC", excel dec(3) append ctitle(aod) addtext(Sample, All, Station FE, Y, Month FE, Y, Weather Controls, Y) addstat(Obs.(Monthly), e(N_h_l)+e(N_h_r), Bandwidth (Months), floor(e(h_l))) tex
127
+ *wave 1
128
+ qui rdrobust resid_aod_smw n_month if phase==1, c(0) p(1) q(2) kernel(tri) vce(cluster code_city) masspoints(off)
129
+ outreg2 using "$path/Results/Table1_A2_GG_PC", excel dec(3) append ctitle(aod) addtext(Sample, Wave 1, Station FE, Y, Month FE, Y, Weather Controls, Y) addstat(Obs.(Monthly), e(N_h_l)+e(N_h_r), Bandwidth (Months), floor(e(h_l))) tex
130
+ *wave 2
131
+ qui rdrobust resid_aod_smw n_month if phase==2, c(0) p(1) q(2) kernel(tri) vce(cluster code_city) masspoints(off)
132
+ outreg2 using "$path/Results/Table1_A2_GG_PC", excel dec(3) append ctitle(aod) addtext(Sample, Wave 2, Station FE, Y, Month FE, Y, Weather Controls, Y) addstat(Obs.(Monthly), e(N_h_l)+e(N_h_r), Bandwidth (Months), floor(e(h_l))) tex
133
+ *deadline
134
+ qui rdrobust resid_aod_smw n_month if auto_date==19359 | auto_date==19724, c(0) p(1) q(2) kernel(tri) vce(cluster code_city) masspoints(off)
135
+ outreg2 using "$path/Results/Table1_A2_GG_PC", excel dec(3) append ctitle(aod) addtext(Sample, Deadline, Station FE, Y, Month FE, Y, Weather Controls, Y) addstat(Obs.(Monthly), e(N_h_l)+e(N_h_r), Bandwidth (Months), floor(e(h_l))) tex
136
+
137
+ *==============================================================================*
138
+ *Table 1B: Event-Study Estimates
139
+ *==============================================================================*
140
+ ** Original
141
+ ***Deadline
142
+ use "$path/Data/station_day_1116.dta",clear
143
+ gen year=year(date)
144
+ gen month=month(date)
145
+ egen year_month=group(year month)
146
+ keep if year>=2012 & year<=2013
147
+ keep if auto_date==19724 | auto_date==19359
148
+ gen treat=(auto_date==19359)
149
+ gen after2=(year>=2013)
150
+ gen m12_before2=(year==2012 & month>=11 & month<=12)
151
+ gen m34_before2=(year==2012 & month>=9 & month<=10)
152
+ gen m56_before2=(year==2012 & month>=7 & month<=8)
153
+ gen m712_before2=(year==2012 & month>=1 & month<=6)
154
+ gen m12_after2=(year==2013 & month>=1 & month<=2)
155
+ gen m34_after2=(year==2013 & month>=3 & month<=4)
156
+ gen m56_after2=(year==2013 & month>=5 & month<=6)
157
+ gen m712_after2=(year==2013 & month>=7 & month<=12)
158
+
159
+ foreach v in 12 34 56 712{
160
+ gen treat_m`v'_before2=treat*m`v'_before2
161
+ gen treat_m`v'_after2=treat*m`v'_after2
162
+ }
163
+
164
+ qui reghdfe pm10 treat_m712_before2 treat_m56_before2 treat_m34_before2 treat_m12_after2 treat_m34_after2 treat_m56_after2 treat_m712_after2 wind_speed rain temp rh, absorb(pm10_n month) vce(cluster code_city)
165
+ outreg2 using "$path/Results/Table1_B_GG_PA", excel dec(1) replace keep (treat_m712_before2 treat_m56_before2 treat_m34_before2 treat_m12_after2 treat_m34_after2 treat_m56_after2 treat_m712_after2) ctitle(PM10) addtext(Sample, Deadline, Weather Controls, Y, Station FE, Y, Month FE, Y) tex
166
+ qui reghdfe pm10 treat_m712_before2 treat_m56_before2 treat_m34_before2 treat_m12_after2 treat_m34_after2 treat_m56_after2 treat_m712_after2 wind_speed rain temp rh, absorb(pm10_n year_month) vce(cluster code_city)
167
+ outreg2 using "$path/Results/Table1_B_GG_PA", excel dec(1) append keep (treat_m712_before2 treat_m56_before2 treat_m34_before2 treat_m12_after2 treat_m34_after2 treat_m56_after2 treat_m712_after2) ctitle(PM10) addtext(Sample, Deadline, Weather Controls, Y, Station FE, Y, Year-Month FE, Y) tex
168
+
169
+ ***nearest matching
170
+ use "$path/Data/did_ddl_match.dta" ,clear
171
+ gen year=year(date)
172
+ gen month=month(date)
173
+ egen year_month=group(year month)
174
+ gen treat=(auto_date==19359)
175
+ gen after2=(year>=2013)
176
+ gen m12_before2=(year==2012 & month>=11 & month<=12)
177
+ gen m34_before2=(year==2012 & month>=9 & month<=10)
178
+ gen m56_before2=(year==2012 & month>=7 & month<=8)
179
+ gen m712_before2=(year==2012 & month>=1 & month<=6)
180
+ gen m12_after2=(year==2013 & month>=1 & month<=2)
181
+ gen m34_after2=(year==2013 & month>=3 & month<=4)
182
+ gen m56_after2=(year==2013 & month>=5 & month<=6)
183
+ gen m712_after2=(year==2013 & month>=7 & month<=12)
184
+
185
+ foreach v in 12 34 56 712{
186
+ gen treat_m`v'_before2=treat*m`v'_before2
187
+ gen treat_m`v'_after2=treat*m`v'_after2
188
+ }
189
+
190
+ qui reghdfe pm10 treat_m712_before2 treat_m56_before2 treat_m34_before2 treat_m12_after2 treat_m34_after2 treat_m56_after2 treat_m712_after2 wind_speed rain temp rh, absorb(pm10_n month) vce(cluster code_city)
191
+ outreg2 using "$path/Results/Table1_B_GG_PA", excel dec(1) append keep (treat_m712_before2 treat_m56_before2 treat_m34_before2 treat_m12_after2 treat_m34_after2 treat_m56_after2 treat_m712_after2) ctitle(PM10) addtext(Sample, +Matching, Weather Controls, Y, Station FE, Y, Month FE, Y) tex
192
+ qui reghdfe pm10 treat_m712_before2 treat_m56_before2 treat_m34_before2 treat_m12_after2 treat_m34_after2 treat_m56_after2 treat_m712_after2 wind_speed rain temp rh, absorb(pm10_n year_month) vce(cluster code_city)
193
+ outreg2 using "$path/Results/Table1_B_GG_PA", excel dec(1) append keep (treat_m712_before2 treat_m56_before2 treat_m34_before2 treat_m12_after2 treat_m34_after2 treat_m56_after2 treat_m712_after2) ctitle(PM10) addtext(Sample, +Matching, Weather Controls, Y, Station FE, Y, Year-Month FE, Y) tex
194
+ *log_pm10
195
+ qui reghdfe l_pm10 treat_m712_before2 treat_m56_before2 treat_m34_before2 treat_m12_after2 treat_m34_after2 treat_m56_after2 treat_m712_after2 wind_speed rain temp rh, absorb(pm10_n year_month) vce(cluster code_city)
196
+ outreg2 using "$path/Results/Table1_B_GG_PA", excel dec(2) append keep (treat_m712_before2 treat_m56_before2 treat_m34_before2 treat_m12_after2 treat_m34_after2 treat_m56_after2 treat_m712_after2) ctitle(log_PM10) addtext(Sample, +Matching, Weather Controls, Y, Station FE, Y, Year-Month FE, Y) tex
197
+
198
+ ** Nearest (conseptual replication)
199
+ ***Deadline
200
+ use "$path/Data/station_day_1116.dta",clear
201
+ gen year=year(date)
202
+ gen month=month(date)
203
+ egen year_month=group(year month)
204
+ keep if year>=2012 & year<=2013
205
+ keep if auto_date==19724 | auto_date==19359
206
+ gen treat=(auto_date==19359)
207
+ gen after2=(year>=2013)
208
+ gen m12_before2=(year==2012 & month>=11 & month<=12)
209
+ gen m34_before2=(year==2012 & month>=9 & month<=10)
210
+ gen m56_before2=(year==2012 & month>=7 & month<=8)
211
+ gen m712_before2=(year==2012 & month>=1 & month<=6)
212
+ gen m12_after2=(year==2013 & month>=1 & month<=2)
213
+ gen m34_after2=(year==2013 & month>=3 & month<=4)
214
+ gen m56_after2=(year==2013 & month>=5 & month<=6)
215
+ gen m712_after2=(year==2013 & month>=7 & month<=12)
216
+
217
+ foreach v in 12 34 56 712{
218
+ gen treat_m`v'_before2=treat*m`v'_before2
219
+ gen treat_m`v'_after2=treat*m`v'_after2
220
+ }
221
+
222
+ qui reghdfe pm10 treat_m712_before2 treat_m56_before2 treat_m34_before2 treat_m12_after2 treat_m34_after2 treat_m56_after2 treat_m712_after2 wind_speed_n rain_n temp_n rh_n, absorb(pm10_n month) vce(cluster code_city)
223
+ outreg2 using "$path/Results/Table1_B_GG_PB", excel dec(1) replace keep (treat_m712_before2 treat_m56_before2 treat_m34_before2 treat_m12_after2 treat_m34_after2 treat_m56_after2 treat_m712_after2) ctitle(PM10) addtext(Sample, Deadline, Weather Controls, Y, Station FE, Y, Month FE, Y) tex
224
+ qui reghdfe pm10 treat_m712_before2 treat_m56_before2 treat_m34_before2 treat_m12_after2 treat_m34_after2 treat_m56_after2 treat_m712_after2 wind_speed_n rain_n temp_n rh_n, absorb(pm10_n year_month) vce(cluster code_city)
225
+ outreg2 using "$path/Results/Table1_B_GG_PB", excel dec(1) append keep (treat_m712_before2 treat_m56_before2 treat_m34_before2 treat_m12_after2 treat_m34_after2 treat_m56_after2 treat_m712_after2) ctitle(PM10) addtext(Sample, Deadline, Weather Controls, Y, Station FE, Y, Year-Month FE, Y) tex
226
+
227
+ ***nearest matching
228
+ use "$path/Data/did_ddl_match.dta" ,clear
229
+ gen year=year(date)
230
+ gen month=month(date)
231
+ egen year_month=group(year month)
232
+ gen treat=(auto_date==19359)
233
+ gen after2=(year>=2013)
234
+ gen m12_before2=(year==2012 & month>=11 & month<=12)
235
+ gen m34_before2=(year==2012 & month>=9 & month<=10)
236
+ gen m56_before2=(year==2012 & month>=7 & month<=8)
237
+ gen m712_before2=(year==2012 & month>=1 & month<=6)
238
+ gen m12_after2=(year==2013 & month>=1 & month<=2)
239
+ gen m34_after2=(year==2013 & month>=3 & month<=4)
240
+ gen m56_after2=(year==2013 & month>=5 & month<=6)
241
+ gen m712_after2=(year==2013 & month>=7 & month<=12)
242
+
243
+ foreach v in 12 34 56 712{
244
+ gen treat_m`v'_before2=treat*m`v'_before2
245
+ gen treat_m`v'_after2=treat*m`v'_after2
246
+ }
247
+
248
+ qui reghdfe pm10 treat_m712_before2 treat_m56_before2 treat_m34_before2 treat_m12_after2 treat_m34_after2 treat_m56_after2 treat_m712_after2 wind_speed_n rain_n temp_n rh_n, absorb(pm10_n month) vce(cluster code_city)
249
+ outreg2 using "$path/Results/Table1_B_GG_PB", excel dec(1) append keep (treat_m712_before2 treat_m56_before2 treat_m34_before2 treat_m12_after2 treat_m34_after2 treat_m56_after2 treat_m712_after2) ctitle(PM10) addtext(Sample, +Matching, Weather Controls, Y, Station FE, Y, Month FE, Y) tex
250
+ qui reghdfe pm10 treat_m712_before2 treat_m56_before2 treat_m34_before2 treat_m12_after2 treat_m34_after2 treat_m56_after2 treat_m712_after2 wind_speed_n rain_n temp_n rh_n, absorb(pm10_n year_month) vce(cluster code_city)
251
+ outreg2 using "$path/Results/Table1_B_GG_PB", excel dec(1) append keep (treat_m712_before2 treat_m56_before2 treat_m34_before2 treat_m12_after2 treat_m34_after2 treat_m56_after2 treat_m712_after2) ctitle(PM10) addtext(Sample, +Matching, Weather Controls, Y, Station FE, Y, Year-Month FE, Y) tex
252
+ *log_pm10
253
+ qui reghdfe l_pm10 treat_m712_before2 treat_m56_before2 treat_m34_before2 treat_m12_after2 treat_m34_after2 treat_m56_after2 treat_m712_after2 wind_speed_n rain_n temp_n rh_n, absorb(pm10_n year_month) vce(cluster code_city)
254
+ outreg2 using "$path/Results/Table1_B_GG_PB", excel dec(2) append keep (treat_m712_before2 treat_m56_before2 treat_m34_before2 treat_m12_after2 treat_m34_after2 treat_m56_after2 treat_m712_after2) ctitle(log_PM10) addtext(Sample, +Matching, Weather Controls, Y, Station FE, Y, Year-Month FE, Y) tex
255
+
256
+
257
+ ** DWA (Robustness Replication)
258
+ ***Deadline
259
+ use "$path/Data/station_day_1116.dta",clear
260
+ gen year=year(date)
261
+ gen month=month(date)
262
+ egen year_month=group(year month)
263
+ keep if year>=2012 & year<=2013
264
+ keep if auto_date==19724 | auto_date==19359
265
+ gen treat=(auto_date==19359)
266
+ gen after2=(year>=2013)
267
+ gen m12_before2=(year==2012 & month>=11 & month<=12)
268
+ gen m34_before2=(year==2012 & month>=9 & month<=10)
269
+ gen m56_before2=(year==2012 & month>=7 & month<=8)
270
+ gen m712_before2=(year==2012 & month>=1 & month<=6)
271
+ gen m12_after2=(year==2013 & month>=1 & month<=2)
272
+ gen m34_after2=(year==2013 & month>=3 & month<=4)
273
+ gen m56_after2=(year==2013 & month>=5 & month<=6)
274
+ gen m712_after2=(year==2013 & month>=7 & month<=12)
275
+
276
+ foreach v in 12 34 56 712{
277
+ gen treat_m`v'_before2=treat*m`v'_before2
278
+ gen treat_m`v'_after2=treat*m`v'_after2
279
+ }
280
+
281
+ qui reghdfe pm10 treat_m712_before2 treat_m56_before2 treat_m34_before2 treat_m12_after2 treat_m34_after2 treat_m56_after2 treat_m712_after2 wind_speed_DWA rain_DWA temp_DWA rh_DWA, absorb(pm10_n month) vce(cluster code_city)
282
+ outreg2 using "$path/Results/Table1_B_GG_PC", excel dec(1) replace keep (treat_m712_before2 treat_m56_before2 treat_m34_before2 treat_m12_after2 treat_m34_after2 treat_m56_after2 treat_m712_after2) ctitle(PM10) addtext(Sample, Deadline, Weather Controls, Y, Station FE, Y, Month FE, Y) tex
283
+ qui reghdfe pm10 treat_m712_before2 treat_m56_before2 treat_m34_before2 treat_m12_after2 treat_m34_after2 treat_m56_after2 treat_m712_after2 wind_speed_DWA rain_DWA temp_DWA rh_DWA, absorb(pm10_n year_month) vce(cluster code_city)
284
+ outreg2 using "$path/Results/Table1_B_GG_PC", excel dec(1) append keep (treat_m712_before2 treat_m56_before2 treat_m34_before2 treat_m12_after2 treat_m34_after2 treat_m56_after2 treat_m712_after2) ctitle(PM10) addtext(Sample, Deadline, Weather Controls, Y, Station FE, Y, Year-Month FE, Y) tex
285
+
286
+ ***nearest matching
287
+ use "$path/Data/did_ddl_match.dta" ,clear
288
+ gen year=year(date)
289
+ gen month=month(date)
290
+ egen year_month=group(year month)
291
+ gen treat=(auto_date==19359)
292
+ gen after2=(year>=2013)
293
+ gen m12_before2=(year==2012 & month>=11 & month<=12)
294
+ gen m34_before2=(year==2012 & month>=9 & month<=10)
295
+ gen m56_before2=(year==2012 & month>=7 & month<=8)
296
+ gen m712_before2=(year==2012 & month>=1 & month<=6)
297
+ gen m12_after2=(year==2013 & month>=1 & month<=2)
298
+ gen m34_after2=(year==2013 & month>=3 & month<=4)
299
+ gen m56_after2=(year==2013 & month>=5 & month<=6)
300
+ gen m712_after2=(year==2013 & month>=7 & month<=12)
301
+
302
+ foreach v in 12 34 56 712{
303
+ gen treat_m`v'_before2=treat*m`v'_before2
304
+ gen treat_m`v'_after2=treat*m`v'_after2
305
+ }
306
+
307
+ qui reghdfe pm10 treat_m712_before2 treat_m56_before2 treat_m34_before2 treat_m12_after2 treat_m34_after2 treat_m56_after2 treat_m712_after2 wind_speed_DWA rain_DWA temp_DWA rh_DWA, absorb(pm10_n month) vce(cluster code_city)
308
+ outreg2 using "$path/Results/Table1_B_GG_PC", excel dec(1) append keep (treat_m712_before2 treat_m56_before2 treat_m34_before2 treat_m12_after2 treat_m34_after2 treat_m56_after2 treat_m712_after2) ctitle(PM10) addtext(Sample, +Matching, Weather Controls, Y, Station FE, Y, Month FE, Y) tex
309
+ qui reghdfe pm10 treat_m712_before2 treat_m56_before2 treat_m34_before2 treat_m12_after2 treat_m34_after2 treat_m56_after2 treat_m712_after2 wind_speed_DWA rain_DWA temp_DWA rh_DWA, absorb(pm10_n year_month) vce(cluster code_city)
310
+ outreg2 using "$path/Results/Table1_B_GG_PC", excel dec(1) append keep (treat_m712_before2 treat_m56_before2 treat_m34_before2 treat_m12_after2 treat_m34_after2 treat_m56_after2 treat_m712_after2) ctitle(PM10) addtext(Sample, +Matching, Weather Controls, Y, Station FE, Y, Year-Month FE, Y) tex
311
+ *log_pm10
312
+ qui reghdfe l_pm10 treat_m712_before2 treat_m56_before2 treat_m34_before2 treat_m12_after2 treat_m34_after2 treat_m56_after2 treat_m712_after2 wind_speed_DWA rain_DWA temp_DWA rh_DWA, absorb(pm10_n year_month) vce(cluster code_city)
313
+ outreg2 using "$path/Results/Table1_B_GG_PC", excel dec(2) append keep (treat_m712_before2 treat_m56_before2 treat_m34_before2 treat_m12_after2 treat_m34_after2 treat_m56_after2 treat_m712_after2) ctitle(log_PM10) addtext(Sample, +Matching, Weather Controls, Y, Station FE, Y, Year-Month FE, Y) tex
314
+
315
+ *==============================================================================*
316
+ *Table 1B: Event-Study Estimates for AOD
317
+ *==============================================================================*
318
+ ** DWA (Robustness Replication)
319
+ ***Deadline
320
+ use "$path/Data/station_month.dta",clear
321
+ egen year_month=group(year month)
322
+ keep if year>=2012 & year<=2013
323
+ keep if auto_date==19724 | auto_date==19359
324
+ gen treat=(auto_date==19359)
325
+ gen after2=(year>=2013)
326
+ gen m12_before2=(year==2012 & month>=11 & month<=12)
327
+ gen m34_before2=(year==2012 & month>=9 & month<=10)
328
+ gen m56_before2=(year==2012 & month>=7 & month<=8)
329
+ gen m712_before2=(year==2012 & month>=1 & month<=6)
330
+ gen m12_after2=(year==2013 & month>=1 & month<=2)
331
+ gen m34_after2=(year==2013 & month>=3 & month<=4)
332
+ gen m56_after2=(year==2013 & month>=5 & month<=6)
333
+ gen m712_after2=(year==2013 & month>=7 & month<=12)
334
+
335
+ foreach v in 12 34 56 712{
336
+ gen treat_m`v'_before2=treat*m`v'_before2
337
+ gen treat_m`v'_after2=treat*m`v'_after2
338
+ }
339
+
340
+ qui reghdfe aod treat_m712_before2 treat_m56_before2 treat_m34_before2 treat_m12_after2 treat_m34_after2 treat_m56_after2 treat_m712_after2 wind_speed_DWA rain_DWA temp_DWA rh_DWA, absorb(pm10_n month) vce(cluster code_city)
341
+ outreg2 using "$path/Results/Table_DID_aod_GG", excel dec(1) replace keep (treat_m712_before2 treat_m56_before2 treat_m34_before2 treat_m12_after2 treat_m34_after2 treat_m56_after2 treat_m712_after2) ctitle(PM10) addtext(Sample, Deadline, Weather Controls, Y, Station FE, Y, Month FE, Y) tex
342
+ qui reghdfe aod treat_m712_before2 treat_m56_before2 treat_m34_before2 treat_m12_after2 treat_m34_after2 treat_m56_after2 treat_m712_after2 wind_speed_DWA rain_DWA temp_DWA rh_DWA, absorb(pm10_n year_month) vce(cluster code_city)
343
+ outreg2 using "$path/Results/Table_DID_aod_GG", excel dec(1) append keep (treat_m712_before2 treat_m56_before2 treat_m34_before2 treat_m12_after2 treat_m34_after2 treat_m56_after2 treat_m712_after2) ctitle(PM10) addtext(Sample, Deadline, Weather Controls, Y, Station FE, Y, Year-Month FE, Y) tex
344
+
345
+
346
+ *==============================================================================*
347
+ *Table 2A: City-Month Online Search
348
+ *==============================================================================*
349
+ * Original
350
+ use "$path/Data/search_city_month.dta",clear
351
+ foreach y in pmmask filter l_pmmask l_filter {
352
+ qui reghdfe `y' wind_speed rain temp rh, absorb(code_city month) res(resid_`y'_smw)
353
+ *raw
354
+ qui rdrobust `y' n_month if temp!=. & rain!=. & rh!=. & wind_speed !=., c(0) p(1) q(2) kernel(tri) vce(cluster code_city) masspoints(off)
355
+ outreg2 using "$path/Results/Table2_GG_PA", excel dec(2) append ctitle(`y') addtext(Sample, All) addstat(Effective Obs, e(N_h_l)+e(N_h_r), Bandwidth, floor(e(h_l))) tex
356
+ *residual
357
+ qui rdrobust resid_`y'_smw n_month, c(0) p(1) q(2) kernel(tri) vce(cluster code_city) masspoints(off)
358
+ outreg2 using "$path/Results/Table2_GG_PA", excel dec(2) append ctitle(`y') addtext(Sample, All, City FE, Y, Month FE, Y, Weather Controls, Y) addstat(Effective Obs, e(N_h_l)+e(N_h_r), Bandwidth, floor(e(h_l))) tex
359
+ *normal
360
+ qui rdrobust resid_`y'_smw n_month if rd==0, c(0) p(1) q(2) kernel(tri) vce(cluster code_city) masspoints(off)
361
+ outreg2 using "$path/Results/Table2_GG_PA", excel dec(2) append ctitle(`y') addtext(Sample, Normal, City FE, Y, Month FE, Y, Weather Controls, Y) addstat(Effective Obs, e(N_h_l)+e(N_h_r), Bandwidth, floor(e(h_l))) tex
362
+ *manipulated
363
+ qui rdrobust resid_`y'_smw n_month if rd==1, c(0) p(1) q(2) kernel(tri) vce(cluster code_city) masspoints(off)
364
+ outreg2 using "$path/Results/Table2_GG_PA", excel dec(2) append ctitle(`y') addtext(Sample, Manipulate, City FE, Y, Month FE, Y, Weather Controls, Y) addstat(Effective Obs, e(N_h_l)+e(N_h_r), Bandwidth, floor(e(h_l))) tex
365
+ }
366
+
367
+ * Nearest
368
+ use "$path/Data/search_city_month.dta",clear
369
+ foreach y in pmmask filter l_pmmask l_filter {
370
+ qui reghdfe `y' wind_speed_n rain_n temp_n rh_n, absorb(code_city month) res(resid_`y'_smw)
371
+ *raw
372
+ qui rdrobust `y' n_month if temp_n!=. & rain_n!=. & rh_n!=. & wind_speed_n !=., c(0) p(1) q(2) kernel(tri) vce(cluster code_city) masspoints(off)
373
+ outreg2 using "$path/Results/Table2_GG_PB_`y'", excel dec(2) append ctitle(`y') addtext(Sample, All) addstat(Effective Obs, e(N_h_l)+e(N_h_r), Bandwidth, floor(e(h_l))) tex
374
+ *residual
375
+ qui rdrobust resid_`y'_smw n_month, c(0) p(1) q(2) kernel(tri) vce(cluster code_city) masspoints(off)
376
+ outreg2 using "$path/Results/Table2_GG_PB_`y'", excel dec(2) append ctitle(`y') addtext(Sample, All, City FE, Y, Month FE, Y, Weather Controls, Y) addstat(Effective Obs, e(N_h_l)+e(N_h_r), Bandwidth, floor(e(h_l))) tex
377
+ *normal
378
+ qui rdrobust resid_`y'_smw n_month if rd==0, c(0) p(1) q(2) kernel(tri) vce(cluster code_city) masspoints(off)
379
+ outreg2 using "$path/Results/Table2_GG_PB_`y'", excel dec(2) append ctitle(`y') addtext(Sample, Normal, City FE, Y, Month FE, Y, Weather Controls, Y) addstat(Effective Obs, e(N_h_l)+e(N_h_r), Bandwidth, floor(e(h_l))) tex
380
+ *manipulated
381
+ qui rdrobust resid_`y'_smw n_month if rd==1, c(0) p(1) q(2) kernel(tri) vce(cluster code_city) masspoints(off)
382
+ outreg2 using "$path/Results/Table2_GG_PB_`y'", excel dec(2) append ctitle(`y') addtext(Sample, Manipulate, City FE, Y, Month FE, Y, Weather Controls, Y) addstat(Effective Obs, e(N_h_l)+e(N_h_r), Bandwidth, floor(e(h_l))) tex
383
+ }
384
+
385
+ * DWA
386
+ use "$path/Data/search_city_month.dta",clear
387
+ foreach y in pmmask filter l_pmmask l_filter {
388
+ qui reghdfe `y' wind_speed_DWA rain_DWA temp_DWA rh_DWA, absorb(code_city month) res(resid_`y'_smw)
389
+ *raw
390
+ qui rdrobust `y' n_month if temp_DWA!=. & rain_DWA!=. & rh_DWA!=. & wind_speed_DWA !=., c(0) p(1) q(2) kernel(tri) vce(cluster code_city) masspoints(off)
391
+ outreg2 using "$path/Results/Table2_GG_PC_`y'", excel dec(2) append ctitle(`y') addtext(Sample, All) addstat(Effective Obs, e(N_h_l)+e(N_h_r), Bandwidth, floor(e(h_l))) tex
392
+ *residual
393
+ qui rdrobust resid_`y'_smw n_month, c(0) p(1) q(2) kernel(tri) vce(cluster code_city) masspoints(off)
394
+ outreg2 using "$path/Results/Table2_GG_PC_`y'", excel dec(2) append ctitle(`y') addtext(Sample, All, City FE, Y, Month FE, Y, Weather Controls, Y) addstat(Effective Obs, e(N_h_l)+e(N_h_r), Bandwidth, floor(e(h_l))) tex
395
+ *normal
396
+ qui rdrobust resid_`y'_smw n_month if rd==0, c(0) p(1) q(2) kernel(tri) vce(cluster code_city) masspoints(off)
397
+ outreg2 using "$path/Results/Table2_GG_PC_`y'", excel dec(2) append ctitle(`y') addtext(Sample, Normal, City FE, Y, Month FE, Y, Weather Controls, Y) addstat(Effective Obs, e(N_h_l)+e(N_h_r), Bandwidth, floor(e(h_l))) tex
398
+ *manipulated
399
+ qui rdrobust resid_`y'_smw n_month if rd==1, c(0) p(1) q(2) kernel(tri) vce(cluster code_city) masspoints(off)
400
+ outreg2 using "$path/Results/Table2_GG_PC_`y'", excel dec(2) append ctitle(`y') addtext(Sample, Manipulate, City FE, Y, Month FE, Y, Weather Controls, Y) addstat(Effective Obs, e(N_h_l)+e(N_h_r), Bandwidth, floor(e(h_l))) tex
401
+ }
402
+
403
+ *==============================================================================*
404
+ *Table 2B: DID Search for Deadline Cities
405
+ *==============================================================================*
406
+ use "$path/Data/did_ddl_search.dta" ,clear
407
+ gen year=year(date)
408
+ gen month=month(date)
409
+ egen year_month=group(year month)
410
+ gen treat=(auto_date==19359)
411
+ gen after2=(year>=2013)
412
+ gen m12_before2=(year==2012 & month>=11 & month<=12)
413
+ gen m34_before2=(year==2012 & month>=9 & month<=10)
414
+ gen m56_before2=(year==2012 & month>=7 & month<=8)
415
+ gen m712_before2=(year==2012 & month>=1 & month<=6)
416
+ gen m12_after2=(year==2013 & month>=1 & month<=2)
417
+ gen m34_after2=(year==2013 & month>=3 & month<=4)
418
+ gen m56_after2=(year==2013 & month>=5 & month<=6)
419
+ gen m712_after2=(year==2013 & month>=7 & month<=12)
420
+
421
+ foreach v in 12 34 56 712{
422
+ gen treat_m`v'_before2=treat*m`v'_before2
423
+ gen treat_m`v'_after2=treat*m`v'_after2
424
+ }
425
+
426
+ foreach y of var pmmask filter{
427
+ *City FE and year-month FE
428
+ qui xi: areg `y' treat_m712_before2 treat_m56_before2 treat_m34_before2 treat_m12_after2 treat_m34_after2 treat_m56_after2 treat_m712_after2 i.year_month , absorb(code_city) vce(cluster code_city)
429
+ outreg2 using "$path/Results/Table2_B", excel dec(2) append keep(treat_m712_before2 treat_m56_before2 treat_m34_before2 treat_m12_after2 treat_m34_after2 treat_m56_after2 treat_m712_after2) ctitle(`y') addtext(Sample, Deadline, City FE, Y, Year-Month FE, Y)
430
+ *City FE and year-month FE +weather
431
+ qui xi: areg `y' treat_m712_before2 treat_m56_before2 treat_m34_before2 treat_m12_after2 treat_m34_after2 treat_m56_after2 treat_m712_after2 wind_speed rain temp rh i.year_month , absorb(code_city) vce(cluster code_city)
432
+ outreg2 using "$path/Results/Table2_B", excel dec(2) append keep(treat_m712_before2 treat_m56_before2 treat_m34_before2 treat_m12_after2 treat_m34_after2 treat_m56_after2 treat_m712_after2) ctitle(`y') addtext(Sample, Deadline, City FE, Y, Year-Month FE, Y, Weather Controls, Y)
433
+ }
434
+
435
+
436
+ ***The End
9/replication_package/Data/aod_month.dta ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:571ed7a7fde179b0745942f19709e7d71ebc908339c982883af30855433431c1
3
+ size 431750
9/replication_package/Data/city_info.dta ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:52d2390e9e1d0c676a63d591fb41c4e3d59bc84c0dc9dd6e6543072b66b1a901
3
+ size 12527
9/replication_package/Data/city_info_rd.dta ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:5dcf73891bab722719cb3590722036d736b4c3f2037c5f998dc489ad6b02628d
3
+ size 23316
9/replication_package/Data/city_month.dta ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:b2ca299265755f93c933731130617f2e207f14b1b42ccdce04596c301c2a175b
3
+ size 2142290
9/replication_package/Data/did_ddl_match.dta ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:dfedf750d8013cf0f50c6337eb24aa9d7b16da0b959bd2e3ccf589416c8327db
3
+ size 32202162
9/replication_package/Data/mask_filter_search.dta ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:1f6a3e4887bc43bafa3e27e35ed8bfc274a6ab99bd68e2571372fbfb9c9ebec4
3
+ size 7125468
9/replication_package/Data/pm10_corrected_reference.dta ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c6cb3fc5509898626993764c7fb16804117666a207655a3c8053dd67ab59cf9f
3
+ size 192883
9/replication_package/Data/pollution.csv ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:37da78fb5a04e005fe8519f76ac5d8a15b428b73fea81ea00702a0c11f4dd5ac
3
+ size 78143017
9/replication_package/Data/pollution_1116.dta ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:ed5b2c83e6716c17c35acfa65c6fba91a38a49a5b6ca60dbb64515b76acdb509
3
+ size 40154199
9/replication_package/Data/search_sale.dta ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:46ce9fd5b1cf3ffcd84c39c7cb6be0c84dcf47ad66f1fa1457dcdc10c2383e52
3
+ size 42348
9/replication_package/Data/station_day_1116.dta ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:b65db2ec9c3bb14c8c5020cfac9df5e81b8dcd0760f31ce8f3c0b1ff107bdc25
3
+ size 342669276
9/replication_package/Data/station_list.dta ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:46d9f767799a1965181ee6515d621dd4f6a592632b7d4ace93b6cd3750162f28
3
+ size 15513
9/replication_package/Data/station_month.dta ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:d133b0e07d5ef73ab936f9e44b0b79277e14b92d5a3ce6d1ef898e29fa441d81
3
+ size 11676684
9/replication_package/Data/weather_1116.dta ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:93c1fe2f0ba8a1873e075a5b8aa47e3c55797d68d7fc25b656c502dddf6b46d3
3
+ size 28686289
9/replication_package/Data/weather_1116_alt.dta ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:df86c557d324120fab531d0d63e01da87e045a7215b3645f7a518765fde7ad6e
3
+ size 303957252
9/replication_package/README.pdf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:914e989639ff04582dbaa8b4eeb146783c2489be36cfbb7ecc1698197940cdaa
3
+ size 125464
9/replication_package/Readme_new.txt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:2252d019a624daaac5732a176855c18a8ade42a17675c94b8149125633b139c6
3
+ size 1348
9/should_reproduce.txt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:bdd6a0d3fa3c58213acec4b2949638f45635114bb4a10cecec2ecb3b63853c84
3
+ size 15