************************************
*     Stata Code for Figures 3-7   *
*	Kline and Santos (2010)    *
************************************



**Figure 3**

clear
set mem 100m
insheet using ~/code/basic/IMpseudo/results_0_0_PT_levels.txt


drop v5
ren v1 yr
ren v2 tau
ren v3 lb
ren v4 ub

reshape wide lb ub, i(tau) j(yr)

lab var lb80 "1980"
lab var ub80 "1980"
lab var lb90 "1990"
lab var ub90 "1990"
lab var lb100 "2000"
lab var ub100 "2000"
lab var tau "Tau"

twoway rarea lb80 ub80 tau ||rarea lb90 ub90 tau || rcap lb100 ub100 tau, scheme(s2mono) || connected lb100 ub100 tau, msym(x x) legend(order(1 2 3)) title("Returns to Schooling by Quantile and Year") ytitle("dlnE/dlnS") legend(rows(1)) xlab(#10) yscale(range(0 .2)) ylab(#6) note("Note: Returns computed under missing at random assumption. Pseudo true projection weighted by" "empirical frequency of demographic groups. Shaded regions provide 95% uniform confidence bands.")

gr export ~/Output/stata_PT_MAR.eps, replace
!ps2pdf ~/Output/stata_PT_MAR.eps ~/Output/stata_PT_MAR.pdf


**Figure 4**


clear
insheet using ~/code/basic/bounds/results_level_10.txt

drop v7
ren v1 yr
ren v2 tau
ren v3 lb
ren v4 ub
ren v5 flaglb
ren v6 flagub

drop flag* // temporarily ignore this

reshape wide lb ub, i(tau) j(yr)

lab var lb80 "1980"
lab var ub80 "1980"
lab var lb90 "1990"
lab var ub90 "1990"
lab var lb100 "2000"
lab var ub100 "2000"
lab var tau "Tau"

twoway rarea lb80 ub80 tau ||rarea lb90 ub90 tau || rcap lb100 ub100 tau, scheme(s2mono) || connected lb100 ub100 tau, msym(x x) legend(order(1 2 3)) title("Returns to Schooling by Quantile and Year") ytitle("dlnE/dlnS") xlab(#10) legend(rows(1)) note("Note: Returns computed under KS band of 0.10. Shaded regions provide pointwise 95% confidence" "intervals generated via inversion of finite sample likelihood ratio test statistic. See Appendix B for" "details. Empty intervals constitute rejection of model at given quantile.")

gr export ~/Output/stata_10.eps, replace
!ps2pdf ~/Output/stata_10.eps ~/Output/stata_10.pdf


**Figure 5**

clear
set mem 100m
insheet using ~/code/basic/IMpseudo/results_5_0_PT_levels.txt


drop v5
ren v1 yr
ren v2 tau
ren v3 lb
ren v4 ub

reshape wide lb ub, i(tau) j(yr)

lab var lb80 "1980"
lab var ub80 "1980"
lab var lb90 "1990"
lab var ub90 "1990"
lab var lb100 "2000"
lab var ub100 "2000"
lab var tau "Tau"

twoway rarea lb80 ub80 tau ||rarea lb90 ub90 tau || rcap lb100 ub100 tau, scheme(s2mono) || connected lb100 ub100 tau, msym(x x) legend(order(1 2 3)) title("Returns to Schooling by Quantile and Year") ytitle("dlnE/dlnS") legend(rows(1)) xlab(#10) yscale(range(0 .2)) ylab(#6) note("Note: Returns computed under KS band of 0.05. Pseudo true projection weighted by empirical" "frequency of demographic groups. Shaded regions provide 95% uniform confidence bands.")

gr export ~/Output/stata_PT_05.eps, replace
!ps2pdf ~/Output/stata_PT_05.eps ~/Output/stata_PT_05.pdf

**Figure 6**

clear
set mem 100m
insheet using ~/code/basic/IMpseudo/results_14_0_PT_levels.txt


drop v5
ren v1 yr
ren v2 tau
ren v3 lb
ren v4 ub

reshape wide lb ub, i(tau) j(yr)

lab var lb80 "1980"
lab var ub80 "1980"
lab var lb90 "1990"
lab var ub90 "1990"
*lab var lb100 "2000"
*lab var ub100 "2000"
lab var tau "Tau"

twoway rarea lb80 ub80 tau ||rcapsym lb90 ub90 tau || line lb90 ub90 tau, lstyle(dotted dotted) scheme(s2mono) msym(x x) yscale(range(0 .2)) ylab(#6) legend(order(1 2)) title("Returns to Schooling by Quantile and Year") ytitle("dlnE/dlnS") legend(rows(1)) xlab(#10) note("Note: Returns computed under KS band of 0.135. Pseudo true projection weighted by empirical" "frequency of demographic groups. Shaded regions provide 95% uniform confidence bands.")

gr export ~/Output/stata_PT_14.eps, replace
!ps2pdf ~/Output/stata_PT_14.eps ~/Output/stata_PT_14.pdf


**Figure 7**

clear
set mem 100m
insheet using ~/code/basic/IMpseudo/results_5_0_0_PT_levels_fitted.txt


drop v6
ren v1 yr
ren v2 educ
ren v3 tau
ren v4 lb
ren v5 ub

reshape wide lb ub, i(educ tau) j(yr)
recode tau .1=1 .5=2 .9=3

reshape wide lb* ub*, i(educ) j(tau)

lab var lb801 "tau=.1, 1980"
lab var ub801 "tau=.1, 1980"
lab var lb802 "tau=.5, 1980"
lab var ub802 "tau=.5, 1980"
lab var lb803 "tau=.9, 1980"
lab var ub803 "tau=.9, 1980"

lab var lb901 "tau=.1, 1990"
lab var ub901 "tau=.1, 1990"
lab var lb902 "tau=.5, 1990"
lab var ub902 "tau=.5, 1990"
lab var lb903 "tau=.9, 1990"
lab var ub903 "tau=.9, 1990"

lab var lb1001 "tau=.1, 2000"
lab var ub1001 "tau=.1, 2000"
lab var lb1002 "tau=.5, 2000"
lab var ub1002 "tau=.5, 2000"
lab var lb1003 "tau=.9, 2000"
lab var ub1003 "tau=.9, 2000"


lab var educ "Years of Schooling"

twoway rarea lb901 ub901 educ ||rarea lb902 ub902 educ ||rarea lb903 ub903 educ || rcap lb1001 ub1001 educ || rcap lb1002 ub1002 educ /*
*/ || rcap lb1003 ub1003 educ, msym(x x) legend(order(1 2 3 4 5 6)) title("Fitted Values by Quantile, Education, and Year")/*
*/ ytitle("Log Weekly Earnings") legend(rows(2)) xlab(#10) scheme(s2mono) /*
*/ note("Note: Fitted values computed under KS bound of 0.05. Pseudo true projection weighted by" /*
*/ "empirical frequency of demographic groups. Earnings quantiles modeled using standard Mincer" /*
*/ "specification. Covariates other than education set to sample mean. Pointwise 95% confidence" /*
*/ "regions in shaded areas and intervals.") 

gr export ~/Output/stata_PT_fitted_05.eps, replace
!ps2pdf ~/Output/stata_PT_fitted_05.eps ~/Output/stata_PT_fitted_05.pdf
