******************************** *Creates Table 1 and Figures ******************************** clear capture log close set more off, permanently version 4 cd G:\daron\world_income_dist log using maketable1_and_figures, replace /*Data Files Used maketable1 *Data Files Created as Final Product none *Data Files Created as Intermediate Product none*/ # delimit; *** Note I included the countryn, d87 and id in barlee.dta to save on space here *****; use barlee.dta; ********************** GENERATING THE VARIABLES **********************************; gen opec=1 if (id==1|id==15|id==32|id==78|id==80|id==87|id==88|id==93|id==96|id==99|id==86); recode opec .=0; * Actually it turns out only 5 of these countries are in the smpl97 sample: these are Algeria, Venezuela, Indonesia, Iran, Iraq *; *gen opec=1 if (id==15|id==32|id==78|id==80|id==87|id==88|id==93|id==96|id==99|id==86); recode opec .=0; * Here we include *; gen gdpgr=((1+grsh52)*(1+grsh53)*(1+grsh54)*(1+grsh55))^(1/4)-1; gen totgr=((1+tot2)*(1+tot3)*(1+tot4)*(1+tot5))^(1/4)-1; gen loggdp=log(gdpsh565); ** GENERATING THE VARIABLES **; rename syrm65 syrm; rename syrf65 syrf; rename hyrm65 hyrm; rename hyrf65 hyrf; rename pyrm65 pyrm; rename pyrf65 pyrf; rename syr65 syr; rename hyr65 hyr; rename pyr65 pyr; gen yrm=syrm+hyrm+pyrm; gen yrf=syr+hyrf+pyrf; gen yr=syr+hyr+pyr; rename lifee02 lifee; gen llifee=log(lifee); gen invrat=(invsh52+invsh53+invsh54+invsh55)/4; gen gvxdxe=(gvxdxe52+gvxdxe53+gvxdxe54+gvxdxe55)/4; gen pright=(prights3+prights4+prights5)/3; gen civilib=(civlib3+civlib4+civlib5)/3; gen lbmp=(bmp2ml+bmp3l+ bmp4l+bmp5l)/4; gen pinst=(pinstab2+pinstab3+pinstab4+pinstab5)/4; gen ferti=(fert2+fert3+fert4+fert5)/4; gen lferti=(log(fert2)+log(fert3)+ log(fert4)+log(fert5))/4; gen wagepop=pop65*(1-pop1565-pop6565); gen lwapop=log(wagepop); gen difsyrm=syrm85-syrm; gen difsyrf=syrf85-syrf; gen difhyrm=hyrm85-hyrm; gen difhyrf=hyrf85-hyrf; gen difpyrm=pyrm85-pyrm; gen difpyrf=pyrf85-pyrf; gen difsyr=syr85-syr; gen difhyr=hyr85-hyr; gen difpyr=pyr85-pyr; gen llifee85=log(lifee05); gen diflife=llifee85-llifee; gen differt=fert5-ferti; gen difinvra=invsh55-invsh52; gen difyr=difsyr+difpyr+difhyr; gen difyrm=difsyrm+difpyrm+difhyrm; gen difyrf=difsyrf+difpyrf+difhyrf; *drop if countryn=="Jordan"; *--Please note that I do not have all the original data to reproduce this paper, so the # of obs - and hence the estimates - are a little bit different (but in general very similar). ; ** REGRESSION 1: **; **** ***; ; ivreg totgr (gdpgr=loggdp) yr llifee opec, first; reg totgr gdpgr yr llifee opec; drop if totgr ==.; drop if gdpgr ==.; drop if loggdp ==.; drop if yr ==.; drop if llifee ==.; reg gdpgr loggdp yr llifee opec; predict gdpgrhat; reg gdpgrhat yr llifee opec; predict gdpgrres, resid; reg totgr yr llifee opec; predict totgrres, resid; reg totgrres gdpgrres; predict fitted; label var totgrres "Residual Terms of Trade Growth"; label var gdpgrres "Residual GDP Growth"; gr totgrres fitted gdpgrres if totgrres ~=., s([countryn].) connect(.l) ylabel(-.04 -.03 to .05) xlabel(-.02 -.015 to .025) l2title ("Residual Terms of Trade Growth") t1title("Whole Sample") saving("gr1.gph",replace); ** REGRESSION 2: **; ivreg totgr (gdpgr=loggdp) syr hyr pyr llifee opec, first; reg totgr gdpgr syr hyr pyr llifee opec; ** REGRESSION 3: **; ivreg totgr (gdpgr=loggdp) yr llifee wardum lbmp pinst opec, first; reg totgr gdpgr yr llifee wardum lbmp pinst opec; ** REGRESSION 4: **; ivreg totgr (gdpgr=loggdp) yr difyr llifee diflife opec, first; reg totgr gdpgr yr difyr llifee diflife opec; ** REGRESSION 5: **; ivreg totgr (gdpgr=loggdp yr llifee) difyr diflife opec, first; reg totgr gdpgr difyr diflife opec; ****regresion6*****; keep if opec==0; ivreg totgr (gdpgr=loggdp) yr llifee, first; reg totgr gdpgr yr llifee; drop if totgr ==.; drop if gdpgr ==.; drop if loggdp ==.; drop if yr ==.; drop if llifee ==.; reg gdpgr loggdp yr llifee opec; drop gdpgrhat; predict gdpgrhat; reg gdpgrhat yr llifee opec; drop gdpgrres; predict gdpgrres, resid; reg totgr yr llifee opec; drop totgrres; predict totgrres, resid; reg totgrres gdpgrres; drop fitted; predict fitted; label var totgrres "Residual Terms of Trade Growth"; label var gdpgrres "Residual GDP Growth"; gr totgrres fitted gdpgrres if totgrres ~=., s([countryn].) connect(.l) ylabel(-.04 -.03 to .05) xlabel(-.02 -.015 to .025) l2title ("Residual Terms of Trade Growth") t1title("Non-OPEC Sample") saving("gr7.gph",replace); *****basic graph****; reg totgr gdpgr; drop fitted; predict fitted; label var totgr "Terms of Trade Growth"; label var gdpgr "GDP Growth"; gr totgr gdpgr, s([countryn].) connect(.l) ylabel(-.04 -.025 to .095) xlabel(-.02 -.01 to .07) t1title("Whole Sample") saving("grttgrowth.gph",replace); *****basic graph no oil****; keep if opec==0; reg totgr gdpgr; drop fitted; predict fitted; label var totgr "Terms of Trade Growth"; label var gdpgr "GDP Growth"; gr totgr gdpgr, s([countryn].) connect(.l) ylabel(-.04 -.025 to .095) xlabel(-.02 -.01 to .07) t1title("Non-OPEC Sample") saving("grttgrowthnooil.gph",replace); graph using gr1.gph gr7.gph, saving("IVgraph.gph",replace); graph using grttgrowth.gph grttgrowthnooil.gph, saving("basicgraph.gph",replace); log close;