-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdata_exploration.do
188 lines (175 loc) · 8.02 KB
/
data_exploration.do
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
clear
set more off
cd "H:\ECON395"
capture log close
log using data_exploration.log, replace
import delimited "LEHD_data_NHGIS_controls_BlkGrp.csv"
//outlier !!!
drop if (total_jobs > 1)
//correlation/export
pwcorr total_jobs healthline pctwhite pctmale pctunder18 pct_hasdegree med_home_val total_pop, sig star(.1)
corrtex total_jobs healthline pctwhite pctmale pctunder18 pct_hasdegree med_home_val total_pop, file(corr.txt) replace
pwcorr total_jobs healthline pctwhite pctblack pctasian pcthispanic, sig star (0.01)
corrtex total_jobs healthline pctwhite pctblack pctasian pcthispanic, file(racecorr.txt) replace
//big correlation for visualization
corr total_jobs healthline pctwhite pctblack pctasian pcthispanic pctmale pctfemale pct_noged pct_hsdeg_orged pct_somecollege pct_associates pct_bachelors pct_masters pct_professional pct_doctorate pctunder18 pctover65 med_home_val total_pop
//the tttttests
ttest total_jobs, by(healthline)
//for parallel trends
gen hl_jobs = total_jobs if (healthline == 1)
gen no_hl_jobs = total_jobs if (healthline == 0)
bysort year: egen hl_jobs_yearly = mean(hl_jobs)
bysort year: egen no_hl_jobs_yearly = mean(no_hl_jobs)
//regression table (regrable)
gen healthline_x_pctblack = healthline * pctblack
gen healthline_x_pctnoged = healthline * pct_noged
//total jobs
quietly regress total_jobs healthline, r //ols
eststo m1, title("Ordinary Least Squares")
quietly regress total_jobs healthline pctblack pct_noged med_home_val total_pop, r //multivariate
eststo m2, title("Multivariate")
quietly regress total_jobs healthline pctblack pct_noged med_home_val total_pop healthline_x_pctblack, r //interaction 1
eststo m3, title("HealthLine x Pct Black Interaction")
quietly regress total_jobs healthline pctblack pct_noged med_home_val total_pop healthline_x_pctnoged, r //interaction 2
eststo m4, title("HealthLine x Pct No GED Interaction")
// Export the regression results to LaTeX using estout
esttab m1 m2 m3 m4, ///
cells(b(star fmt(8)) se(par fmt(6))) ///
replace ///
title("Regressions with \% Pop Employed") ///
label ///
nomtitles ///
coeflabels(healthline "HealthLine" ///
pctblack "\% Black" ///
pct_noged "\% No GED" ///
med_home_val "Med Home Val" ///
total_pop "Total Pop" ///
healthline_x_pctblack "HealthLine x \% Black" ///
healthline_x_pctnoged "HealthLine x \% No GED") ///
stats(N r2) ///
collabels(none) ///
noobs ///
nonumber ///
starlevels(* 0.10 ** 0.05 *** 0.01) ///
booktabs ///
///
//healthcare
quietly regress health_care_social_assistance healthline, r //ols
eststo m1, title("Ordinary Least Squares")
quietly regress health_care_social_assistance healthline pctblack pct_noged med_home_val total_pop, r //multivariate
eststo m2, title("Multivariate")
quietly regress health_care_social_assistance healthline pctblack pct_noged med_home_val total_pop healthline_x_pctblack, r //interaction 1
eststo m3, title("HealthLine x Pct Black Interaction")
quietly regress health_care_social_assistance healthline pctblack pct_noged med_home_val total_pop healthline_x_pctnoged, r //interaction 2
eststo m4, title("HealthLine x Pct No GED Interaction")
// Export the regression results to LaTeX using estout
esttab m1 m2 m3 m4, ///
cells(b(star fmt(8)) se(par fmt(6))) ///
replace ///
title("Regressions with Health Care Social Assistance Job Share") ///
label ///
nomtitles ///
coeflabels(healthline "HealthLine" ///
pctblack "\% Black" ///
pct_noged "\% No GED" ///
med_home_val "Med Home Val" ///
total_pop "Total Pop" ///
healthline_x_pctblack "HealthLine x \% Black" ///
healthline_x_pctnoged "HealthLine x \% No GED") ///
stats(N r2) ///
collabels(none) ///
noobs ///
nonumber ///
starlevels(* 0.10 ** 0.05 *** 0.01) ///
booktabs ///
///
//education
quietly regress educational_services healthline, r //ols
eststo m1, title("Ordinary Least Squares")
quietly regress educational_services healthline pctblack pct_noged med_home_val total_pop, r //multivariate
eststo m2, title("Multivariate")
quietly regress educational_services healthline pctblack pct_noged med_home_val total_pop healthline_x_pctblack, r //interaction 1
eststo m3, title("HealthLine x Pct Black Interaction")
quietly regress educational_services healthline pctblack pct_noged med_home_val total_pop healthline_x_pctnoged, r //interaction 2
eststo m4, title("HealthLine x Pct No GED Interaction")
// Export the regression results to LaTeX using estout
esttab m1 m2 m3 m4, ///
cells(b(star fmt(8)) se(par fmt(6))) ///
replace ///
title("Regressions with Educational Services Job Share") ///
label ///
nomtitles ///
coeflabels(healthline "HealthLine" ///
pctblack "\% Black" ///
pct_noged "\% No GED" ///
med_home_val "Med Home Val" ///
total_pop "Total Pop" ///
healthline_x_pctblack "HealthLine x \% Black" ///
healthline_x_pctnoged "HealthLine x \% No GED") ///
stats(N r2) ///
collabels(none) ///
noobs ///
nonumber ///
starlevels(* 0.10 ** 0.05 *** 0.01) ///
booktabs ///
///
//prof
quietly regress professional_scientific_technica healthline, r //ols
eststo m1, title("Ordinary Least Squares")
quietly regress professional_scientific_technica healthline pctblack pct_noged med_home_val total_pop, r //multivariate
eststo m2, title("Multivariate")
quietly regress professional_scientific_technica healthline pctblack pct_noged med_home_val total_pop healthline_x_pctblack, r //interaction 1
eststo m3, title("HealthLine x Pct Black Interaction")
quietly regress professional_scientific_technica healthline pctblack pct_noged med_home_val total_pop healthline_x_pctnoged, r //interaction 2
eststo m4, title("HealthLine x Pct No GED Interaction")
// Export the regression results to LaTeX using estout
esttab m1 m2 m3 m4, ///
cells(b(star fmt(8)) se(par fmt(6))) ///
replace ///
title("Regressions with Prof/Sci/Tech Job Share") ///
label ///
nomtitles ///
coeflabels(healthline "HealthLine" ///
pctblack "\% Black" ///
pct_noged "\% No GED" ///
med_home_val "Med Home Val" ///
total_pop "Total Pop" ///
healthline_x_pctblack "HealthLine x \% Black" ///
healthline_x_pctnoged "HealthLine x \% No GED") ///
stats(N r2) ///
collabels(none) ///
noobs ///
nonumber ///
starlevels(* 0.10 ** 0.05 *** 0.01) ///
booktabs ///
///
//food
quietly regress accommodation_food_services healthline, r //ols
eststo m1, title("Ordinary Least Squares")
quietly regress accommodation_food_services healthline pctblack pct_noged med_home_val total_pop, r //multivariate
eststo m2, title("Multivariate")
quietly regress accommodation_food_services healthline pctblack pct_noged med_home_val total_pop healthline_x_pctblack, r //interaction 1
eststo m3, title("HealthLine x Pct Black Interaction")
quietly regress accommodation_food_services healthline pctblack pct_noged med_home_val total_pop healthline_x_pctnoged, r //interaction 2
eststo m4, title("HealthLine x Pct No GED Interaction")
// Export the regression results to LaTeX using estout
esttab m1 m2 m3 m4, ///
cells(b(star fmt(8)) se(par fmt(6))) ///
replace ///
title("Regressions with Accommodation/Food Services Job Share") ///
label ///
nomtitles ///
coeflabels(healthline "HealthLine" ///
pctblack "\% Black" ///
pct_noged "\% No GED" ///
med_home_val "Med Home Val" ///
total_pop "Total Pop" ///
healthline_x_pctblack "HealthLine x \% Black" ///
healthline_x_pctnoged "HealthLine x \% No GED") ///
stats(N r2) ///
collabels("Simple Regression" "Multivariate Regression" "\% Black Interaction" "\% No GED Interaction") ///
noobs ///
nonumber ///
starlevels(* 0.10 ** 0.05 *** 0.01) ///
booktabs ///
///