set more off
graph drop _all
cd "${output_path}\tmp\"

use "Timing_childcare_fathers.dta", clear

replace time=time+0.1 if depvar=="vtime_childcare_sat"
replace time=time+0.2 if depvar=="vtime_childcare_sun"

twoway (rspike upper lower time if depvar=="vtime_childcare", lpattern(solid) lcolor(black) lwidth(medium) yline(0))  (scatter beta time if depvar=="vtime_childcare", msize(small)) ///
(rspike upper lower time if depvar=="vtime_childcare_sat", lpattern(dash_dot) lcolor(black) lwidth(medium) yline(0))  (scatter beta time if depvar=="vtime_childcare_sat", msize(small)) ///
(rspike upper lower time if depvar=="vtime_childcare_sun", lpattern(dash) lcolor(black) lwidth(medium) yline(0))  (scatter beta time if depvar=="vtime_childcare_sun", msize(small)) ///
, ytitle("Effect size") title("a. Father's retirement and father's childcare provision") ///
xtitle("Time to retirement") legend(label(1 "95% CI weekday")  label(2 "Point estimate weekday") label(3 "95% CI saturday")  label(4 "Point estimate saturday") label(5 "95% CI sunday")  label(6 "Point estimate sunday")) scheme(s1mono) xscale(range(-7 7))  xlabel(-7(1)7) xline(-0.1) name(fig4a) 



use "Timing_childcare_mothers.dta", clear
replace time=time+0.1 if depvar=="mtime_childcare_sat"
replace time=time+0.2 if depvar=="mtime_childcare_sun"


twoway (rspike upper lower time if depvar=="mtime_childcare", lpattern(solid) lcolor(black) lwidth(medium) yline(0))  (scatter beta time if depvar=="mtime_childcare", msize(small)) ///
(rspike upper lower time if depvar=="mtime_childcare_sat", lpattern(dash_dot) lcolor(black) lwidth(medium) yline(0))  (scatter beta time if depvar=="mtime_childcare_sat", msize(small)) ///
(rspike upper lower time if depvar=="mtime_childcare_sun", lpattern(dash) lcolor(black) lwidth(medium) yline(0))  (scatter beta time if depvar=="mtime_childcare_sun", msize(small)) ///
, ytitle("Effect size") title("d. Mother's retirement and mother's childcare provision") ///
xtitle("Time to retirement") legend(label(1 "95% CI weekday")  label(2 "Point estimate weekday") label(3 "95% CI saturday")  label(4 "Point estimate saturday") label(5 "95% CI sunday")  label(6 "Point estimate sunday")) scheme(s1mono) xscale(range(-7 7))  xlabel(-7(1)7) xline(-0.1) name(fig4d)



use "Timing_childcare_ce_fathers.dta", clear

replace time=time+0.1 if depvar=="mtime_childcare_sat"
replace time=time+0.2 if depvar=="mtime_childcare_sun"

twoway (rspike upper lower time if depvar=="mtime_childcare", lpattern(solid) lcolor(black) lwidth(medium) yline(0))  (scatter beta time if depvar=="mtime_childcare", msize(small)) ///
(rspike upper lower time if depvar=="mtime_childcare_sat", lpattern(dash_dot) lcolor(black) lwidth(medium) yline(0))  (scatter beta time if depvar=="mtime_childcare_sat", msize(small)) ///
(rspike upper lower time if depvar=="mtime_childcare_sun", lpattern(dash) lcolor(black) lwidth(medium) yline(0))  (scatter beta time if depvar=="mtime_childcare_sun", msize(small)) ///
, ytitle("Effect size") title("b. Father's retirement and mother's childcare provision") ///
xtitle("Time to retirement") legend(label(1 "95% CI weekday")  label(2 "Point estimate weekday") label(3 "95% CI saturday")  label(4 "Point estimate saturday") label(5 "95% CI sunday")  label(6 "Point estimate sunday")) scheme(s1mono) xscale(range(-7 7))  xlabel(-7(1)7) xline(-0.1) name(fig4b) 



use "Timing_childcare_ce_mothers.dta", clear
replace time=time+0.1 if depvar=="vtime_childcare_sat"
replace time=time+0.2 if depvar=="vtime_childcare_sun"


twoway (rspike upper lower time if depvar=="vtime_childcare", lpattern(solid) lcolor(black) lwidth(medium) yline(0))  (scatter beta time if depvar=="vtime_childcare", msize(small)) ///
(rspike upper lower time if depvar=="vtime_childcare_sat", lpattern(dash_dot) lcolor(black) lwidth(medium) yline(0))  (scatter beta time if depvar=="vtime_childcare_sat", msize(small)) ///
(rspike upper lower time if depvar=="vtime_childcare_sun", lpattern(dash) lcolor(black) lwidth(medium) yline(0))  (scatter beta time if depvar=="vtime_childcare_sun", msize(small)) ///
, ytitle("Effect size") title("c. Mother's retirement and father's childcare provision") ///
xtitle("Time to retirement") legend(label(1 "95% CI weekday")  label(2 "Point estimate weekday") label(3 "95% CI saturday")  label(4 "Point estimate saturday") label(5 "95% CI sunday")  label(6 "Point estimate sunday")) scheme(s1mono) xscale(range(-7 7))  xlabel(-7(1)7) xline(-0.1) name(fig4c)



grc1leg fig4a fig4b fig4c fig4d, altshrink scheme(s1mono)

graph export "${output_path}\Results\Fig4.tif", replace width(2400)
graph export "${output_path}\Results\Fig4.eps", replace 

