-
Notifications
You must be signed in to change notification settings - Fork 0
/
log.log
354 lines (276 loc) · 13.1 KB
/
log.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
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
-------------------------------------------------------------------------------------------
name: <unnamed>
log: /Users/nilsschool/Documents/771/771-PS1/log.log
log type: text
opened on: 18 Sep 2016, 17:00:25
.
. use inpresdata_mod
.
. // Drop single datapoint with grossly insufficient data.
. drop if _n == 149120
(1 observation deleted)
.
. // There should be 152,989 individuals in the sample.
. assert _N == 152989
.
. // First, define the “young” as those born between 1968 and 1972, who were
. // exposed to the INPRES school construction program the entire time they were
. // in primary school (they were 2 to 6 years old in 1974). Define the “old” as
. // those born between 1957 and 1962, who should have had little or no exposure
. // to the program (they were 12 to 17 in 1974). For the moment, ignore the “very
. // old” who were born before 1957.
. assert !mi(birthyear)
. generate young = (68 <= birthyear) & (birthyear <= 72)
. generate old = (57 <= birthyear) & (birthyear <= 62)
. generate veryold = (birthyear < 57)
.
. // Next, define “high” program areas as those in which the residual of a
. // regression of the number of schools on the number of children is positive,
. // and all other regions as “low” program areas.
. assert !mi(recp)
.
. // 3.1. Generate a new variable - yeduc_diff - which is the difference in the
. // average years of education obtained between those born in high and low
. // program areas.
. //
. // Plot this difference on the y axis with cohorts (i.e., birth year) on the
. // x axis. Add seperate fitted regression lines for the old and young cohorts.
. // Comment on the plot. How does this pattern fit with the author’s argument?
. preserve
. collapse yeduc [aweight=weight], by(birthyear young old recp)
. reshape wide yeduc, i(birthyear young old) j(recp)
(note: j = 0 1)
Data long -> wide
-----------------------------------------------------------------------------
Number of obs. 46 -> 23
Number of variables 5 -> 5
j variable (2 values) recp -> (dropped)
xij variables:
yeduc -> yeduc0 yeduc1
-----------------------------------------------------------------------------
. gen yeduc_diff = yeduc1 - yeduc0
. graph twoway ///
> (line yeduc_diff birthyear) ///
> (lfit yeduc_diff birthyear if young) ///
> (lfit yeduc_diff birthyear if old)
. restore
.
. // 3.2. Calculate the average difference in years of education obtained between
. // the high and low program areas for the old and the young. Subtract your
. // measure for the old from your measure for the young. Provide standard errors
. // for these differences. Repeat the procedure for the log of hourly wages. What
. // do we call this estimator?
. preserve
. keep if (young | old) & !mi(lhwage)
(121,928 observations deleted)
. mean yeduc [aweight=weight], over(recp old)
Mean estimation Number of obs = 31,061
Over: recp old
_subpop_1: 0 0
_subpop_2: 0 1
_subpop_3: 1 0
_subpop_4: 1 1
--------------------------------------------------------------
Over | Mean Std. Err. [95% Conf. Interval]
-------------+------------------------------------------------
yeduc |
_subpop_1 | 9.760872 .0366733 9.688991 9.832753
_subpop_2 | 9.403377 .0424498 9.320174 9.48658
_subpop_3 | 8.490131 .0434352 8.404996 8.575266
_subpop_4 | 8.017859 .0532057 7.913574 8.122145
--------------------------------------------------------------
. lincom (_subpop_3 - _subpop_1) - (_subpop_4 - _subpop_2)
( 1) - [yeduc]_subpop_1 + [yeduc]_subpop_2 + [yeduc]_subpop_3 - [yeduc]_subpop_4 = 0
------------------------------------------------------------------------------
Mean | Coef. Std. Err. t P>|t| [95% Conf. Interval]
-------------+----------------------------------------------------------------
(1) | .1147767 .0886813 1.29 0.196 -.0590423 .2885957
------------------------------------------------------------------------------
. mean lhwage [aweight=weight], over(recp old)
Mean estimation Number of obs = 31,061
Over: recp old
_subpop_1: 0 0
_subpop_2: 0 1
_subpop_3: 1 0
_subpop_4: 1 1
--------------------------------------------------------------
Over | Mean Std. Err. [95% Conf. Interval]
-------------+------------------------------------------------
lhwage |
_subpop_1 | 6.729947 .0064512 6.717303 6.742592
_subpop_2 | 7.013077 .007055 6.999249 7.026905
_subpop_3 | 6.605257 .0077662 6.590035 6.620479
_subpop_4 | 6.872757 .0084468 6.856201 6.889313
--------------------------------------------------------------
. lincom (_subpop_3 - _subpop_1) - (_subpop_4 - _subpop_2)
( 1) - [lhwage]_subpop_1 + [lhwage]_subpop_2 + [lhwage]_subpop_3 - [lhwage]_subpop_4 = 0
------------------------------------------------------------------------------
Mean | Coef. Std. Err. t P>|t| [95% Conf. Interval]
-------------+----------------------------------------------------------------
(1) | .0156295 .0149349 1.05 0.295 -.0136435 .0449025
------------------------------------------------------------------------------
. restore
.
. // 3.3. [Discussion question omitted.]
.
. // 3.4. Now define one more group - the “very old” - born before 1957 (in
. // practice, because we only have data beginning in 1950, this encompasses
. // individuals born between 1950 and 1956, who were thus 18 to 24 years old in
. // 1974). Repeat the above analysis from 3.2 and 3.3, comparing the old and very
. // old. Why is this exercise useful? What should you see if the identifying
. // assumptions hold? Comment on your plot.
. preserve
. collapse yeduc [aweight=weight], by(birthyear old veryold recp)
. reshape wide yeduc, i(birthyear old veryold) j(recp)
(note: j = 0 1)
Data long -> wide
-----------------------------------------------------------------------------
Number of obs. 46 -> 23
Number of variables 5 -> 5
j variable (2 values) recp -> (dropped)
xij variables:
yeduc -> yeduc0 yeduc1
-----------------------------------------------------------------------------
. gen yeduc_diff = yeduc1 - yeduc0
. graph twoway ///
> (line yeduc_diff birthyear) ///
> (lfit yeduc_diff birthyear if old) ///
> (lfit yeduc_diff birthyear if veryold)
. restore
.
. preserve
. keep if (old | veryold) & !mi(lhwage)
(122,531 observations deleted)
. mean yeduc [aweight=weight], over(recp veryold)
Mean estimation Number of obs = 30,458
Over: recp veryold
_subpop_1: 0 0
_subpop_2: 0 1
_subpop_3: 1 0
_subpop_4: 1 1
--------------------------------------------------------------
Over | Mean Std. Err. [95% Conf. Interval]
-------------+------------------------------------------------
yeduc |
_subpop_1 | 9.403377 .0424498 9.320174 9.48658
_subpop_2 | 9.114273 .0446212 9.026814 9.201732
_subpop_3 | 8.017859 .0532057 7.913574 8.122145
_subpop_4 | 7.724024 .057689 7.610952 7.837097
--------------------------------------------------------------
. lincom (_subpop_3 - _subpop_1) - (_subpop_4 - _subpop_2)
( 1) - [yeduc]_subpop_1 + [yeduc]_subpop_2 + [yeduc]_subpop_3 - [yeduc]_subpop_4 = 0
------------------------------------------------------------------------------
Mean | Coef. Std. Err. t P>|t| [95% Conf. Interval]
-------------+----------------------------------------------------------------
(1) | .0047309 .0997592 0.05 0.962 -.1908014 .2002631
------------------------------------------------------------------------------
. mean lhwage [aweight=weight], over(recp veryold)
Mean estimation Number of obs = 30,458
Over: recp veryold
_subpop_1: 0 0
_subpop_2: 0 1
_subpop_3: 1 0
_subpop_4: 1 1
--------------------------------------------------------------
Over | Mean Std. Err. [95% Conf. Interval]
-------------+------------------------------------------------
lhwage |
_subpop_1 | 7.013077 .007055 6.999249 7.026905
_subpop_2 | 7.074952 .0076986 7.059862 7.090041
_subpop_3 | 6.872757 .0084468 6.856201 6.889313
_subpop_4 | 6.930232 .0096546 6.911309 6.949156
--------------------------------------------------------------
. lincom (_subpop_3 - _subpop_1) - (_subpop_4 - _subpop_2)
( 1) - [lhwage]_subpop_1 + [lhwage]_subpop_2 + [lhwage]_subpop_3 - [lhwage]_subpop_4 = 0
------------------------------------------------------------------------------
Mean | Coef. Std. Err. t P>|t| [95% Conf. Interval]
-------------+----------------------------------------------------------------
(1) | .0043994 .0165408 0.27 0.790 -.0280214 .0368201
------------------------------------------------------------------------------
. restore
.
. // 5.2. Aggregate the data by cohort (young and old) and region of birth. Run a
. // regression of (a) education on school construction program intensity and (b)
. // wages on school construction program intensity. Calculate the ratio of (b) to
. // (a). What is this called? Discuss how the results compare to Table 7.
.
. // Alternative approach to replicating Table 7, Panel A1
. preserve
. keep if !mi(lhwage)
(92,326 observations deleted)
.
. local controls1 "i.birthpl i.birthyear i.birthyear#(c.ch71)"
. local controls2 "i.birthpl i.birthyear i.birthyear#(c.ch71 c.en71)"
. local controls3 "i.birthpl i.birthyear i.birthyear#(c.ch71 c.en71 c.wsppc)"
.
. eststo, prefix(ols): qui reg lhwage yeduc `controls1' [aweight=weight]
(ols1 stored)
. eststo, prefix(ols): qui reg lhwage yeduc `controls2' [aweight=weight]
(ols2 stored)
. eststo, prefix(ols): qui reg lhwage yeduc `controls3' [aweight=weight]
(ols3 stored)
.
. eststo, prefix(iv_year): qui ivregress 2sls lhwage ///
> (yeduc=i.birthyear#i.recp) `controls1' [aweight=weight]
(iv_year4 stored)
. eststo, prefix(iv_year): qui ivregress 2sls lhwage ///
> (yeduc=i.birthyear#i.recp) `controls2' [aweight=weight]
(iv_year5 stored)
. eststo, prefix(iv_year): qui ivregress 2sls lhwage ///
> (yeduc=i.birthyear#i.recp) `controls3' [aweight=weight]
(iv_year6 stored)
.
. eststo, prefix(iv_cohort): qui ivregress 2sls lhwage ///
> (yeduc=i.young#i.recp) `controls1' [aweight=weight]
(iv_cohort7 stored)
. eststo, prefix(iv_cohort): qui ivregress 2sls lhwage ///
> (yeduc=i.young#i.recp) `controls2' [aweight=weight]
(iv_cohort8 stored)
. eststo, prefix(iv_cohort): qui ivregress 2sls lhwage ///
> (yeduc=i.young#i.recp) `controls3' [aweight=weight]
(iv_cohort9 stored)
.
. esttab ols*, keep(yeduc)
------------------------------------------------------------
(1) (2) (3)
lhwage lhwage lhwage
------------------------------------------------------------
yeduc 0.0768*** 0.0767*** 0.0761***
(125.00) (124.81) (119.04)
------------------------------------------------------------
N 60663 60466 55144
------------------------------------------------------------
t statistics in parentheses
* p<0.05, ** p<0.01, *** p<0.001
. esttab iv_year*, keep(yeduc)
------------------------------------------------------------
(1) (2) (3)
lhwage lhwage lhwage
------------------------------------------------------------
yeduc 0.112*** 0.0854** 0.0800**
(4.02) (2.94) (3.00)
------------------------------------------------------------
N 60663 60466 55144
------------------------------------------------------------
t statistics in parentheses
* p<0.05, ** p<0.01, *** p<0.001
. esttab iv_cohort*, keep(yeduc)
------------------------------------------------------------
(1) (2) (3)
lhwage lhwage lhwage
------------------------------------------------------------
yeduc 0.334 0.390 0.412
(1.89) (0.74) (0.83)
------------------------------------------------------------
N 60663 60466 55144
------------------------------------------------------------
t statistics in parentheses
* p<0.05, ** p<0.01, *** p<0.001
. restore
.
. log close
name: <unnamed>
log: /Users/nilsschool/Documents/771/771-PS1/log.log
log type: text
closed on: 18 Sep 2016, 17:02:27
-------------------------------------------------------------------------------------------