-
Notifications
You must be signed in to change notification settings - Fork 0
/
Problem set 1.log
2203 lines (1652 loc) · 87.9 KB
/
Problem set 1.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
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
-----------------------------------------------------------------------------------------------------
name: <unnamed>
log:
log type: text
opened on: 29 Mar 2017, 22:21:27
.
. ***************************************************************************
. *********************Problem 1.1*******************************************
. ***************************************************************************
.
.
. use jtrain2
.
. *point a
.
. local index = 0
. foreach x of varlist age educ black hisp nodegree re74 re75{
2. quietly ttest `x', by (train)
3. if `index' != 0 {
4. matrix metrics = metrics \ r(mu_2), r(mu_1), r(sd_2), r(sd_1), r(mu_1) - r(mu_2)
> , r(se), r(p)
5. }
6. else{
7. matrix metrics = r(mu_2), r(sd_2), r(mu_1) , r(sd_1), r(mu_1) - r(mu_2), r(se),
> r(p)
8. }
9. local index = `index' + 1
10. }
. matrix rownames metrics = "age" "educ" "black" "hisp" "nodegree" "re74" "re75"
.
. matrix metrics = metrics'
. quietly frmttable using table1, statmat(metrics) ///
> noblankrows title("Table 1" \ "Dataset: jtrain2") ///
> tex replace rtitles( ///
> "Treatment Group", "mean" \ "", "sd"\ ///
> "Control Group", "mean" \ "", "sd"\ ///
> "Difference", "mean" \ "", "se"\" ","p-value")
.
. *point b
. regress re78 train, vce(robust) //We implement the heteroskedasticity robust estimator.
Linear regression Number of obs = 445
F(1, 443) = 7.15
Prob > F = 0.0078
R-squared = 0.0178
Root MSE = 6.5795
------------------------------------------------------------------------------
| Robust
re78 | Coef. Std. Err. t P>|t| [95% Conf. Interval]
-------------+----------------------------------------------------------------
train | 1.794343 .6708247 2.67 0.008 .4759489 3.112737
_cons | 4.554802 .3402038 13.39 0.000 3.886188 5.223416
------------------------------------------------------------------------------
. matrix betas=e(b)
. scalar coeff=betas[1,1]
. matrix sterrors=e(V)
. scalar se=sterrors[1,1]
. outreg2 using mymodels, replace tex ///
> title("Table 4. Model specifications") ctitle(jtrain2 - mod1)
mymodels.tex
dir : seeout
. estimates store mod1
. ttest re78, by(train)
Two-sample t test with equal variances
------------------------------------------------------------------------------
Group | Obs Mean Std. Err. Std. Dev. [95% Conf. Interval]
---------+--------------------------------------------------------------------
0 | 260 4.554802 .3400931 5.483837 3.885103 5.224502
1 | 185 6.349145 .5784231 7.867405 5.207951 7.49034
---------+--------------------------------------------------------------------
combined | 445 5.300765 .3143629 6.631493 4.682941 5.918589
---------+--------------------------------------------------------------------
diff | -1.794343 .6328536 -3.038111 -.5505748
------------------------------------------------------------------------------
diff = mean(0) - mean(1) t = -2.8353
Ho: diff = 0 degrees of freedom = 443
Ha: diff < 0 Ha: diff != 0 Ha: diff > 0
Pr(T < t) = 0.0024 Pr(|T| > |t|) = 0.0048 Pr(T > t) = 0.9976
. scalar diffmeans=r(mu_2)-r(mu_1)
. display diffmeans-coeff
3.109e-15
.
. /* The coefficient obtained from mod1 is equal to the simple difference in mean
> outcomes between treatment and control groups. */
.
. *point c
. regress re78 train age educ black hisp, vce(robust)
Linear regression Number of obs = 445
F(5, 439) = 4.55
Prob > F = 0.0005
R-squared = 0.0478
Root MSE = 6.5079
------------------------------------------------------------------------------
| Robust
re78 | Coef. Std. Err. t P>|t| [95% Conf. Interval]
-------------+----------------------------------------------------------------
train | 1.685979 .6539576 2.58 0.010 .4007026 2.971256
age | .0552986 .0372272 1.49 0.138 -.0178671 .1284643
educ | .4149953 .1612432 2.57 0.010 .0980908 .7318998
black | -2.229071 .9891567 -2.25 0.025 -4.173142 -.2849995
hisp | .088537 1.337581 0.07 0.947 -2.540322 2.717396
_cons | .8164305 2.31441 0.35 0.724 -3.73227 5.365131
------------------------------------------------------------------------------
. outreg2 using mymodels, tex ctitle(jtrain2 - mod2)
mymodels.tex
dir : seeout
. estimates store mod2
.
.
. *point d
. regress re78 train age educ black hisp re74 re75, vce(robust)
Linear regression Number of obs = 445
F(7, 437) = 3.43
Prob > F = 0.0014
R-squared = 0.0548
Root MSE = 6.4988
------------------------------------------------------------------------------
| Robust
re78 | Coef. Std. Err. t P>|t| [95% Conf. Interval]
-------------+----------------------------------------------------------------
train | 1.680049 .6565083 2.56 0.011 .3897432 2.970356
age | .0543452 .0372134 1.46 0.145 -.0187943 .1274847
educ | .4035985 .1549643 2.60 0.010 .0990305 .7081665
black | -2.180068 1.004082 -2.17 0.030 -4.153499 -.2066377
hisp | .1435597 1.352448 0.11 0.916 -2.514552 2.801671
re74 | .0833058 .1063871 0.78 0.434 -.1257881 .2923997
re75 | .0467654 .1198593 0.39 0.697 -.1888069 .2823377
_cons | .6740724 2.325163 0.29 0.772 -3.895821 5.243965
------------------------------------------------------------------------------
. outreg2 using mymodels, tex ctitle(jtrain2 - mod3)
mymodels.tex
dir : seeout
. estimates store mod3
. esttab mod1 mod2 mod3
------------------------------------------------------------
(1) (2) (3)
re78 re78 re78
------------------------------------------------------------
train 1.794** 1.686* 1.680*
(2.67) (2.58) (2.56)
age 0.0553 0.0543
(1.49) (1.46)
educ 0.415* 0.404**
(2.57) (2.60)
black -2.229* -2.180*
(-2.25) (-2.17)
hisp 0.0885 0.144
(0.07) (0.11)
re74 0.0833
(0.78)
re75 0.0468
(0.39)
_cons 4.555*** 0.816 0.674
(13.39) (0.35) (0.29)
------------------------------------------------------------
N 445 445 445
------------------------------------------------------------
t statistics in parentheses
* p<0.05, ** p<0.01, *** p<0.001
.
. ***************************************************************************
. *********************Problem 1.2*******************************************
. ***************************************************************************
.
. clear all
. use jtrain3
. *point a
. local index = 0
. foreach x of varlist age educ black hisp re74 re75{
2. quietly ttest `x', by (train)
3. if `index' == 4 { // nodegree is not in the second dataset
4. matrix metrics_2 = metrics_2 \ ., ., ., ., ., ., .
5. }
6. if `index' != 0 {
7. matrix metrics_2 = metrics_2 \ r(mu_2), r(sd_2), r(mu_1), r(sd_1), r(mu_1) - r(m
> u_2), r(se), r(p)
8. }
9. else{
10. matrix metrics_2 = r(mu_2),r(sd_2), r(mu_1), r(sd_1), r(mu_1) - r(mu_2), r(se),
> r(p)
11. }
12. local index = `index' + 1
13. }
.
. matrix rownames metrics_2 = "age" "educ" "black" "hisp" "nodegree" "re74" "re75"
.
. matrix metrics_2 = metrics_2'
.
. quietly frmttable using table1, statmat(metrics_2) ///
> noblankrows title("Table 2" \ "Dataset: jtrain3") ///
> tex addtable rtitles( ///
> "Treatment Group", "mean" \ "", "sd"\ ///
> "Control Group", "mean" \ "", "sd"\ ///
> "Difference", "mean" \ "", "se" \ "", "p-value")
.
.
. *point b
. set seed 42
. gen random = runiform()
. quietly sum random, detail
. gen treated = random > r(p50)
. drop random
.
. sum treated if treated==1
Variable | Obs Mean Std. Dev. Min Max
-------------+---------------------------------------------------------
treated | 1,337 1 0 1 1
. sum treated if treated==0
Variable | Obs Mean Std. Dev. Min Max
-------------+---------------------------------------------------------
treated | 1,338 0 0 0 0
. /*Remark: the number of units randomly assigned to treatment is (n/2)-1. */
.
. *point c
. local index = 0
. foreach x of varlist age educ black hisp re74 re75{
2. quietly ttest `x', by (treated)
3. if `index' == 4 { // nodegree is not in the second dataset
4. matrix metrics_3 = metrics_3 \ ., ., ., ., ., ., .
5. }
6. if `index' != 0 {
7. matrix metrics_3 = metrics_3 \ r(mu_2), r(sd_2), r(mu_1), r(sd_1), r(mu_1) - r(m
> u_2), r(se), r(p)
8. }
9. else{
10. matrix metrics_3 = r(mu_2),r(sd_2), r(mu_1), r(sd_1), r(mu_1) - r(mu_2), r(se),
> r(p)
11. }
12. local index = `index' + 1
13. }
.
. matrix rownames metrics_3 = "age" "educ" "black" "hisp" "nodegree" "re74" "re75"
.
. matrix metrics_3 = metrics_3'
.
. quietly frmttable using table1, statmat(metrics_3) ///
> noblankrows title("Table 3" \ "Dataset: jtrain3; randomly allocated treatment") ///
> tex addtable rtitles( ///
> "Treatment Group", "mean" \ "", "sd"\ ///
> "Control Group", "mean" \ "", "sd"\ ///
> "Difference", "mean" \ "", "se"\"", "p-value")
.
. *point d
. regress re78 treated, vce(robust)
Linear regression Number of obs = 2,675
F(1, 2673) = 3.17
Prob > F = 0.0753
R-squared = 0.0012
Root MSE = 15.626
------------------------------------------------------------------------------
| Robust
re78 | Coef. Std. Err. t P>|t| [95% Conf. Interval]
-------------+----------------------------------------------------------------
treated | 1.075028 .6042609 1.78 0.075 -.1098386 2.259894
_cons | 19.96506 .4230182 47.20 0.000 19.13559 20.79454
------------------------------------------------------------------------------
.
.
. matrix betas=e(b)
. scalar coeff=betas[1,1]
. matrix sterrors=e(V)
. scalar se=sterrors[1,1]
. ttest re78, by(treated)
Two-sample t test with equal variances
------------------------------------------------------------------------------
Group | Obs Mean Std. Err. Std. Dev. [95% Conf. Interval]
---------+--------------------------------------------------------------------
0 | 1,338 19.96506 .4230181 15.47345 19.13521 20.79491
1 | 1,337 21.04009 .4314939 15.77758 20.19361 21.88657
---------+--------------------------------------------------------------------
combined | 2,675 20.50238 .3022505 15.63252 19.90971 21.09504
---------+--------------------------------------------------------------------
diff | -1.075028 .6042566 -2.259885 .10983
------------------------------------------------------------------------------
diff = mean(0) - mean(1) t = -1.7791
Ho: diff = 0 degrees of freedom = 2673
Ha: diff < 0 Ha: diff != 0 Ha: diff > 0
Pr(T < t) = 0.0377 Pr(|T| > |t|) = 0.0753 Pr(T > t) = 0.9623
. drop treated
. scalar diffmeans=r(mu_2)-r(mu_1)
. display diffmeans-coeff
2.665e-15
.
.
. *point e
. regress re78 train, vce(robust)
Linear regression Number of obs = 2,675
F(1, 2673) = 537.36
Prob > F = 0.0000
R-squared = 0.0609
Root MSE = 15.152
------------------------------------------------------------------------------
| Robust
re78 | Coef. Std. Err. t P>|t| [95% Conf. Interval]
-------------+----------------------------------------------------------------
train | -15.20478 .6559143 -23.18 0.000 -16.49093 -13.91863
_cons | 21.55392 .311785 69.13 0.000 20.94256 22.16529
------------------------------------------------------------------------------
. outreg2 using mymodels, tex ctitle(jtrain3 - mod4)
mymodels.tex
dir : seeout
. estimates store mod1b
.
.
. *point f
. regress re78 train age educ black hisp, vce(robust)
Linear regression Number of obs = 2,675
F(5, 2669) = 162.27
Prob > F = 0.0000
R-squared = 0.2007
Root MSE = 13.989
------------------------------------------------------------------------------
| Robust
re78 | Coef. Std. Err. t P>|t| [95% Conf. Interval]
-------------+----------------------------------------------------------------
train | -8.452086 .7411853 -11.40 0.000 -9.905441 -6.99873
age | .1961468 .0294731 6.66 0.000 .1383543 .2539393
educ | 1.768315 .1092449 16.19 0.000 1.554101 1.982528
black | -3.166033 .5740444 -5.52 0.000 -4.291649 -2.040416
hisp | 1.011616 1.668438 0.61 0.544 -2.259947 4.283179
_cons | -5.947839 1.978897 -3.01 0.003 -9.828165 -2.067513
------------------------------------------------------------------------------
. outreg2 using mymodels, tex ctitle(jtrain3 - mod5)
mymodels.tex
dir : seeout
. estimates store mod2b
.
.
. *point g
. regress re78 train age educ black hisp re74 re75, vce(robust)
Linear regression Number of obs = 2,675
F(7, 2667) = 284.31
Prob > F = 0.0000
R-squared = 0.5856
Root MSE = 10.077
------------------------------------------------------------------------------
| Robust
re78 | Coef. Std. Err. t P>|t| [95% Conf. Interval]
-------------+----------------------------------------------------------------
train | .2132254 .751744 0.28 0.777 -1.260835 1.687286
age | -.0750666 .0204466 -3.67 0.000 -.1151594 -.0349738
educ | .5200606 .088241 5.89 0.000 .3470328 .6930883
black | -.6477141 .4381372 -1.48 0.139 -1.506837 .2114089
hisp | 2.202615 1.22055 1.80 0.071 -.1907044 4.595934
re74 | .2809811 .0617852 4.55 0.000 .1598292 .4021329
re75 | .5692884 .0666195 8.55 0.000 .4386573 .6999196
_cons | 1.647553 1.44806 1.14 0.255 -1.191881 4.486986
------------------------------------------------------------------------------
. outreg2 using mymodels, tex ctitle(jtrain3 - mod6)
mymodels.tex
dir : seeout
. estimates store mod3b
.
.
. *point h
. esttab mod1b mod2b mod3b
------------------------------------------------------------
(1) (2) (3)
re78 re78 re78
------------------------------------------------------------
train -15.20*** -8.452*** 0.213
(-23.18) (-11.40) (0.28)
age 0.196*** -0.0751***
(6.66) (-3.67)
educ 1.768*** 0.520***
(16.19) (5.89)
black -3.166*** -0.648
(-5.52) (-1.48)
hisp 1.012 2.203
(0.61) (1.80)
re74 0.281***
(4.55)
re75 0.569***
(8.55)
_cons 21.55*** -5.948** 1.648
(69.13) (-3.01) (1.14)
------------------------------------------------------------
N 2675 2675 2675
------------------------------------------------------------
t statistics in parentheses
* p<0.05, ** p<0.01, *** p<0.001
.
. *point i
. logit train age educ black hisp
Iteration 0: log likelihood = -672.64954
Iteration 1: log likelihood = -548.86008
Iteration 2: log likelihood = -451.22767
Iteration 3: log likelihood = -445.54543
Iteration 4: log likelihood = -445.48077
Iteration 5: log likelihood = -445.48076
Logistic regression Number of obs = 2,675
LR chi2(4) = 454.34
Prob > chi2 = 0.0000
Log likelihood = -445.48076 Pseudo R2 = 0.3377
------------------------------------------------------------------------------
train | Coef. Std. Err. z P>|z| [95% Conf. Interval]
-------------+----------------------------------------------------------------
age | -.1320748 .0126665 -10.43 0.000 -.1569008 -.1072488
educ | -.2292395 .0386296 -5.93 0.000 -.3049521 -.1535268
black | 2.74895 .2621999 10.48 0.000 2.235048 3.262852
hisp | 2.177318 .4222033 5.16 0.000 1.349815 3.004822
_cons | 2.136474 .7024242 3.04 0.002 .7597477 3.5132
------------------------------------------------------------------------------
. predict pscore
(option pr assumed; Pr(train))
.
. gen pscoreTreat = pscore if train==1
(2,490 missing values generated)
. gen pscoreControl = pscore if train==0
(185 missing values generated)
.
. sum pscoreTreat
Variable | Obs Mean Std. Dev. Min Max
-------------+---------------------------------------------------------
pscoreTreat | 185 .2953871 .192525 .0015194 .7563259
. scalar minTreat = r(min)
. scalar maxTreat = r(max)
.
. sum pscoreControl
Variable | Obs Mean Std. Dev. Min Max
-------------+---------------------------------------------------------
pscoreCont~l | 2,490 .0523508 .0984653 .0001204 .7311699
. scalar minControl = r(min)
. scalar maxControl = r(max)
.
. scalar min = max(minControl,minTreat)
. scalar max = min(maxControl,maxTreat)
.
. gen comsup=0
. replace comsup=1 if pscore>=min & pscore<=max
(2,235 real changes made)
.
. sum comsup if comsup==1
Variable | Obs Mean Std. Dev. Min Max
-------------+---------------------------------------------------------
comsup | 2,235 1 0 1 1
.
. drop pscoreTreat
. drop pscoreControl
. /*The common support is built as the intersection of p-scores for treated and
> controls. */
.
. sum train if train==1 & comsup==1
Variable | Obs Mean Std. Dev. Min Max
-------------+---------------------------------------------------------
train | 183 1 0 1 1
. local treatedunits=r(N)
. sum train if train==0 & comsup==1
Variable | Obs Mean Std. Dev. Min Max
-------------+---------------------------------------------------------
train | 2,052 0 0 0 0
. local controlunits=r(N)
. regress re78 train age educ black hisp if comsup==1, vce(robust)
Linear regression Number of obs = 2,235
F(5, 2229) = 129.20
Prob > F = 0.0000
R-squared = 0.1854
Root MSE = 12.723
------------------------------------------------------------------------------
| Robust
re78 | Coef. Std. Err. t P>|t| [95% Conf. Interval]
-------------+----------------------------------------------------------------
train | -8.535337 .7419729 -11.50 0.000 -9.990367 -7.080307
age | .198397 .0343311 5.78 0.000 .1310727 .2657214
educ | 1.517441 .1176942 12.89 0.000 1.286639 1.748243
black | -3.624317 .584988 -6.20 0.000 -4.771496 -2.477139
hisp | .5961403 1.66582 0.36 0.720 -2.670581 3.862861
_cons | -2.951549 2.176285 -1.36 0.175 -7.219306 1.316209
------------------------------------------------------------------------------
. outreg2 using mymodels, tex addstat("Number of treated units", ///
> `treatedunits',"Number of control units", `controlunits') ctitle(pscore - mod7)
mymodels.tex
dir : seeout
.
. estimates store mod4a
. esttab mod2b mod4a
--------------------------------------------
(1) (2)
re78 re78
--------------------------------------------
train -8.452*** -8.535***
(-11.40) (-11.50)
age 0.196*** 0.198***
(6.66) (5.78)
educ 1.768*** 1.517***
(16.19) (12.89)
black -3.166*** -3.624***
(-5.52) (-6.20)
hisp 1.012 0.596
(0.61) (0.36)
_cons -5.948** -2.952
(-3.01) (-1.36)
--------------------------------------------
N 2675 2235
--------------------------------------------
t statistics in parentheses
* p<0.05, ** p<0.01, *** p<0.001
. drop comsup
.
. logit train age educ black hisp re74 re75
Iteration 0: log likelihood = -672.64954
Iteration 1: log likelihood = -494.6625
Iteration 2: log likelihood = -312.39664
Iteration 3: log likelihood = -262.63502
Iteration 4: log likelihood = -255.53539
Iteration 5: log likelihood = -255.46039
Iteration 6: log likelihood = -255.46036
Iteration 7: log likelihood = -255.46036
Logistic regression Number of obs = 2,675
LR chi2(6) = 834.38
Prob > chi2 = 0.0000
Log likelihood = -255.46036 Pseudo R2 = 0.6202
------------------------------------------------------------------------------
train | Coef. Std. Err. z P>|z| [95% Conf. Interval]
-------------+----------------------------------------------------------------
age | -.1163428 .0138964 -8.37 0.000 -.1435793 -.0891063
educ | -.073817 .0488744 -1.51 0.131 -.169609 .0219749
black | 2.515007 .3067295 8.20 0.000 1.913829 3.116186
hisp | 2.209666 .5228082 4.23 0.000 1.18498 3.234351
re74 | -.1483104 .0294957 -5.03 0.000 -.2061208 -.0904999
re75 | -.2713162 .0389547 -6.96 0.000 -.3476659 -.1949664
_cons | 2.590438 .8753593 2.96 0.003 .8747658 4.306111
------------------------------------------------------------------------------
Note: 212 failures and 0 successes completely determined.
. predict pscore_2
(option pr assumed; Pr(train))
.
. gen pscoreTreat = pscore_2 if train==1
(2,490 missing values generated)
. gen pscoreControl = pscore_2 if train==0
(185 missing values generated)
.
. sum pscoreTreat
Variable | Obs Mean Std. Dev. Min Max
-------------+---------------------------------------------------------
pscoreTreat | 185 .5977198 .284103 .0001951 .9315597
. scalar minTreat = r(min)
. scalar maxTreat = r(max)
.
. sum pscoreControl
Variable | Obs Mean Std. Dev. Min Max
-------------+---------------------------------------------------------
pscoreCont~l | 2,490 .0298883 .100458 1.49e-29 .8731372
. scalar minControl = r(min)
. scalar maxControl = r(max)
.
. scalar min = max(minControl,minTreat)
. scalar max = min(maxControl,maxTreat)
.
. gen comsup=0
. replace comsup=1 if pscore_2>=min & pscore_2<=max
(1,323 real changes made)
.
. sum comsup if comsup==1
Variable | Obs Mean Std. Dev. Min Max
-------------+---------------------------------------------------------
comsup | 1,323 1 0 1 1
.
.
. drop pscoreTreat
. drop pscoreControl
.
. sum train if train==1 & comsup==1
Variable | Obs Mean Std. Dev. Min Max
-------------+---------------------------------------------------------
train | 157 1 0 1 1
. local treatedunits_2=r(N)
. sum train if train==0 & comsup==1
Variable | Obs Mean Std. Dev. Min Max
-------------+---------------------------------------------------------
train | 1,166 0 0 0 0
. local controlunits_2=r(N)
. regress re78 train age educ black hisp re74 re75 if comsup==1, vce(robust)
Linear regression Number of obs = 1,323
F(7, 1315) = 138.67
Prob > F = 0.0000
R-squared = 0.3221
Root MSE = 8.7658
------------------------------------------------------------------------------
| Robust
re78 | Coef. Std. Err. t P>|t| [95% Conf. Interval]
-------------+----------------------------------------------------------------
train | .8375984 .8818432 0.95 0.342 -.8923749 2.567572
age | -.0836209 .0283454 -2.95 0.003 -.1392281 -.0280137
educ | .480591 .1161511 4.14 0.000 .2527293 .7084528
black | -.7580615 .5393634 -1.41 0.160 -1.816168 .3000452
hisp | 2.157868 1.51387 1.43 0.154 -.8119967 5.127732
re74 | .3537965 .080758 4.38 0.000 .195368 .512225
re75 | .5361192 .0821255 6.53 0.000 .3750078 .6972306
_cons | 1.77256 2.196886 0.81 0.420 -2.537224 6.082343
------------------------------------------------------------------------------
. outreg2 using mymodels, tex addstat("Number of treated units", ///
> `treatedunits_2',"Number of control units", `controlunits_2') ctitle(pscore - mod8)
mymodels.tex
dir : seeout
. estimates store mod4b
. esttab mod2b mod4a mod4b
------------------------------------------------------------
(1) (2) (3)
re78 re78 re78
------------------------------------------------------------
train -8.452*** -8.535*** 0.838
(-11.40) (-11.50) (0.95)
age 0.196*** 0.198*** -0.0836**
(6.66) (5.78) (-2.95)
educ 1.768*** 1.517*** 0.481***
(16.19) (12.89) (4.14)
black -3.166*** -3.624*** -0.758
(-5.52) (-6.20) (-1.41)
hisp 1.012 0.596 2.158
(0.61) (0.36) (1.43)
re74 0.354***
(4.38)
re75 0.536***
(6.53)
_cons -5.948** -2.952 1.773
(-3.01) (-1.36) (0.81)
------------------------------------------------------------
N 2675 2235 1323
------------------------------------------------------------
t statistics in parentheses
* p<0.05, ** p<0.01, *** p<0.001
.
. drop comsup
.
. *point j
. graph twoway ///
> (histogram pscore if train==1, fraction lcolor(blue)fcolor(ltblue)lwidth(medthick)) ///
> (histogram pscore if train==0, fraction lcolor(red) fcolor(erose)lwidth(medthick)) ///
> , ///
> legend(order(1 "Treatment group" 2 "Control group"))
. graph export histogram_pscore.png, replace
(file histogram_pscore.png written in PNG format)
.
. graph twoway ///
> (histogram pscore_2 if train==1, fraction lcolor(blue)fcolor(ltblue)lwidth(medthick)) ///
> (histogram pscore_2 if train==0, fraction lcolor(red) fcolor(erose)lwidth(medthick)) ///
> , ///
> legend(order(1 "Treatment group" 2 "Control group"))
. graph export histogram_pscore2.png, replace
(file histogram_pscore2.png written in PNG format)
.
. drop pscore
. drop pscore_2
.
.
. *point l
. generate age2=age^2
. generate educ2=educ^2
. generate re742=re74^2
. generate re752=re75^2
. generate blacku74=black*unem74
.
. pscore train age age2 educ educ2 marr black hisp re74 re75 re742 re752 blacku74, ///
> pscore(pscore_BI) blockid(myblock) comsup numblo(5) level(0.005) logit
****************************************************
Algorithm to estimate the propensity score
****************************************************
The treatment is train
=1 if in |
job |
training | Freq. Percent Cum.
------------+-----------------------------------
0 | 2,490 93.08 93.08
1 | 185 6.92 100.00
------------+-----------------------------------
Total | 2,675 100.00
Estimation of the propensity score
Iteration 0: log likelihood = -672.64954
Iteration 1: log likelihood = -506.34387
Iteration 2: log likelihood = -385.59361
Iteration 3: log likelihood = -253.47059
Iteration 4: log likelihood = -239.0094
Iteration 5: log likelihood = -216.4621
Iteration 6: log likelihood = -209.4284
Iteration 7: log likelihood = -205.15188
Iteration 8: log likelihood = -204.97707
Iteration 9: log likelihood = -204.97538
Iteration 10: log likelihood = -204.97536
Logistic regression Number of obs = 2675
LR chi2(12) = 935.35
Prob > chi2 = 0.0000
Log likelihood = -204.97536 Pseudo R2 = 0.6953
------------------------------------------------------------------------------
train | Coef. Std. Err. z P>|z| [95% Conf. Interval]
-------------+----------------------------------------------------------------
age | .3316903 .1203299 2.76 0.006 .0958481 .5675325
age2 | -.0063668 .0018554 -3.43 0.001 -.0100033 -.0027303
educ | .8492681 .3477059 2.44 0.015 .1677771 1.530759
educ2 | -.0506202 .0172493 -2.93 0.003 -.0844282 -.0168122
married | -1.885542 .2993309 -6.30 0.000 -2.472219 -1.298864
black | 1.135972 .3517854 3.23 0.001 .4464853 1.825459
hisp | 1.96902 .5668595 3.47 0.001 .8579958 3.080044
re74 | -.1058961 .0352518 -3.00 0.003 -.1749883 -.036804
re75 | -.2168539 .0414223 -5.24 0.000 -.2980401 -.1356677
re742 | .0023892 .0006429 3.72 0.000 .0011291 .0036493
re752 | .0001359 .0006651 0.20 0.838 -.0011676 .0014394
blacku74 | 2.144131 .426815 5.02 0.000 1.307589 2.980673
_cons | -7.474742 2.443511 -3.06 0.002 -12.26394 -2.685549
------------------------------------------------------------------------------
Note: 22 failures and 0 successes completely determined.
Note: the common support option has been selected
The region of common support is [.00061066, .97525407]
Description of the estimated propensity score
in region of common support
Estimated propensity score
-------------------------------------------------------------
Percentiles Smallest
1% .0006426 .0006107
5% .0008025 .0006149
10% .0010932 .0006159 Obs 1,342
25% .0023546 .000618 Sum of Wgt. 1,342
50% .0106667 Mean .1377463
Largest Std. Dev. .2746627
75% .0757122 .974804
90% .6250822 .9749805 Variance .0754396
95% .949302 .9752243 Skewness 2.185181
99% .970598 .9752541 Kurtosis 6.360726
******************************************************
Step 1: Identification of the optimal number of blocks
Use option detail if you want more detailed output
******************************************************
The final number of blocks is 7
This number of blocks ensures that the mean propensity score
is not different for treated and controls in each block
**********************************************************
Step 2: Test of balancing property of the propensity score
Use option detail if you want more detailed output
**********************************************************
The balancing property is satisfied
This table shows the inferior bound, the number of treated
and the number of controls for each block
Inferior |
of block | =1 if in job training
of pscore | 0 1 | Total
-----------+----------------------+----------
.0006107 | 924 7 | 931
.05 | 102 4 | 106
.1 | 56 7 | 63
.2 | 41 28 | 69
.4 | 14 21 | 35
.6 | 13 20 | 33
.8 | 7 98 | 105
-----------+----------------------+----------
Total | 1,157 185 | 1,342
Note: the common support option has been selected
*******************************************
End of the algorithm to estimate the pscore
*******************************************
.
.
. sum train if train==1 & comsup==1
Variable | Obs Mean Std. Dev. Min Max
-------------+---------------------------------------------------------
train | 185 1 0 1 1
. local treatedunits_3=r(N)
. sum train if train==0 & comsup==1
Variable | Obs Mean Std. Dev. Min Max
-------------+---------------------------------------------------------
train | 1,157 0 0 0 0
. local controlunits_3=r(N)
. regress re78 train age age2 educ educ2 marr black hisp re74 re75 re742 re752 ///