-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsummarize.do
More file actions
98 lines (95 loc) · 4.19 KB
/
Copy pathsummarize.do
File metadata and controls
98 lines (95 loc) · 4.19 KB
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
clear mata
clear matrix
clear
set mem 100m
set maxvar 10000
set more off
use twoSibsPared.dta
/*duplicates drop family, force*/
/*use pcgPared*/
/*label variable odiffBTOT97 "Both Parents: $ y_2-o_1$ "*/
/*label variable meanBTOT97 "Both Parents: $ (y_2+o_1)/2$ "*/
quietly sum RT if dadhead, detail
/*gen highRT = RT >= .369*/
gen highRT = RT >= .5
gen badRT = RT > .17 & RT < .18
gen kindahighRT = RT >.1
replace badRT = 1 if RT > 2.42 & RT < 2.43
replace badRT = 1 if RT > 3.61 & RT < 3.62
label values highRT highRT
label define highRT 1 "High $\theta$" 0 "Low $\theta$"
label variable BTOT97 "All"
label variable Bbasic97 "Basic"
label variable Brec97 "Rec."
label variable Btravel97 "Travel"
label variable Beduc97 "Educ."
**********************************************************************
* Summary Statistics for children
eststo clear
global X "BTOT97 Bbasic97 Brec97 Beduc97 Btravel97 selfBTOT97 selfBbasic97 selfBrec97 selfBeduc97 selfBtravel97 ageyoungest inschool RT male wifeinlf income fcdip fhsdip cdip hsdip nonwhite chagem"
global weight "[aweight=CH97PRWT]"
/*global weight ""*/
local restriction "RT != . & dadhead & selfBTOT97 != . & BTOT07 != ."
quietly estpost tabstat $X if `restriction' $weight, by(highRT) statistics(mean sd semean min max) columns(statistics)
esttab . using summary.tex , main(mean) aux(semean) nostar nonote unstack label nomtitle varwidth(37) replace fragment nonumber
esttab . using summary.txt , main(mean) aux(semean) nostar nonote unstack label nomtitle varwidth(37) replace fragment nonumber
/*cells("mean(fmt(a3)) semean(fmt(a3))") */
quietly count if `restriction' & highRT == 0
local condfalse=r(N)
quietly count if `restriction' & highRT == 1
local condtrue=r(N)
quietly count if `restriction'
local total = r(N)
!sed -i 's/mean/Mean/' summary.tex
!sed -i 's/semean/S.E./' summary.tex
!sed -i '1,3s/sd/St. Dev./' summary.tex
!sed -i '1,3s/min/Min/' summary.tex
!sed -i '1,3s/max/Max/' summary.tex
!sed -i 's/\\_/_/g' summary.tex
*!sed -i 's/\\\\/\\\\\\\\/' summary.tex
!sed -i "/^Observations/d" summary.tex
!echo "Observations & `condfalse' & `condtrue' & `total' \\\\" >> summary.tex
cat summary.tex
**********************************************************************
/*quietly estpost tabstat $X if `restriction' $weight, by(highRT) statistics(mean sd semean min max) columns(statistics)*/
label values highRT highRT
label drop highRT
label define highRT 1 "Risk Tolerant" 0 "Risk Averse"
local categorylist "TOT educ rec travel basic"
#delimit;
foreach category of local categorylist{;
local mylabel : variable label B`category'97;
graph bar B`category'97 B`category'02 B`category'07 if `restriction' $weight,
over(highRT)
legend( label(1 "1997 (Avg. Age 6)") label(2 "2002 (Avg. Age 11)")
label(3 "2007 (Avg. Age 16)"))
ytitle("Hours per Week")
title("`mylabel' Parental Time with Child")
note("Source: PSID Child Development Supplement")
subtitle("By Father's Risk Tolerance level");
/*graph bar B`category'97 B`category'02, over(highRT) yscale(range(20 40))*/
graph export `category'.eps, replace;
};
#delimit cr
**********************************************************************
* Tiem type over childhood graph
local person "B"
local year "97"
local components "`person'basic`year' `person'rec`year' `person'travel`year' `person'educ`year'"
local restriction "chage < 13 & dadhead"
if "`person'" == "M"{
local pstring "Mother's"
}
if "`person'" == "F"{
local pstring "Father's"
}
if "`person'" == "B"{
local pstring "Both Parents'"
}
graph bar (mean) `components' if `restriction', legend(label(1 "Basic Care") label(2 "Recreation") label(3 "Travel") label(4 "Education") order(1 2 3 4) ) title("`pstring' Time by Child's Age in 1997") over(chage) stack ytitle("Hours per Week")
graph export temp.eps, replace
!epstopdf temp.eps
/*serrbar dlw sedlw year, addplot((tsline unemployment, c(l) yaxis(2))) title("Log Wage Changes over Time") legend(label(1 "Standard Error") label(2 "Avg. Log Wage Change") label(3 "Unemployment Rate") order(2 3 1 - "" )) ytitle("Log Wage Change") xtitle("Year") ytitle("Unemployment Rate", axis(2))*/
/*graph export dlw.png, replace*/
/*!cp dlw.png results*/
**********************************************************************