forked from codedthinking/eventstudy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
example.log
302 lines (260 loc) · 14.7 KB
/
example.log
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
___ ____ ____ ____ ____ ®
/__ / ____/ / ____/ 18.0
___/ / /___/ / /___/ MP—Parallel Edition
Statistics and Data Science Copyright 1985-2023 StataCorp LLC
StataCorp
4905 Lakeway Drive
College Station, Texas 77845 USA
800-STATA-PC https://www.stata.com
979-696-4600 stata@stata.com
Stata license: Single-user 2-core perpetual
Serial number: 501806323834
Licensed to: Miklós Koren
Central European University
Notes:
1. Stata is running in batch mode.
2. Unicode is supported; see help unicode_advice.
3. More than 2 billion observations are allowed; see help obs_advice.
4. Maximum number of variables is set to 5,000 but can be increased;
see help set_maxvar.
. do example.do
. clear all
. use "df.dta"
.
. * time index has to be non-negative for xtset
. replace t = t + 100
(2,600 real changes made)
. xtset i t
Panel variable: i (strongly balanced)
Time variable: t, 85 to 110
Delta: 1 unit
.
. * illustrate event study plot with kink
. xthdidregress ra (y) (d), group(i)
note: variable _did_cohort, containing cohort indicators formed by treatment
variable d and group variable i, was added to the dataset.
Computing ATET for each cohort and time:
Cohort 101 (25): ..........10..........20..... done
Treatment and time information
Time variable: t
Time interval: 85 to 110
Control: _did_cohort = 0
Treatment: _did_cohort > 0
-------------------------------
| _did_cohort
------------------+------------
Number of cohorts | 2
------------------+------------
Number of obs |
Never treated | 1300
101 | 1300
-------------------------------
Heterogeneous-treatment-effects regression Number of obs = 2,600
Number of panels = 100
Estimator: Regression adjustment
Panel variable: i
Treatment level: i
Control group: Never treated
(Std. err. adjusted for 100 clusters in i)
------------------------------------------------------------------------------
| Robust
Cohort | ATET std. err. z P>|z| [95% conf. interval]
-------------+----------------------------------------------------------------
t |
86 | .6438261 .2782756 2.31 0.021 .0984159 1.189236
87 | .5881773 .2564366 2.29 0.022 .0855708 1.090784
88 | .2322243 .2531081 0.92 0.359 -.2638585 .7283072
89 | .6410027 .2732471 2.35 0.019 .1054483 1.176557
90 | .5457171 .2926433 1.86 0.062 -.0278533 1.119288
91 | .3474518 .2739187 1.27 0.205 -.189419 .8843226
92 | .650674 .3148242 2.07 0.039 .03363 1.267718
93 | .5101111 .2984348 1.71 0.087 -.0748103 1.095033
94 | .4599449 .2912541 1.58 0.114 -.1109026 1.030792
95 | .2097397 .2575765 0.81 0.415 -.2951009 .7145803
96 | .4799807 .2724344 1.76 0.078 -.0539809 1.013942
97 | 1.005308 .2642817 3.80 0.000 .4873255 1.523291
98 | .0540982 .2977005 0.18 0.856 -.5293841 .6375804
99 | .8252911 .2793316 2.95 0.003 .2778113 1.372771
100 | .4307123 .2619239 1.64 0.100 -.082649 .9440736
101 | .4105212 .2379038 1.73 0.084 -.0557617 .8768041
102 | .9888228 .2764365 3.58 0.000 .4470172 1.530629
103 | 1.859271 .2727555 6.82 0.000 1.32468 2.393862
104 | 1.865648 .2840544 6.57 0.000 1.308911 2.422384
105 | 2.591579 .2831633 9.15 0.000 2.036589 3.146569
106 | 2.923434 .2730864 10.71 0.000 2.388195 3.458674
107 | 3.588873 .2599594 13.81 0.000 3.079362 4.098384
108 | 3.733354 .2695227 13.85 0.000 3.2051 4.261609
109 | 4.487729 .2540163 17.67 0.000 3.989866 4.985592
110 | 4.716976 .2821311 16.72 0.000 4.164009 5.269943
------------------------------------------------------------------------------
. estat aggregation, dynamic(-4/5) graph
Duration of exposure ATET Number of obs = 2,600
(Std. err. adjusted for 100 clusters in i)
------------------------------------------------------------------------------
| Robust
Exposure | ATET std. err. z P>|z| [95% conf. interval]
-------------+----------------------------------------------------------------
-4 | 1.005308 .2642817 3.80 0.000 .4873255 1.523291
-3 | .0540982 .2977005 0.18 0.856 -.5293841 .6375804
-2 | .8252911 .2793316 2.95 0.003 .2778113 1.372771
-1 | .4307123 .2619239 1.64 0.100 -.082649 .9440736
0 | .4105212 .2379038 1.73 0.084 -.0557617 .8768041
1 | .9888228 .2764365 3.58 0.000 .4470172 1.530629
2 | 1.859271 .2727555 6.82 0.000 1.32468 2.393862
3 | 1.865648 .2840544 6.57 0.000 1.308911 2.422384
4 | 2.591579 .2831633 9.15 0.000 2.036589 3.146569
5 | 2.923434 .2730864 10.71 0.000 2.388195 3.458674
------------------------------------------------------------------------------
Note: Exposure is the number of periods since the first treatment time.
. graph export "eventstudy_kink.png", replace
file eventstudy_kink.png written in PNG format
.
. * event study plot with correct baseline
. xthdidregress ra (y) (d), group(i)
note: variable _did_cohort, containing cohort indicators formed by treatment
variable d and group variable i, was added to the dataset.
Computing ATET for each cohort and time:
Cohort 101 (25): ..........10..........20..... done
Treatment and time information
Time variable: t
Time interval: 85 to 110
Control: _did_cohort = 0
Treatment: _did_cohort > 0
-------------------------------
| _did_cohort
------------------+------------
Number of cohorts | 2
------------------+------------
Number of obs |
Never treated | 1300
101 | 1300
-------------------------------
Heterogeneous-treatment-effects regression Number of obs = 2,600
Number of panels = 100
Estimator: Regression adjustment
Panel variable: i
Treatment level: i
Control group: Never treated
(Std. err. adjusted for 100 clusters in i)
------------------------------------------------------------------------------
| Robust
Cohort | ATET std. err. z P>|z| [95% conf. interval]
-------------+----------------------------------------------------------------
t |
86 | .6438261 .2782756 2.31 0.021 .0984159 1.189236
87 | .5881773 .2564366 2.29 0.022 .0855708 1.090784
88 | .2322243 .2531081 0.92 0.359 -.2638585 .7283072
89 | .6410027 .2732471 2.35 0.019 .1054483 1.176557
90 | .5457171 .2926433 1.86 0.062 -.0278533 1.119288
91 | .3474518 .2739187 1.27 0.205 -.189419 .8843226
92 | .650674 .3148242 2.07 0.039 .03363 1.267718
93 | .5101111 .2984348 1.71 0.087 -.0748103 1.095033
94 | .4599449 .2912541 1.58 0.114 -.1109026 1.030792
95 | .2097397 .2575765 0.81 0.415 -.2951009 .7145803
96 | .4799807 .2724344 1.76 0.078 -.0539809 1.013942
97 | 1.005308 .2642817 3.80 0.000 .4873255 1.523291
98 | .0540982 .2977005 0.18 0.856 -.5293841 .6375804
99 | .8252911 .2793316 2.95 0.003 .2778113 1.372771
100 | .4307123 .2619239 1.64 0.100 -.082649 .9440736
101 | .4105212 .2379038 1.73 0.084 -.0557617 .8768041
102 | .9888228 .2764365 3.58 0.000 .4470172 1.530629
103 | 1.859271 .2727555 6.82 0.000 1.32468 2.393862
104 | 1.865648 .2840544 6.57 0.000 1.308911 2.422384
105 | 2.591579 .2831633 9.15 0.000 2.036589 3.146569
106 | 2.923434 .2730864 10.71 0.000 2.388195 3.458674
107 | 3.588873 .2599594 13.81 0.000 3.079362 4.098384
108 | 3.733354 .2695227 13.85 0.000 3.2051 4.261609
109 | 4.487729 .2540163 17.67 0.000 3.989866 4.985592
110 | 4.716976 .2821311 16.72 0.000 4.164009 5.269943
------------------------------------------------------------------------------
. eventbaseline, pre(5) post(5) baseline(-1) generate(eventstudy_correct)
Time variable: time, -5 to 5
Delta: 1 unit
Event study relative to -1 Number of obs = 1,850
------------------------------------------------------------------------------
y | ATET Std. err. z P>|z| [95% conf. interval]
-------------+----------------------------------------------------------------
-5 | -2.31541 .2415591 -9.59 0.000 -2.788857 -1.841963
-4 | -1.310102 .2551332 -5.13 0.000 -1.810153 -.8100498
-3 | -1.256003 .284372 -4.42 0.000 -1.813362 -.6986446
-2 | -.4307123 .2619239 -1.64 0.100 -.9440736 .082649
-1 | 0 (omitted)
0 | .4105212 .2379038 1.73 0.084 -.0557617 .8768041
1 | .9888228 .2764365 3.58 0.000 .4470172 1.530629
2 | 1.859271 .2727555 6.82 0.000 1.32468 2.393862
3 | 1.865648 .2840544 6.57 0.000 1.308911 2.422384
4 | 2.591579 .2831633 9.15 0.000 2.036589 3.146569
5 | 2.923434 .2730864 10.71 0.000 2.388195 3.458674
------------------------------------------------------------------------------
. frame eventstudy_correct: tsline upper coef lower
. graph export "eventstudy_correct.png", replace
(file eventstudy_correct.png not found)
file eventstudy_correct.png written in PNG format
.
. * ATET as difference of average of after and before
. xthdidregress ra (y) (d), group(i)
note: variable _did_cohort, containing cohort indicators formed by treatment
variable d and group variable i, was added to the dataset.
Computing ATET for each cohort and time:
Cohort 101 (25): ..........10..........20..... done
Treatment and time information
Time variable: t
Time interval: 85 to 110
Control: _did_cohort = 0
Treatment: _did_cohort > 0
-------------------------------
| _did_cohort
------------------+------------
Number of cohorts | 2
------------------+------------
Number of obs |
Never treated | 1300
101 | 1300
-------------------------------
Heterogeneous-treatment-effects regression Number of obs = 2,600
Number of panels = 100
Estimator: Regression adjustment
Panel variable: i
Treatment level: i
Control group: Never treated
(Std. err. adjusted for 100 clusters in i)
------------------------------------------------------------------------------
| Robust
Cohort | ATET std. err. z P>|z| [95% conf. interval]
-------------+----------------------------------------------------------------
t |
86 | .6438261 .2782756 2.31 0.021 .0984159 1.189236
87 | .5881773 .2564366 2.29 0.022 .0855708 1.090784
88 | .2322243 .2531081 0.92 0.359 -.2638585 .7283072
89 | .6410027 .2732471 2.35 0.019 .1054483 1.176557
90 | .5457171 .2926433 1.86 0.062 -.0278533 1.119288
91 | .3474518 .2739187 1.27 0.205 -.189419 .8843226
92 | .650674 .3148242 2.07 0.039 .03363 1.267718
93 | .5101111 .2984348 1.71 0.087 -.0748103 1.095033
94 | .4599449 .2912541 1.58 0.114 -.1109026 1.030792
95 | .2097397 .2575765 0.81 0.415 -.2951009 .7145803
96 | .4799807 .2724344 1.76 0.078 -.0539809 1.013942
97 | 1.005308 .2642817 3.80 0.000 .4873255 1.523291
98 | .0540982 .2977005 0.18 0.856 -.5293841 .6375804
99 | .8252911 .2793316 2.95 0.003 .2778113 1.372771
100 | .4307123 .2619239 1.64 0.100 -.082649 .9440736
101 | .4105212 .2379038 1.73 0.084 -.0557617 .8768041
102 | .9888228 .2764365 3.58 0.000 .4470172 1.530629
103 | 1.859271 .2727555 6.82 0.000 1.32468 2.393862
104 | 1.865648 .2840544 6.57 0.000 1.308911 2.422384
105 | 2.591579 .2831633 9.15 0.000 2.036589 3.146569
106 | 2.923434 .2730864 10.71 0.000 2.388195 3.458674
107 | 3.588873 .2599594 13.81 0.000 3.079362 4.098384
108 | 3.733354 .2695227 13.85 0.000 3.2051 4.261609
109 | 4.487729 .2540163 17.67 0.000 3.989866 4.985592
110 | 4.716976 .2821311 16.72 0.000 4.164009 5.269943
------------------------------------------------------------------------------
. eventbaseline, pre(5) post(5) baseline(atet)
Event study relative to atet Number of obs = 1,850
------------------------------------------------------------------------------
y | ATET Std. err. z P>|z| [95% conf. interval]
-------------+----------------------------------------------------------------
ATET | 2.835658 .1134013 25.01 0.000 2.613396 3.05792
------------------------------------------------------------------------------
.
end of do-file