cap log close log using "${LOGS}04_cta", replace text set more off global treatment "treatment2" /* Nota Bene: time==636 January 2013, starting point for seasonally adjusted series */ /* time==660: January 2015, starting point of treatment, any trends should be based on regressions before 660 */ global TRENDWINDOW "if time>=636 & time<660" global PREDICTWINDOW "if time>=636" global FIRSTPERIOD "if time==636" global TRENDWINDOW2 "if time>=624 & time<660" global PREDICTWINDOW2 "if time>=624" global FIRSTPERIOD2 "if time==624" /*empl regul gering alo sgbII sgbIII all pot2 pot dep self mini midi maxi */ global regulSCALE "yscale(range(-0.01 0.02)) ymtick(-0.01(0.005)0.02) yla(-0.01(0.005)0.02)" global geringSCALE "yscale(range(-0.06 0.02)) ymtick(-0.06(0.02)0.02) ytick(-0.05(0.02)0.01) yla(-0.06(0.02)0.02)" global allSCALE "yscale(range(-0.05 0.05)) ymtick(-0.05(0.02)0.05) ymtick(-0.04(0.02)0.04) yla(-0.05(0.02)0.05)" global pot2SCALE "yscale(range(-0.01 0.06)) ymtick(-0.01(0.01)0.06) yla(-0.01(0.01)0.06)" foreach dataset in krs /*amr*/ { /* Zwei unterschiedliche Regiodefinitionen */ use "${DATA}03_`dataset'_panel.dta", clear keep if weiblich==9 foreach type in regul gering all pot2 sgbII sgbIII { /*over types: Gen Trends */ /*PLAIN*/ sum time gen aux=log_`type' if time==`r(min)' bys `dataset': egen firstperiod=max(aux) sort id time gen change_`type'_plain=log_`type' - firstperiod drop aux firstperiod /*Seasonal effects - dummies*/ reg log_`type' i.time i.krs predict log_`type'_resid, resid quietly: sum time gen aux=log_`type'_resid if time==`r(min)' bys `dataset': egen firstperiod=max(aux) gen change_`type'_seas_d=log_`type'_resid /firstperiod drop aux firstperiod log_`type'_resid /*Seasonal effects - dummies + linear trend*/ reg log_`type' i.time i.krs predict log_`type'_resid, resid reg log_`type'_resid c.trend#c.bite1400 ${TRENDWINDOW2} predict log_`type'_resid2 ${PREDICTWINDOW2}, resid quietly: sum time gen aux=log_`type'_resid2 if time==`r(min)' bys `dataset': egen firstperiod=max(aux) gen change_`type'_seas_d_trend=log_`type'_resid2/firstperiod drop aux firstperiod log_`type'_resid log_`type'_resid2 /*Seasonal Effects - stochastic*/ sort id time gen aux=s12.log_`type' gen aux2=aux ${FIRSTPERIOD} bys `dataset': egen firstperiod=max(aux2) sort id time gen change_`type'_seas=aux - firstperiod drop aux aux2 firstperiod /*Seasonal Effects - stochastic + linear trend*/ /* Strength of trend depens liniearily on bite*/ sort id time gen aux=s12.log_`type' quietly: reg aux c.trend#c.bite1400 ${TRENDWINDOW} quietly: predict log_`type'_resid ${PREDICTWINDOW}, resid gen aux2=log_`type'_resid ${FIRSTPERIOD} bys `dataset': egen firstperiod=max(aux2) sort id time gen change_`type'_seas_trend=log_`type'_resid - firstperiod drop aux aux2 firstperiod log_`type'_resid /*Seasonal Effects - stochastic + log trend*/ /* Strength of trend depens liniearily on bite*/ sort id time gen aux=s12.log_`type' quietly: reg aux c.logtrend#c.bite1400 ${TRENDWINDOW} quietly: predict log_`type'_resid ${PREDICTWINDOW}, resid gen aux2=log_`type'_resid ${FIRSTPERIOD} bys `dataset': egen firstperiod=max(aux2) sort id time gen change_`type'_seas_trend_log=log_`type'_resid - firstperiod drop aux aux2 firstperiod log_`type'_resid /*Seasonal Effects - stochastic + quadratic trend*/ /* Strength of trend depens liniearily on bite*/ sort id time gen aux=s12.log_`type' quietly: reg aux c.trend#c.bite1400 c.trend#c.trend#c.bite1400 ${TRENDWINDOW} quietly: predict log_`type'_resid ${PREDICTWINDOW}, resid gen aux2=log_`type'_resid ${FIRSTPERIOD} bys `dataset': egen firstperiod=max(aux2) sort id time gen change_`type'_seas_trend_sq=log_`type'_resid - firstperiod drop aux aux2 firstperiod log_`type'_resid } save "${DATA}04_cta.dta", replace /***********************************************************/ /* NOT BY TREATMENT */ /***********************************************************/ use "${DATA}04_cta.dta", clear local collapselist foreach type in regul gering all pot2 sgbII sgbIII { /*2. over types: Gen collapselist*/ # d; local collapselist `collapselist' change_`type'_plain /*change_`type'_seas change_`type'_seas_trend change_`type'_seas_trend_log change_`type'_seas_trend_sq */ ; #d cr } collapse (mean) `collapselist' [aw=svb_122013], by(time) /* Obtain Start and Endtime */ sum time if change_all_plain!=. local mintime `r(min)' local maxtime `r(max)' # d; /*All Outcomes*/ twoway (line change_regul_plain time if time>=`mintime', lpattern(solid) lcolor(lavender) lwidth(thick)) (line change_gering_plain time if time>=`mintime', lpattern(dash) lcolor(navy)lwidth(thick)) (line change_all_plain time if time>=`mintime', lpattern(solid) lcolor(cranberry) lwidth(thick)) (line change_pot2_plain time if time>=`mintime', lpattern(dash) lcolor(sand) lwidth(thick)) ,legend(label(1 "Regular Employment") label(2 "Marginal Employment") label(3 "Aufstocker") label(4 "Non-working UBII") ) xmtick(`mintime'(1)`maxtime') xtick(`mintime'(12)`maxtime') xline(659.5, lcolor(dknavy)) xline(653.5, lcolor(cyan)) ytitle("Change in log from Jan 2012") xtitle(""); graph export "${GRAPHS}Plain_change_all_outcomes.eps", as(eps) replace ; /*Employment*/ twoway (line change_regul_plain time if time>=`mintime', lpattern(solid) lcolor(lavender) lwidth(thick)) (line change_gering_plain time if time>=`mintime', lpattern(dash) lcolor(navy)lwidth(thick)) ,legend(label(1 "Regular Employment") label(2 "Marginal Employment")) xmtick(`mintime'(1)`maxtime') xtick(`mintime'(12)`maxtime') xline(659.5, lcolor(dknavy)) xline(653.5, lcolor(cyan)) ytitle("Change in log from Jan 2012") xtitle(""); graph save "${GRAPHS}empl"; graph export "${GRAPHS}Plain_change_employment.eps", as(eps) replace ; /*Welfare Dependency*/ twoway (line change_all_plain time if time>=`mintime', lpattern(solid) lcolor(cranberry) lwidth(thick)) (line change_pot2_plain time if time>=`mintime', lpattern(dash) lcolor(sand) lwidth(thick)) /*(lfit change_all_plain time if time>=`mintime', lpattern(solid) lcolor(cranberry) lwidth(thin)) (lfit change_pot2_plain time if time>=`mintime', lpattern(solid) lcolor(sand) lwidth(thin))*/ ,legend(label(1 "Aufstocker") label(2 "Non-working UBII") /*label(3 "Linear Fit") label(4 "Linear Fit")*/ ) xmtick(`mintime'(1)`maxtime') xtick(`mintime'(12)`maxtime') xline(659.5, lcolor(dknavy)) xline(653.5, lcolor(cyan)) ytitle("Change in log from Jan 2012") xtitle(""); graph save "${GRAPHS}welfare"; graph export "${GRAPHS}Plain_change_welfare.eps", as(eps) replace; /*Unemployment*/ twoway (line change_sgbIII_plain time if time>=`mintime', lpattern(solid) lcolor(bluishgray) lwidth(thick)) (line change_sgbII_plain time if time>=`mintime', lpattern(dash) lcolor(magenta) lwidth(thick)) /*(lfit change_all_plain time if time>=`mintime', lpattern(solid) lcolor(cranberry) lwidth(thin)) (lfit change_pot2_plain time if time>=`mintime', lpattern(solid) lcolor(sand) lwidth(thin))*/ ,legend(label(1 "Recipients UBI ") label(2 "Recipients UBII") /*label(3 "Linear Fit") label(4 "Linear Fit")*/ ) xmtick(`mintime'(1)`maxtime') xtick(`mintime'(12)`maxtime') xline(659.5, lcolor(dknavy)) xline(653.5, lcolor(cyan)) ytitle("Change in log from Jan 2012") xtitle(""); graph export "${GRAPHS}Plain_change_unemp.eps", as(eps) replace ; #del cr cd ${GRAPHS} graph combine empl.gph welfare.gph, rows(2) graph export "${GRAPHS}Plain_change_twoinone.eps", as(eps) replace erase empl.gph erase welfare.gph /***********************************************************/ /* BY TREATMENT */ /***********************************************************/ use "${DATA}04_cta.dta", clear local collapselist foreach type in regul gering all pot2 sgbII sgbIII { /*2. over types: Gen collapselist*/ # d; local collapselist `collapselist' change_`type'_plain change_`type'_seas change_`type'_seas_trend change_`type'_seas_trend_log change_`type'_seas_trend_sq change_`type'_seas_d change_`type'_seas_d_trend ; #d cr } collapse (mean) `collapselist' [aw=svb_122013], by(time ${treatment}) label var change_pot2_plain "Change in log Non-working UBII from Jan 2012" label var change_all_plain "Change in log Aufstocker from Jan 2012" label var change_regul_plain "Change in log Regular Empl. from Jan 2012" label var change_gering_plain "Change in log Marginal Empl. from Jan 2012" label var change_pot2_seas "Change in log Non-working UBII from Jan 2013" label var change_all_seas "Change in log Aufstocker from Jan 2013" label var change_regul_seas "Change in log Regular Empl. from Jan 2013" label var change_gering_seas "Change in log Marginal Empl. from Jan 2013" label var change_pot2_seas_trend "Change in log Non-working UBII from Jan 2013" label var change_all_seas_trend "Change in log Aufstocker from Jan 2013" label var change_regul_seas_trend "Change in log Regular Empl. from Jan 2013" label var change_gering_seas_trend "Change in log Marginal Empl from Jan 2013" label var change_pot2_seas_trend_log "Change in log Non-working UBII from Jan 2013" label var change_all_seas_trend_log "Change in log Aufstocker from Jan 2013" label var change_regul_seas_trend_log "Change in log Regular Empl. from Jan 2013" label var change_gering_seas_trend_log "Change in log Marginal Empl from Jan 2013" label var change_pot2_seas_trend_sq "Change in log Non-working UBII from Jan 2013" label var change_all_seas_trend_sq "Change in log Aufstocker from Jan 2013" label var change_regul_seas_trend_sq "Change in log Regular Empl. from Jan 2013" label var change_gering_seas_trend_sq "Change in log Marginal Empl from Jan 2013" label var change_pot2_seas_d "Change in log Non-working UBII from Jan 2012" label var change_all_seas_d "Change in log Aufstocker from Jan 2012" label var change_regul_seas_d "Change in log Regular Empl. from Jan 2012" label var change_gering_seas_d "Change in log Marginal Empl. from Jan 2012" label var change_pot2_seas_d_trend "Change in log Non-working UBII from Jan 2012" label var change_all_seas_d_trend "Change in log Aufstocker from Jan 2012" label var change_regul_seas_d_trend "Change in log Regular Empl. from Jan 2012" label var change_gering_seas_d_trend "Change in log Marginal Empl from Jan 2012" foreach type in regul gering all pot2 sgbII sgbIII { /*3. over types: Gen graphscollapselist*/ /*PLAIN*/ /* Obtain Start and Endtime */ sum time if change_`type'_plain!=. local mintime `r(min)' local maxtime `r(max)' local labeltime2=`r(min)'+12 local labeltime3=`r(min)'+24 # d; twoway (line change_`type'_plain time if ${treatment}==1 & time>=`mintime', lpattern(solid) lwidth(thick) lcolor(purple)) (line change_`type'_plain time if ${treatment}==0 & time>=`mintime', lpattern(dash) lwidth(thick) lcolor(orange)), legend(label(1 "Above Median Bite") label(2 "Below Median Bite")) xmtick(`mintime'(1)`maxtime') xtick(`mintime'(12)`maxtime') xline(659.5, lcolor(dknavy)) xline(653.5, lcolor(cyan)); graph export "${GRAPHS}CTA_`type'_plain_change.eps", as(eps) replace ; #del cr /*SEAS*/ /* Obtain Start and Endtime */ sum time if change_`type'_seas!=. local mintime `r(min)' local maxtime `r(max)' # d; twoway (line change_`type'_seas time if ${treatment}==1 & time>=`mintime', lpattern(solid) lwidth(thick) lcolor(purple)) (line change_`type'_seas time if ${treatment}==0 & time>=`mintime', lpattern(dash) lwidth(thick) lcolor(orange)), legend(label(1 "Above Median Bite") label(2 "Below Median Bite")) xmtick(`mintime'(1)`maxtime') xtick(`mintime'(12)`maxtime') ${`type'SCALE} xline(659.5, lcolor(dknavy)) xline(653.5, lcolor(cyan)) note("Seasonally adjusted"); graph export "${GRAPHS}CTA_`type'_seas_change.eps", as(eps) replace ; #del cr /*SEAS_TREND*/ /* Obtain Start and Endtime */ sum time if change_`type'_seas_trend!=. local mintime `r(min)' local maxtime `r(max)' # d; twoway (line change_`type'_seas_trend time if ${treatment}==1 & time>=`mintime', lpattern(solid) lwidth(thick) lcolor(purple)) (line change_`type'_seas_trend time if ${treatment}==0 & time>=`mintime', lpattern(dash) lwidth(thick) lcolor(orange)), legend(label(1 "Above Median Bite") label(2 "Below Median Bite")) xmtick(`mintime'(1)`maxtime') xtick(`mintime'(12)`maxtime') ${`type'SCALE} xline(659.5, lcolor(dknavy)) xline(653.5, lcolor(cyan)) note("Seasonally adjusted and net of linear trend differentials before treatment"); graph export "${GRAPHS}CTA_`type'_seas_trend_change.eps", as(eps) replace ; #del cr /*SEAS_TREND_log*/ /* Obtain Start and Endtime */ sum time if change_`type'_seas_trend_log!=. local mintime `r(min)' local maxtime `r(max)' # d; twoway (line change_`type'_seas_trend_log time if ${treatment}==1 & time>=`mintime', lpattern(solid) lwidth(thick) lcolor(purple)) (line change_`type'_seas_trend_log time if ${treatment}==0 & time>=`mintime', lpattern(dash) lwidth(thick) lcolor(orange)), legend(label(1 "Above Median Bite") label(2 "Below Median Bite")) xmtick(`mintime'(1)`maxtime') xtick(`mintime'(12)`maxtime') ${`type'SCALE} xline(659.5, lcolor(dknavy)) xline(653.5, lcolor(cyan)) note("Seasonally adjusted and net of logarithmic trend differentials before treatment"); graph export "${GRAPHS}CTA_`type'_seas_trend_log_change.eps", as(eps) replace ; #del cr /*SEAS_TREND_sq*/ /* Obtain Start and Endtime */ sum time if change_`type'_seas_trend_sq!=. local mintime `r(min)' local maxtime `r(max)' # d; twoway (line change_`type'_seas_trend_sq time if ${treatment}==1 & time>=`mintime', lpattern(solid) lwidth(thick) lcolor(purple)) (line change_`type'_seas_trend_sq time if ${treatment}==0 & time>=`mintime', lpattern(dash) lwidth(thick) lcolor(orange)), legend(label(1 "Above Median Bite") label(2 "Below Median Bite")) xmtick(`mintime'(1)`maxtime') xtick(`mintime'(12)`maxtime') ${`type'SCALE} xline(659.5, lcolor(dknavy)) xline(653.5, lcolor(cyan)) note("Seasonally adjusted and net of quadratic trend differentials before treatment"); graph export "${GRAPHS}CTA_`type'_seas_trend_sq_change.eps", as(eps) replace ; #del cr /*SEAS Dummies*/ /* Obtain Start and Endtime */ sum time if change_`type'_seas_d!=. local mintime `r(min)' local maxtime `r(max)' # d; twoway (line change_`type'_seas_d time if ${treatment}==1 & time>=`mintime', lpattern(solid) lwidth(thick) lcolor(purple)) (line change_`type'_seas_d time if ${treatment}==0 & time>=`mintime', lpattern(dash) lwidth(thick) lcolor(orange)), legend(label(1 "Above Median Bite") label(2 "Below Median Bite")) xmtick(`mintime'(1)`maxtime') xtick(`mintime'(12)`maxtime') xline(659.5, lcolor(dknavy)) xline(653.5, lcolor(cyan)) note("Seasonally adjusted"); graph export "${GRAPHS}CTA_`type'_seas_d_change.eps", as(eps) replace ; #del cr /*SEAS Dummies _TREND*/ /* Obtain Start and Endtime */ sum time if change_`type'_seas_d_trend!=. local mintime `r(min)' local maxtime `r(max)' # d; twoway (line change_`type'_seas_d_trend time if ${treatment}==1 & time>=`mintime', lpattern(solid) lwidth(thick) lcolor(purple)) (line change_`type'_seas_d_trend time if ${treatment}==0 & time>=`mintime', lpattern(dash) lwidth(thick) lcolor(orange)), legend(label(1 "Above Median Bite") label(2 "Below Median Bite")) xmtick(`mintime'(1)`maxtime') xtick(`mintime'(12)`maxtime') xline(659.5, lcolor(dknavy)) xline(653.5, lcolor(cyan)) note("Seasonally adjusted and net of linear trend differentials before treatment"); graph export "${GRAPHS}CTA_`type'_seas_d_trend_change.eps", as(eps) replace ; #del cr } /*3. End of types*/ } /* Ende: Regionen*/ cap log close