/*************************************************************************/ /* Kilby JDE */ /* "Assessing the impact of World Bank preparation on project outcomes" */ /* */ /* Description: Replicates tables and graphs from paper as well as */ /* simulations and other information presented in text. */ /* Table 1: Descriptive statistics for SFA */ /* Table 2: SFA */ /* Table 3: Descriptive statistics for performance equation */ /* Table 4: Baseline performance equation */ /* Table 5: Robustness analysis of performance equation */ /* Table 6: Interactions with economic vulnerability variables */ /* */ /* Some of the tables are out of order (i.e., descriptive statistics */ /* AFTER estimation) */ /* */ /* Input file: "Kilby JDE preparpation performance data.dta" */ /* Output files: "Table 1.txt" - "Table 6.txt", "Figure 1.wmf" - */ /* "Figure 4...wmf" */ /* File uses some user-written commands (install them using "findit") */ /* or comment these lines out (not critical for findings). */ /* - sfpanel */ /* - sftfe */ /*************************************************************************/ /* Mapping between variable names in paper and in this file */ /* Note that some variables appear in both equations but */ /* they cover different times (e.g., 3 years before approval */ /* in the SFM [L3...], at approval in the performance */ /* equation) so just matching names to paper isn't */ /* straightforward. */ /* Also, trending variables detrended in SFM [...RES] */ /* where year dummies don't work well but not in performance */ /* equation where year dummies do work well. */ /* */ /* SFM: */ /* Paper Program */ /* ======================================================== */ /* Approval Date adate */ /* Project ID projnum */ /* Project Size ln_LPCRES */ /* IDA IDA */ /* SAL SAL */ /* War L3War */ /* Population L3ln_popRES */ /* GDP per capita L3ln_gdpRES */ /* Democracy L3democracy */ /* Freedom House Index L3FHRES */ /* US important votes L3USA_UN_importantRES */ /* US other votes L3USA_UN_otherRES */ /* G7-1 important votes L3G7minus1_UN_importantRES*/ /* G7-1 other votes L3G7minus1_UN_otherRES */ /* US military aid L3USA_sig_milRES */ /* US economic aid L3ln_USA_tofgRES */ /* G7-1 economic aid L3ln_G7minus1_tofgRES */ /* Like-minded donor economic aid L3ln_LM_tofgRES */ /* US trade L3ln_USA_tradeRES */ /* G7-1 trade L3ln_G7minus1_tradeRES */ /* World trade L3ln_WLD_tradeRES */ /* UNSC non-permanent member L2UNSC_rotate */ /* World Bank Executive Director WBEB */ /* */ /* Performance Equation: */ /* Paper Program */ /* ======================================================== */ /* Outcome Outcome_last */ /* Preparation prep */ /* Project Size ln_LPC */ /* Population ln_pop */ /* GDP per capita ln_gdp */ /* GDP growth growth */ /* US important votes L3USA_UN_importantRES */ /* UNSC non-permanent member L2UNSC_rotate */ /* World Bank Executive Director WBEB */ /* Audit Rating audit_last */ /* Evaluation Lag IEG_EvalLag_last */ /* IDA IDA */ /* SAL SAL */ /* Energy/Mining Sector energy_mining */ /* Transportation Sector transportation */ /* Other Sectors other */ /* % Short Term Debt short_debt */ /* % Short Term Debt x Prep prep_short */ /* Debt Service/GNI debt_service */ /* Debt Service/GNI x Prep prep_debt */ /* East Asia Pacific dummy EAP */ /* Sub-Saharan Africa dummy SSA */ /* South Asia dummy SA */ /* Latin America Caribbean dum. LAC */ /* Middle East North Africa dum. MENA */ /* Government Fixed Effect dum. L3gid2 */ /*************************************************************/ version 13.1 #delimit ; set more off; set varabbrev off; /* Bootstrap program with bootstrap 1st & 2nd stages*/ /* Single sample for both estimations */ /* Note that the bootstap command does not detect */ /* problem cases very well so I do it "manually" */ /* with the "problem" scalar. */ capture program drop bsprog42; /*for Table 4, Column 2*/ program define bsprog42; /*run logit just to get sample for performance estimation. Specification below minimizes time for this estimation*/ gen crap=L3USA_UN_importantRES+L2UNSC_rotate+WBEB+ln_LPC+ln_pop+ln_gdp+growth+year; /*same missing values as in real performance estimation*/ logit Outcome_last crap, iterate(1); /*just to get sample*/ gen tperformance_sample=e(sample); drop crap; frontier adate projnum if projnum>20000 & projnum<75267 & year>1993 & done, cost distribution(exp) uhet(ln_LPCRES IDA SAL L3war L3ln_popRES L3ln_gdpRES L3democracy L3FHRES L3USA_UN_importantRES L3USA_UN_otherRES L3G7minus1_UN_importantRES L3G7minus1_UN_otherRES L3USA_sig_milRES L3ln_USA_tofgRES L3ln_G7minus1_tofgRES L3ln_LM_tofgRES L3ln_USA_tradeRES L3ln_G7minus1_tradeRES L3ln_WLD_tradeRES L2UNSC_rotate WBEB EAP ECA MENA LAC SA) iterate(100); scalar problem=(e(ic)==100) | !e(converged); /*treat as error if convergence not achieved or iterated to 100 (e.g., not concave)*/ if problem==0 {; foreach i in ln_LPCRES IDA SAL L3war L3ln_popRES L3ln_gdpRES L3democracy L3FHRES L3G7minus1_UN_importantRES L3G7minus1_UN_otherRES L3USA_sig_milRES L3ln_USA_tofgRES L3ln_G7minus1_tofgRES L3ln_LM_tofgRES L3ln_USA_tradeRES L3ln_G7minus1_tradeRES L3ln_WLD_tradeRES EAP ECA MENA LAC SA {; su `i' if tperformance_sample, meanonly; /*use means specific to sample drawn by bootstrap command to fit sample theory*/ gen tmean_`i'=r(mean); }; gen tprep=sqrt(exp(_b[lnsig2u:ln_LPCRES]*tmean_ln_LPCRES+_b[lnsig2u:IDA]*tmean_IDA+_b[lnsig2u:SAL]*tmean_SAL+_b[lnsig2u:L3war]*tmean_L3war+_b[lnsig2u:L3ln_popRES]*tmean_L3ln_popRES +_b[lnsig2u:L3ln_gdpRES]*tmean_L3ln_gdpRES+_b[lnsig2u:L3democracy]*tmean_L3democracy+_b[lnsig2u:L3FHRES]*tmean_L3FHRES+_b[lnsig2u:L3USA_UN_importantRES]*L3USA_UN_importantRES +_b[lnsig2u:L3USA_UN_otherRES]*L3USA_UN_otherRES+_b[lnsig2u:L3G7minus1_UN_importantRES]*tmean_L3G7minus1_UN_importantRES +_b[lnsig2u:L3G7minus1_UN_otherRES]*tmean_L3G7minus1_UN_otherRES+_b[lnsig2u:L3USA_sig_milRES]*tmean_L3USA_sig_milRES +_b[lnsig2u:L3ln_USA_tofgRES]*tmean_L3ln_USA_tofgRES+_b[lnsig2u:L3ln_LM_tofgRES]*tmean_L3ln_LM_tofgRES+_b[lnsig2u:L3ln_G7minus1_tofgRES]*tmean_L3ln_G7minus1_tofgRES +_b[lnsig2u:L3ln_USA_tradeRES]*tmean_L3ln_USA_tradeRES+_b[lnsig2u:L3ln_G7minus1_tradeRES]*tmean_L3ln_G7minus1_tradeRES+_b[lnsig2u:L3ln_WLD_tradeRES]*tmean_L3ln_WLD_tradeRES +_b[lnsig2u:L2UNSC_rotate]*L2UNSC_rotate+_b[lnsig2u:WBEB]*WBEB+_b[lnsig2u:EAP]*tmean_EAP+_b[lnsig2u:ECA]*tmean_ECA+_b[lnsig2u:MENA]*tmean_MENA +_b[lnsig2u:LAC]*tmean_LAC+_b[lnsig2u:SA]*tmean_SA+_b[lnsig2u:_cons]))/365; logit Outcome_last tprep ln_LPC ln_pop ln_gdp growth i.year, iterate(100); drop tperformance_sample tprep tmean_*; scalar problem=(e(ic)==100) | !e(converged); /*treat as error if iterated to 100 (e.g., not concave) or convergence not achieved*/ }; end; capture program drop bsprog44; /*for Table 4, Column 2*/ program define bsprog44; /*run logit just to get sample for performance estimation. Specification below minimizes time for this estimation*/ gen crap=L3USA_UN_importantRES+L2UNSC_rotate+WBEB+ln_LPC+ln_pop+ln_gdp+growth+year; /*same missing values as in real performance estimation*/ logit Outcome_last crap, iterate(1); /*just to get sample*/ gen tperformance_sample=e(sample); drop crap; frontier adate projnum if projnum>20000 & projnum<75267 & year>1993 & done, cost distribution(exp) uhet(ln_LPCRES IDA SAL L3war L3ln_popRES L3ln_gdpRES L3democracy L3FHRES L3USA_UN_importantRES L3USA_UN_otherRES L3G7minus1_UN_importantRES L3G7minus1_UN_otherRES L3USA_sig_milRES L3ln_USA_tofgRES L3ln_G7minus1_tofgRES L3ln_LM_tofgRES L3ln_USA_tradeRES L3ln_G7minus1_tradeRES L3ln_WLD_tradeRES L2UNSC_rotate WBEB EAP ECA MENA LAC SA) iterate(100); scalar problem=(e(ic)==100) | !e(converged); /*treat as error if convergence not achieved or iterated to 100 (e.g., not concave)*/ if problem==0 {; foreach i in ln_LPCRES IDA SAL L3war L3ln_popRES L3ln_gdpRES L3democracy L3FHRES L3G7minus1_UN_importantRES L3G7minus1_UN_otherRES L3USA_sig_milRES L3ln_USA_tofgRES L3ln_G7minus1_tofgRES L3ln_LM_tofgRES L3ln_USA_tradeRES L3ln_G7minus1_tradeRES L3ln_WLD_tradeRES EAP ECA MENA LAC SA {; su `i' if tperformance_sample, meanonly; /*use means specific to sample drawn by bootstrap command to fit sample theory*/ gen tmean_`i'=r(mean); }; gen tprep=sqrt(exp(_b[lnsig2u:ln_LPCRES]*tmean_ln_LPCRES+_b[lnsig2u:IDA]*tmean_IDA+_b[lnsig2u:SAL]*tmean_SAL+_b[lnsig2u:L3war]*tmean_L3war+_b[lnsig2u:L3ln_popRES]*tmean_L3ln_popRES +_b[lnsig2u:L3ln_gdpRES]*tmean_L3ln_gdpRES+_b[lnsig2u:L3democracy]*tmean_L3democracy+_b[lnsig2u:L3FHRES]*tmean_L3FHRES+_b[lnsig2u:L3USA_UN_importantRES]*L3USA_UN_importantRES +_b[lnsig2u:L3USA_UN_otherRES]*L3USA_UN_otherRES+_b[lnsig2u:L3G7minus1_UN_importantRES]*tmean_L3G7minus1_UN_importantRES +_b[lnsig2u:L3G7minus1_UN_otherRES]*tmean_L3G7minus1_UN_otherRES+_b[lnsig2u:L3USA_sig_milRES]*tmean_L3USA_sig_milRES +_b[lnsig2u:L3ln_USA_tofgRES]*tmean_L3ln_USA_tofgRES+_b[lnsig2u:L3ln_LM_tofgRES]*tmean_L3ln_LM_tofgRES+_b[lnsig2u:L3ln_G7minus1_tofgRES]*tmean_L3ln_G7minus1_tofgRES +_b[lnsig2u:L3ln_USA_tradeRES]*tmean_L3ln_USA_tradeRES+_b[lnsig2u:L3ln_G7minus1_tradeRES]*tmean_L3ln_G7minus1_tradeRES+_b[lnsig2u:L3ln_WLD_tradeRES]*tmean_L3ln_WLD_tradeRES +_b[lnsig2u:L2UNSC_rotate]*L2UNSC_rotate+_b[lnsig2u:WBEB]*WBEB+_b[lnsig2u:EAP]*tmean_EAP+_b[lnsig2u:ECA]*tmean_ECA+_b[lnsig2u:MENA]*tmean_MENA +_b[lnsig2u:LAC]*tmean_LAC+_b[lnsig2u:SA]*tmean_SA+_b[lnsig2u:_cons]))/365; xtset newcid projnum; xtlogit Outcome_last tprep ln_LPC ln_pop ln_gdp growth i.year, fe iterate(100); drop tperformance_sample tprep tmean_*; scalar problem=(e(ic)==100) | !e(converged); /*treat as error if iterated to 100 (e.g., not concave) or convergence not achieved*/ }; end; capture log close; log using "Kilby JDE preparation performance.log", replace; use "Kilby JDE preparpation performance data.dta", clear; /******************************************************************************/ /* Stochastic Frontier Analysis (section 4 of paper) */ /******************************************************************************/ /*********/ /*Table 2*/ /*********/ frontier adate projnum if projnum>20000 & projnum<75267 & year>1993 & done, cost distribution(exp) uhet(ln_LPCRES IDA SAL L3war L3ln_popRES L3ln_gdpRES L3democracy L3FHRES L3USA_UN_importantRES L3USA_UN_otherRES L3G7minus1_UN_importantRES L3G7minus1_UN_otherRES L3USA_sig_milRES L3ln_USA_tofgRES L3ln_G7minus1_tofgRES L3ln_LM_tofgRES L3ln_USA_tradeRES L3ln_G7minus1_tradeRES L3ln_WLD_tradeRES L2UNSC_rotate WBEB EAP ECA MENA LAC SA); estimates store Tab2_Col1; gen SFA_sample=e(sample); label var SFA_sample "Estimation sample for Stochastic Frontier Analysis"; esttab Tab2_Col1 using "Table 2.txt", label title("Table 2: Stochastic Frontier Model of Preparation") nocons tab nogaps replace keep(ln_LPCRES IDA SAL L3war L3ln_popRES L3ln_gdpRES L3democracy L3FHRES L3USA_UN_importantRES L3USA_UN_otherRES L3G7minus1_UN_importantRES L3G7minus1_UN_otherRES L3USA_sig_milRES L3ln_USA_tofgRES L3ln_G7minus1_tofgRES L3ln_LM_tofgRES L3ln_USA_tradeRES L3ln_G7minus1_tradeRES L3ln_WLD_tradeRES L2UNSC_rotate WBEB) starl(* .1 ** .05) addnote("z statistics in parantheses"); estimates drop Tab2_Col1; /*Greene's (2005) True Fixed Effects (TFE) specifcation for SFM*/ /*I haven't found an straightforward way of incorporating these estimates via esttab so these were added to Table 2 by hand*/ xtset cid projnum; sfpanel adate projnum if projnum>20000 & projnum<75267 & year>1993 & done, cost model(tfe) distribution(exp) usigma(ln_LPCRES IDA SAL L3war L3ln_popRES L3ln_gdpRES L3democracy L3FHRES L3USA_UN_importantRES L3USA_UN_otherRES L3G7minus1_UN_importantRES L3G7minus1_UN_otherRES L3USA_sig_milRES L3ln_USA_tofgRES L3ln_G7minus1_tofgRES L3ln_LM_tofgRES L3ln_USA_tradeRES L3ln_G7minus1_tradeRES L3ln_WLD_tradeRES L2UNSC_rotate WBEB EAP ECA MENA LAC SA); /*Belotti & Ilardi (2014) PDE estimator for TFE--not working yet*/ *sftfe adate projnum if projnum>20000 & projnum<75267 & year>1993 & done, estimator(tfe) cost distribution(exp) usigma(ln_LPCRES IDA SAL L3war L3ln_popRES L3ln_gdpRES L3democracy L3FHRES L3USA_UN_importantRES L3USA_UN_otherRES L3G7minus1_UN_importantRES L3G7minus1_UN_otherRES L3USA_sig_milRES L3ln_USA_tofgRES L3ln_G7minus1_tofgRES L3ln_LM_tofgRES L3ln_USA_tradeRES L3ln_G7minus1_tradeRES L3ln_WLD_tradeRES L2UNSC_rotate WBEB EAP ECA MENA LAC SA); /*End Table 2*/ /***********/ /*Figure 1*/ /***********/ quietly: frontier adate projnum if projnum>20000 & projnum<75267 & year>1993 & done, cost distribution(exp) uhet(ln_LPCRES IDA SAL L3war L3ln_popRES L3ln_gdpRES L3democracy L3FHRES L3USA_UN_importantRES L3USA_UN_otherRES L3G7minus1_UN_importantRES L3G7minus1_UN_otherRES L3USA_sig_milRES L3ln_USA_tofgRES L3ln_G7minus1_tofgRES L3ln_LM_tofgRES L3ln_USA_tradeRES L3ln_G7minus1_tradeRES L3ln_WLD_tradeRES L2UNSC_rotate WBEB EAP ECA MENA LAC SA); predict id_date, xb; twoway (scatter adate projnum if SFA_sample) (line id_date projnum if SFA_sample, sort lwidth(thick) lcolor(black)), legend(off) xtitle("Project ID") xsca(titlegap(2)) xlabel(40000 50000 60000 70000,format(%7.0f)) ytitle("Approval or Identification Date") ysca(titlegap(2)) ylabel( 12774 "1995" 14610 "2000" 16436 "2005" 18263 "2010"); graph export "Figure 1.wmf", replace; drop id_date; /*End Figure 1*/ /********************************/ /*Simulations presented in paper*/ /********************************/ /*magnitude of Project Size impact*/ adjust ln_LPCRES IDA SAL L3war L3ln_popRES L3ln_gdpRES L3democracy L3FHRES L3USA_UN_importantRES L3USA_UN_otherRES L3G7minus1_UN_importantRES L3G7minus1_UN_otherRES L3USA_sig_milRES L3ln_USA_tofgRES L3ln_G7minus1_tofgRES L3ln_LM_tofgRES L3ln_USA_tradeRES L3ln_G7minus1_tradeRES L3ln_WLD_tradeRES L2UNSC_rotate WBEB EAP ECA MENA LAC SA if e(sample), equation(lnsig2u) xb se gen(x1 se1); adjust ln_LPCRES=5.5468734 IDA SAL L3war L3ln_popRES L3ln_gdpRES L3democracy L3FHRES L3USA_UN_importantRES L3USA_UN_otherRES L3G7minus1_UN_importantRES L3G7minus1_UN_otherRES L3USA_sig_milRES L3ln_USA_tofgRES L3ln_G7minus1_tofgRES L3ln_LM_tofgRES L3ln_USA_tradeRES L3ln_G7minus1_tradeRES L3ln_WLD_tradeRES L2UNSC_rotate WBEB EAP ECA MENA LAC SA if e(sample), equation(lnsig2u) xb se gen(x2 se2); gen y1=round(sqrt(exp(x1)) -sqrt(exp(x2))) if e(sample); /*round so answer is in whole days*/ gen y2=round(sqrt(exp(x1-2*se1))-sqrt(exp(x2-2*se2))) if e(sample); gen y3=round(sqrt(exp(x1+2*se1))-sqrt(exp(x2+2*se2))) if e(sample); su y1 if e(sample); scalar define z1=r(mean); su y2 if e(sample); scalar define z2=r(mean); su y3 if e(sample); scalar define z3=r(mean); display "Impact of increasing Project Size by 1 std from the mean (in days): " z1 " with range (" z2 "," z3 ") (-/+ 2 SEs from mean prediction)"; drop x1 x2 se1 se2 y1 y2 y3; scalar drop z1 z2 z3; /*Magnitude of SAL impact*/ adjust ln_LPCRES IDA SAL=0 L3war L3ln_popRES L3ln_gdpRES L3democracy L3FHRES L3USA_UN_importantRES L3USA_UN_otherRES L3G7minus1_UN_importantRES L3G7minus1_UN_otherRES L3USA_sig_milRES L3ln_USA_tofgRES L3ln_G7minus1_tofgRES L3ln_LM_tofgRES L3ln_USA_tradeRES L3ln_G7minus1_tradeRES L3ln_WLD_tradeRES L2UNSC_rotate WBEB EAP ECA MENA LAC SA if e(sample), equation(lnsig2u) xb se gen(x1 se1); adjust ln_LPCRES IDA SAL=1 L3war L3ln_popRES L3ln_gdpRES L3democracy L3FHRES L3USA_UN_importantRES L3USA_UN_otherRES L3G7minus1_UN_importantRES L3G7minus1_UN_otherRES L3USA_sig_milRES L3ln_USA_tofgRES L3ln_G7minus1_tofgRES L3ln_LM_tofgRES L3ln_USA_tradeRES L3ln_G7minus1_tradeRES L3ln_WLD_tradeRES L2UNSC_rotate WBEB EAP ECA MENA LAC SA if e(sample), equation(lnsig2u) xb se gen(x2 se2); gen y1=round(sqrt(exp(x1)) -sqrt(exp(x2))) if e(sample); /*round so answer is in whole days*/ gen y2=round(sqrt(exp(x1-2*se1))-sqrt(exp(x2-2*se2))) if e(sample); gen y3=round(sqrt(exp(x1+2*se1))-sqrt(exp(x2+2*se2))) if e(sample); su y1 if e(sample); scalar define z1=r(mean); su y2 if e(sample); scalar define z2=r(mean); su y3 if e(sample); scalar define z3=r(mean); display "Impact of switching from no SAL to SAL (in days): " z1 " with range (" z2 "," z3 ") (-/+ 2 SEs from mean prediction)"; drop x1 x2 se1 se2 y1 y2 y3; scalar drop z1 z2 z3; /*Magnitude of population impact*/ adjust ln_LPCRES IDA SAL L3war L3ln_popRES L3ln_gdpRES L3democracy L3FHRES L3USA_UN_importantRES L3USA_UN_otherRES L3G7minus1_UN_importantRES L3G7minus1_UN_otherRES L3USA_sig_milRES L3ln_USA_tofgRES L3ln_G7minus1_tofgRES L3ln_LM_tofgRES L3ln_USA_tradeRES L3ln_G7minus1_tradeRES L3ln_WLD_tradeRES L2UNSC_rotate WBEB EAP ECA MENA LAC SA if e(sample), equation(lnsig2u) xb se gen(x1 se1); adjust ln_LPCRES IDA SAL L3war L3ln_popRES=2.4749229 L3ln_gdpRES L3democracy L3FHRES L3USA_UN_importantRES L3USA_UN_otherRES L3G7minus1_UN_importantRES L3G7minus1_UN_otherRES L3USA_sig_milRES L3ln_USA_tofgRES L3ln_G7minus1_tofgRES L3ln_LM_tofgRES L3ln_USA_tradeRES L3ln_G7minus1_tradeRES L3ln_WLD_tradeRES L2UNSC_rotate WBEB EAP ECA MENA LAC SA if e(sample), equation(lnsig2u) xb se gen(x2 se2); gen y1=round(sqrt(exp(x1)) -sqrt(exp(x2))) if e(sample); /*round so answer is in whole days*/ gen y2=round(sqrt(exp(x1-2*se1))-sqrt(exp(x2-2*se2))) if e(sample); gen y3=round(sqrt(exp(x1+2*se1))-sqrt(exp(x2+2*se2))) if e(sample); su y1 if e(sample); scalar define z1=r(mean); su y2 if e(sample); scalar define z2=r(mean); su y3 if e(sample); scalar define z3=r(mean); display "Impact of increasing population by 1 std from the mean (in days): " z1 " with range (" z2 "," z3 ") (-/+ 2 SEs from mean prediction)"; drop x1 x2 se1 se2 y1 y2 y3; scalar drop z1 z2 z3; /*Magnitude of GDP impact*/ adjust ln_LPCRES IDA SAL L3war L3ln_popRES L3ln_gdpRES L3democracy L3FHRES L3USA_UN_importantRES L3USA_UN_otherRES L3G7minus1_UN_importantRES L3G7minus1_UN_otherRES L3USA_sig_milRES L3ln_USA_tofgRES L3ln_G7minus1_tofgRES L3ln_LM_tofgRES L3ln_USA_tradeRES L3ln_G7minus1_tradeRES L3ln_WLD_tradeRES L2UNSC_rotate WBEB EAP ECA MENA LAC SA if e(sample), equation(lnsig2u) xb se gen(x1 se1); adjust ln_LPCRES IDA SAL L3war L3ln_popRES L3ln_gdpRES=.938243 L3democracy L3FHRES L3USA_UN_importantRES L3USA_UN_otherRES L3G7minus1_UN_importantRES L3G7minus1_UN_otherRES L3USA_sig_milRES L3ln_USA_tofgRES L3ln_G7minus1_tofgRES L3ln_LM_tofgRES L3ln_USA_tradeRES L3ln_G7minus1_tradeRES L3ln_WLD_tradeRES L2UNSC_rotate WBEB EAP ECA MENA LAC SA if e(sample), equation(lnsig2u) xb se gen(x2 se2); gen y1=round(sqrt(exp(x1)) -sqrt(exp(x2))) if e(sample); /*round so answer is in whole days*/ gen y2=round(sqrt(exp(x1-2*se1))-sqrt(exp(x2-2*se2))) if e(sample); gen y3=round(sqrt(exp(x1+2*se1))-sqrt(exp(x2+2*se2))) if e(sample); su y1 if e(sample); scalar define z1=r(mean); su y2 if e(sample); scalar define z2=r(mean); su y3 if e(sample); scalar define z3=r(mean); display "Impact of increasing GDP by 1 std from the mean (in days): " z1 " with range (" z2 "," z3 ") (-/+ 2 SEs from mean prediction)"; drop x1 x2 se1 se2 y1 y2 y3; scalar drop z1 z2 z3; /*Magnitude of FH impact*/ adjust ln_LPCRES IDA SAL L3war L3ln_popRES L3ln_gdpRES L3democracy L3FHRES L3USA_UN_importantRES L3USA_UN_otherRES L3G7minus1_UN_importantRES L3G7minus1_UN_otherRES L3USA_sig_milRES L3ln_USA_tofgRES L3ln_G7minus1_tofgRES L3ln_LM_tofgRES L3ln_USA_tradeRES L3ln_G7minus1_tradeRES L3ln_WLD_tradeRES L2UNSC_rotate WBEB EAP ECA MENA LAC SA if e(sample), equation(lnsig2u) xb se gen(x1 se1); adjust ln_LPCRES IDA SAL L3war L3ln_popRES L3ln_gdpRES L3democracy L3FHRES=1.5161993 L3USA_UN_importantRES L3USA_UN_otherRES L3G7minus1_UN_importantRES L3G7minus1_UN_otherRES L3USA_sig_milRES L3ln_USA_tofgRES L3ln_G7minus1_tofgRES L3ln_LM_tofgRES L3ln_USA_tradeRES L3ln_G7minus1_tradeRES L3ln_WLD_tradeRES L2UNSC_rotate WBEB EAP ECA MENA LAC SA if e(sample), equation(lnsig2u) xb se gen(x2 se2); gen y1=round(sqrt(exp(x1)) -sqrt(exp(x2))) if e(sample); /*round so answer is in whole days*/ gen y2=round(sqrt(exp(x1-2*se1))-sqrt(exp(x2-2*se2))) if e(sample); gen y3=round(sqrt(exp(x1+2*se1))-sqrt(exp(x2+2*se2))) if e(sample); su y1 if e(sample); scalar define z1=r(mean); su y2 if e(sample); scalar define z2=r(mean); su y3 if e(sample); scalar define z3=r(mean); display "Impact of increasing Freedom House by 1 std from the mean (in days): " z1 " with range (" z2 "," z3 ") (-/+ 2 SEs from mean prediction)"; drop x1 x2 se1 se2 y1 y2 y3; scalar drop z1 z2 z3; /*Magnitude of UN voting impact*/ adjust ln_LPCRES IDA SAL L3war L3ln_popRES L3ln_gdpRES L3democracy L3FHRES L3USA_UN_importantRES L3USA_UN_otherRES L3G7minus1_UN_importantRES L3G7minus1_UN_otherRES L3USA_sig_milRES L3ln_USA_tofgRES L3ln_G7minus1_tofgRES L3ln_LM_tofgRES L3ln_USA_tradeRES L3ln_G7minus1_tradeRES L3ln_WLD_tradeRES L2UNSC_rotate WBEB EAP ECA MENA LAC SA if e(sample), equation(lnsig2u) xb se gen(x1 se1); adjust ln_LPCRES IDA SAL L3war L3ln_popRES L3ln_gdpRES L3democracy L3FHRES L3USA_UN_importantRES=.15323843 L3USA_UN_otherRES L3G7minus1_UN_importantRES L3G7minus1_UN_otherRES L3USA_sig_milRES L3ln_USA_tofgRES L3ln_G7minus1_tofgRES L3ln_LM_tofgRES L3ln_USA_tradeRES L3ln_G7minus1_tradeRES L3ln_WLD_tradeRES L2UNSC_rotate WBEB EAP ECA MENA LAC SA if e(sample), equation(lnsig2u) xb se gen(x2 se2); gen y1=round(sqrt(exp(x1)) -sqrt(exp(x2))) if e(sample); /*round so answer is in whole days*/ gen y2=round(sqrt(exp(x1-2*se1))-sqrt(exp(x2-2*se2))) if e(sample); gen y3=round(sqrt(exp(x1+2*se1))-sqrt(exp(x2+2*se2))) if e(sample); su y1 if e(sample); scalar define z1=r(mean); su y2 if e(sample); scalar define z2=r(mean); su y3 if e(sample); scalar define z3=r(mean); display "Impact of increasing UN voting alignment by 1 std from the mean (in days): " z1 " with range (" z2 "," z3 ") (-/+ 2 SEs from mean prediction)"; drop x1 x2 se1 se2 y1 y2 y3; scalar drop z1 z2 z3; /*Magnitude of World Trade impact*/ adjust ln_LPCRES IDA SAL L3war L3ln_popRES L3ln_gdpRES L3democracy L3FHRES L3USA_UN_importantRES L3USA_UN_otherRES L3G7minus1_UN_importantRES L3G7minus1_UN_otherRES L3USA_sig_milRES L3ln_USA_tofgRES L3ln_G7minus1_tofgRES L3ln_LM_tofgRES L3ln_USA_tradeRES L3ln_G7minus1_tradeRES L3ln_WLD_tradeRES L2UNSC_rotate WBEB EAP ECA MENA LAC SA if e(sample), equation(lnsig2u) xb se gen(x1 se1); adjust ln_LPCRES IDA SAL L3war L3ln_popRES L3ln_gdpRES L3democracy L3FHRES L3USA_UN_importantRES L3USA_UN_otherRES L3G7minus1_UN_importantRES L3G7minus1_UN_otherRES L3USA_sig_milRES L3ln_USA_tofgRES L3ln_G7minus1_tofgRES L3ln_LM_tofgRES L3ln_USA_tradeRES L3ln_G7minus1_tradeRES L3ln_WLD_tradeRES=2.617977 L2UNSC_rotate WBEB EAP ECA MENA LAC SA if e(sample), equation(lnsig2u) xb se gen(x2 se2); gen y1=round(sqrt(exp(x1)) -sqrt(exp(x2))) if e(sample); /*round so answer is in whole days*/ gen y2=round(sqrt(exp(x1-2*se1))-sqrt(exp(x2-2*se2))) if e(sample); gen y3=round(sqrt(exp(x1+2*se1))-sqrt(exp(x2+2*se2))) if e(sample); su y1 if e(sample); scalar define z1=r(mean); su y2 if e(sample); scalar define z2=r(mean); su y3 if e(sample); scalar define z3=r(mean); display "Impact of increasing World Trade by 1 std from the mean (in days): " z1 " with range (" z2 "," z3 ") (-/+ 2 SEs from mean prediction)"; drop x1 x2 se1 se2 y1 y2 y3; scalar drop z1 z2 z3; /*Magnitude of UNSC impact*/ adjust ln_LPCRES IDA SAL L3war L3ln_popRES L3ln_gdpRES L3democracy L3FHRES L3USA_UN_importantRES L3USA_UN_otherRES L3G7minus1_UN_importantRES L3G7minus1_UN_otherRES L3USA_sig_milRES L3ln_USA_tofgRES L3ln_G7minus1_tofgRES L3ln_LM_tofgRES L3ln_USA_tradeRES L3ln_G7minus1_tradeRES L3ln_WLD_tradeRES L2UNSC_rotate=0 WBEB EAP ECA MENA LAC SA if e(sample), equation(lnsig2u) xb se gen(x1 se1); adjust ln_LPCRES IDA SAL L3war L3ln_popRES L3ln_gdpRES L3democracy L3FHRES L3USA_UN_importantRES L3USA_UN_otherRES L3G7minus1_UN_importantRES L3G7minus1_UN_otherRES L3USA_sig_milRES L3ln_USA_tofgRES L3ln_G7minus1_tofgRES L3ln_LM_tofgRES L3ln_USA_tradeRES L3ln_G7minus1_tradeRES L3ln_WLD_tradeRES L2UNSC_rotate=1 WBEB EAP ECA MENA LAC SA if e(sample), equation(lnsig2u) xb se gen(x2 se2); gen y1=round(sqrt(exp(x1)) -sqrt(exp(x2))) if e(sample); /*round so answer is in whole days*/ gen y2=round(sqrt(exp(x1-2*se1))-sqrt(exp(x2-2*se2))) if e(sample); gen y3=round(sqrt(exp(x1+2*se1))-sqrt(exp(x2+2*se2))) if e(sample); su y1 if e(sample); scalar define z1=r(mean); su y2 if e(sample); scalar define z2=r(mean); su y3 if e(sample); scalar define z3=r(mean); display "Impact of switching from no UNSC to UNSC (in days): " z1 " with range (" z2 "," z3 ") (-/+ 2 SEs from mean prediction)"; drop x1 x2 se1 se2 y1 y2 y3; scalar drop z1 z2 z3; /*Magnitude of WBEB impact*/ adjust ln_LPCRES IDA SAL L3war L3ln_popRES L3ln_gdpRES L3democracy L3FHRES L3USA_UN_importantRES L3USA_UN_otherRES L3G7minus1_UN_importantRES L3G7minus1_UN_otherRES L3USA_sig_milRES L3ln_USA_tofgRES L3ln_G7minus1_tofgRES L3ln_LM_tofgRES L3ln_USA_tradeRES L3ln_G7minus1_tradeRES L3ln_WLD_tradeRES L2UNSC_rotate WBEB=0 EAP ECA MENA LAC SA if e(sample), equation(lnsig2u) xb se gen(x1 se1); adjust ln_LPCRES IDA SAL L3war L3ln_popRES L3ln_gdpRES L3democracy L3FHRES L3USA_UN_importantRES L3USA_UN_otherRES L3G7minus1_UN_importantRES L3G7minus1_UN_otherRES L3USA_sig_milRES L3ln_USA_tofgRES L3ln_G7minus1_tofgRES L3ln_LM_tofgRES L3ln_USA_tradeRES L3ln_G7minus1_tradeRES L3ln_WLD_tradeRES L2UNSC_rotate WBEB=1 EAP ECA MENA LAC SA if e(sample), equation(lnsig2u) xb se gen(x2 se2); gen y1=round(sqrt(exp(x1)) -sqrt(exp(x2))) if e(sample); /*round so answer is in whole days*/ gen y2=round(sqrt(exp(x1-2*se1))-sqrt(exp(x2-2*se2))) if e(sample); gen y3=round(sqrt(exp(x1+2*se1))-sqrt(exp(x2+2*se2))) if e(sample); su y1 if e(sample); scalar define z1=r(mean); su y2 if e(sample); scalar define z2=r(mean); su y3 if e(sample); scalar define z3=r(mean); display "Impact of switching from no WBEB to WBEB (in days): " z1 " with range (" z2 "," z3 ") (-/+ 2 SEs from mean prediction)"; drop x1 x2 se1 se2 y1 y2 y3; scalar drop z1 z2 z3; /*End Simulations*/ /*Demonstrating that TFE and standard SFM yield similar results for predicted preparation and in performance equation*/ /* -- last paragraph of Section 4 ==> see below in Section 5 materials */ preserve; /*********/ /*Table 1*/ /*********/ /* Descriptive Statistics for SFA */ /* This appears complex but just generates a */ /* table of descriptive stats and a list of the */ /* countries/years that account for the min and */ /* max values of each variable. */ quietly: egen x=sum(SFA_sample); quietly: scalar define nobs=x[_n]; display nobs " observations in SFM sample"; drop x; scalar drop nobs; collapse (count) countadate=adate countprojnum=projnum countln_LPC=ln_LPC countIDA=IDA countSAL=SAL countL3war=L3war countL3ln_pop=L3ln_pop countL3ln_gdp=L3ln_gdp countL3democracy=L3democracy countL3FH=L3FH countL3USA_UN_important=L3USA_UN_important countL3USA_UN_other=L3USA_UN_other countL3G7minus1_UN_important=L3G7minus1_UN_important countL3G7minus1_UN_other=L3G7minus1_UN_other countL3USA_sig_mil=L3USA_sig_mil countL3ln_USA_tofg=L3ln_USA_tofg countL3ln_G7minus1_tofg=L3ln_G7minus1_tofg countL3ln_LM_tofg=L3ln_LM_tofg countL3ln_USA_trade=L3ln_USA_trade countL3ln_G7minus1_trade=L3ln_G7minus1_trade countL3ln_WLD_trade=L3ln_WLD_trade countL2UNSC_rotate=L2UNSC_rotate countWBEB=WBEB (mean) meanadate=adate meanprojnum=projnum meanln_LPC=ln_LPC meanIDA=IDA meanSAL=SAL meanL3war=L3war meanL3ln_pop=L3ln_pop meanL3ln_gdp=L3ln_gdp meanL3democracy=L3democracy meanL3FH=L3FH meanL3USA_UN_important=L3USA_UN_important meanL3USA_UN_other=L3USA_UN_other meanL3G7minus1_UN_important=L3G7minus1_UN_important meanL3G7minus1_UN_other=L3G7minus1_UN_other meanL3USA_sig_mil=L3USA_sig_mil meanL3ln_USA_tofg=L3ln_USA_tofg meanL3ln_G7minus1_tofg=L3ln_G7minus1_tofg meanL3ln_LM_tofg=L3ln_LM_tofg meanL3ln_USA_trade=L3ln_USA_trade meanL3ln_G7minus1_trade=L3ln_G7minus1_trade meanL3ln_WLD_trade=L3ln_WLD_trade meanL2UNSC_rotate=L2UNSC_rotate meanWBEB=WBEB (sd) sdadate=adate sdprojnum=projnum sdln_LPC=ln_LPC sdIDA=IDA sdSAL=SAL sdL3war=L3war sdL3ln_pop=L3ln_pop sdL3ln_gdp=L3ln_gdp sdL3democracy=L3democracy sdL3FH=L3FH sdL3USA_UN_important=L3USA_UN_important sdL3USA_UN_other=L3USA_UN_other sdL3G7minus1_UN_important=L3G7minus1_UN_important sdL3G7minus1_UN_other=L3G7minus1_UN_other sdL3USA_sig_mil=L3USA_sig_mil sdL3ln_USA_tofg=L3ln_USA_tofg sdL3ln_G7minus1_tofg=L3ln_G7minus1_tofg sdL3ln_LM_tofg=L3ln_LM_tofg sdL3ln_USA_trade=L3ln_USA_trade sdL3ln_G7minus1_trade=L3ln_G7minus1_trade sdL3ln_WLD_trade=L3ln_WLD_trade sdL2UNSC_rotate=L2UNSC_rotate sdWBEB=WBEB (min) minadate=adate minprojnum=projnum minln_LPC=ln_LPC minIDA=IDA minSAL=SAL minL3war=L3war minL3ln_pop=L3ln_pop minL3ln_gdp=L3ln_gdp minL3democracy=L3democracy minL3FH=L3FH minL3USA_UN_important=L3USA_UN_important minL3USA_UN_other=L3USA_UN_other minL3G7minus1_UN_important=L3G7minus1_UN_important minL3G7minus1_UN_other=L3G7minus1_UN_other minL3USA_sig_mil=L3USA_sig_mil minL3ln_USA_tofg=L3ln_USA_tofg minL3ln_G7minus1_tofg=L3ln_G7minus1_tofg minL3ln_LM_tofg=L3ln_LM_tofg minL3ln_USA_trade=L3ln_USA_trade minL3ln_G7minus1_trade=L3ln_G7minus1_trade minL3ln_WLD_trade=L3ln_WLD_trade minL2UNSC_rotate=L2UNSC_rotate minWBEB=WBEB (max) maxadate=adate maxprojnum=projnum maxln_LPC=ln_LPC maxIDA=IDA maxSAL=SAL maxL3war=L3war maxL3ln_pop=L3ln_pop maxL3ln_gdp=L3ln_gdp maxL3democracy=L3democracy maxL3FH=L3FH maxL3USA_UN_important=L3USA_UN_important maxL3USA_UN_other=L3USA_UN_other maxL3G7minus1_UN_important=L3G7minus1_UN_important maxL3G7minus1_UN_other=L3G7minus1_UN_other maxL3USA_sig_mil=L3USA_sig_mil maxL3ln_USA_tofg=L3ln_USA_tofg maxL3ln_G7minus1_tofg=L3ln_G7minus1_tofg maxL3ln_LM_tofg=L3ln_LM_tofg maxL3ln_USA_trade=L3ln_USA_trade maxL3ln_G7minus1_trade=L3ln_G7minus1_trade maxL3ln_WLD_trade=L3ln_WLD_trade maxL2UNSC_rotate=L2UNSC_rotate maxWBEB=WBEB if SFA_sample, fast; gen id=1; reshape long count mean sd min max, i(id) j(var) string; gen i=2; gen Description=""; replace Description="Approval Date (Stata date format)" if var=="adate"; replace var="Approval Date" if var=="adate"; replace id=i if var=="projnum"; replace Description="World Bank Project ID" if var=="projnum"; replace var="Project Id" if var=="projnum"; replace i=i+1; replace id=i if var=="ln_LPC"; replace Description="Log of Total Project Cost in constant 2005 $ millions" if var=="ln_LPC"; replace var="Project Size" if var=="ln_LPC"; replace i=i+1; replace id=i if var=="IDA"; replace Description="IDA funds dummy" if var=="IDA"; replace var="IDA" if var=="IDA"; replace i=i+1; replace id=i if var=="SAL"; replace Description="Structural Adjustment Loan dummy" if var=="SAL"; replace var="SAL" if var=="SAL"; replace i=i+1; replace id=i if var=="L3war"; replace Description="Dummy indicating on-going major conflict (>1000 dead) t-3" if var=="L3war"; replace var="War" if var=="L3war"; replace i=i+1; replace id=i if var=="L3ln_pop"; replace Description="Log of population t-3" if var=="L3ln_pop"; replace var="Population" if var=="L3ln_pop"; replace i=i+1; replace id=i if var=="L3ln_gdp"; replace Description="PPP GDP per capita in chained 2000 $ t-3" if var=="L3ln_gdp"; replace var="GDP per capita" if var=="L3ln_gdp"; replace i=i+1; replace id=i if var=="L3democracy"; replace Description="Democracy dummy t-3" if var=="L3democracy"; replace var="Democracy" if var=="L3democracy"; replace i=i+1; replace id=i if var=="L3FH"; replace Description="Averaged Freedom House Rating t-3" if var=="L3FH"; replace var="Freedom House Index" if var=="L3FH"; replace i=i+1; replace id=i if var=="L3USA_UN_important"; replace Description="Alignment with US on UN votes important to US t-3" if var=="L3USA_UN_important"; replace var="US important votes" if var=="L3USA_UN_important"; replace i=i+1; replace id=i if var=="L3USA_UN_other"; replace Description="Alignment with US on other UN votes t-3" if var=="L3USA_UN_other"; replace var="US other votes" if var=="L3USA_UN_other"; replace i=i+1; replace id=i if var=="L3G7minus1_UN_important"; replace Description="Alignment with other G7 on UN votes important to US t-3" if var=="L3G7minus1_UN_important"; replace var="G7-1 important votes" if var=="L3G7minus1_UN_important"; replace i=i+1; replace id=i if var=="L3G7minus1_UN_other"; replace Description="Alignment with other G7 on other UN votes t-3" if var=="L3G7minus1_UN_other"; replace var="G7-1 other votes" if var=="L3G7minus1_UN_other"; replace i=i+1; replace id=i if var=="L3USA_sig_mil"; replace Description="Dummy for US military aid>0.5 (2005 $ millions) t-3" if var=="L3USA_sig_mil"; replace var="US military aid" if var=="L3USA_sig_mil"; replace i=i+1; replace id=i if var=="L3ln_USA_tofg"; replace Description="Log of disbursements of US economic aid (2005 $ millions) t-3" if var=="L3ln_USA_tofg"; replace var="US economic aid" if var=="L3ln_USA_tofg"; replace i=i+1; replace id=i if var=="L3ln_G7minus1_tofg"; replace Description="Log average disbursements of G7-1 economic aid (2005 $ millions) t-3" if var=="L3ln_G7minus1_tofg"; replace var="G7-1 aid" if var=="L3ln_G7minus1_tofg"; replace i=i+1; replace id=i if var=="L3ln_LM_tofg"; replace Description="Log average disbursements Like-minded donor aid (2005 $ millions) t-3" if var=="L3ln_LM_tofg"; replace var="Like-minded donor aid" if var=="L3ln_LM_tofg"; replace i=i+1; replace id=i if var=="L3ln_USA_trade"; replace Description="Log of US trade (imports+exports) with country (2005 $ millions) t-3" if var=="L3ln_USA_trade"; replace var="US trade" if var=="L3ln_USA_trade"; replace i=i+1; replace id=i if var=="L3ln_G7minus1_trade"; replace Description="Log of average of G7-1 (IM+EX) with country (2005 $ millions) t-3" if var=="L3ln_G7minus1_trade"; replace var="G7-1 trade" if var=="L3ln_G7minus1_trade"; replace i=i+1; replace id=i if var=="L3ln_WLD_trade"; replace Description="Log of World trade (imports+exports) with country (2005 $ millions) t-3" if var=="L3ln_WLD_trade"; replace var="World trade" if var=="L3ln_WLD_trade"; replace i=i+1; replace id=i if var=="L2UNSC_rotate"; replace Description="Indicates country holds non-permanent UNSC seat t-2" if var=="L2UNSC_rotate"; replace var="UNSC non-permanent member" if var=="L2UNSC_rotate"; replace i=i+1; replace id=i if var=="WBEB"; replace Description="Country held a World Bank ED seat in current year or past 3 years" if var=="WBEB"; replace var="World Bank Executive Director" if var=="WBEB"; sort id; rename var Variable; gen Count=count; gen Mean="0"+string(mean,"%-12.4gc") if real(string(mean,"%-12.4gc"))>0 & real(string(mean,"%-12.4gc"))<1; replace Mean="-0"+string(abs(mean),"%-12.4gc") if real(string(mean,"%-12.4gc"))>-1 & real(string(mean,"%-12.4gc"))<0; replace Mean=string(mean,"%-12.4gc") if real(string(mean,"%-12.4gc"))<=-1 | real(string(mean,"%-12.4gc"))==0 | real(string(mean,"%-12.4gc"))>=1; gen StDev="0"+string(sd,"%-12.4gc") if real(string(sd,"%-12.4gc"))>0 & real(string(sd,"%-12.4gc"))<1; replace StDev=string(sd,"%-12.4gc") if real(string(sd,"%-12.4gc"))==0 | real(string(sd,"%-12.4gc"))>=1; gen Min="0"+string(min,"%-12.4gc") if real(string(min,"%-12.4gc"))>0 & real(string(min,"%-12.4gc"))<1; replace Min="-0"+string(abs(min),"%-12.4gc") if real(string(min,"%-12.4gc"))>-1 & real(string(min,"%-12.4gc"))<0; replace Min=string(min,"%-12.4gc") if real(string(min,"%-12.4gc"))<=-1 | real(string(min,"%-12.4gc"))==0 | real(string(min,"%-12.4gc"))>=1; gen Max="0"+string(max,"%-12.4gc") if real(string(max,"%-12.4gc"))>0 & real(string(max,"%-12.4gc"))<1; replace Max="-0"+string(abs(max),"%-12.4gc") if real(string(max,"%-12.4gc"))>-1 & real(string(max,"%-12.4gc"))<0; replace Max=string(max,"%-12.4gc") if real(string(max,"%-12.4gc"))<=-1 | real(string(max,"%-12.4gc"))==0 | real(string(max,"%-12.4gc"))>=1; sort id; /*don't include Count in table (waste of a column!)*/ outsheet Variable Mean StDev Min Max Description using "Table 1.txt", nolabel noquote replace; /*End Table 1*/ restore; log close; /*List country & year associated with min & max values for each variable*/ log using "Country Year list of Allocation extremes.log", replace; display "Countries and years for min & max values in Allocation Sample"; gen type="Allocaton Min"; foreach i in adate projnum ln_LPC L3ln_pop L3ln_gdp L3FH L3USA_UN_important L3USA_UN_other L3G7minus1_UN_important L3G7minus1_UN_other L3ln_USA_tofg L3ln_G7minus1_tofg L3ln_LM_tofg L3ln_USA_trade L3ln_G7minus1_trade L3ln_WLD_trade {; quietly egen double tmp_min=min(`i') if SFA_sample; list type name year `i' if `i'==tmp_min & SFA_sample, noobs clean; quietly drop tmp_min; }; quietly replace type="Allocation Max"; foreach i in adate projnum ln_LPC L3ln_pop L3ln_gdp L3FH L3USA_UN_important L3USA_UN_other L3G7minus1_UN_important L3G7minus1_UN_other L3ln_USA_tofg L3ln_G7minus1_tofg L3ln_LM_tofg L3ln_USA_trade L3ln_G7minus1_trade L3ln_WLD_trade {; quietly egen double tmp_max=max(`i') if SFA_sample; list type name year `i' if `i'==tmp_max & SFA_sample, noobs clean; quietly drop tmp_max; }; drop type; log close; log using "Kilby JDE preparation performance.log", append; /******************************************************************************/ /* Performance Estimation (section 5 of paper) */ /******************************************************************************/ /*********/ /*Table 4*/ /*********/ /*get sample for baseline performance estimation*/ quietly: reg Outcome_last ln_LPC IDA SAL L3USA_UN_importantRES L2UNSC_rotate WBEB EAP ECA MENA LAC SA; gen performance_sample=e(sample); /*calculate sample averages for variables held constant in imputation*/ foreach i in ln_LPCRES IDA SAL L3war L3ln_popRES L3ln_gdpRES L3democracy L3FHRES L3G7minus1_UN_importantRES L3G7minus1_UN_otherRES L3USA_sig_milRES L3ln_USA_tofgRES L3ln_G7minus1_tofgRES L3ln_LM_tofgRES L3ln_USA_tradeRES L3ln_G7minus1_tradeRES L3ln_WLD_tradeRES EAP ECA MENA LAC SA {; egen mean_`i'=mean(`i') if performance_sample; }; /*generate SFM duration cofficients (from conditional variance of exponential distribution) and sample*/ frontier adate projnum if projnum>20000 & projnum<75267 & year>1993 & done, cost distribution(exp) uhet(ln_LPCRES IDA SAL L3war L3ln_popRES L3ln_gdpRES L3democracy L3FHRES L3USA_UN_importantRES L3USA_UN_otherRES L3G7minus1_UN_importantRES L3G7minus1_UN_otherRES L3USA_sig_milRES L3ln_USA_tofgRES L3ln_G7minus1_tofgRES L3ln_LM_tofgRES L3ln_USA_tradeRES L3ln_G7minus1_tradeRES L3ln_WLD_tradeRES L2UNSC_rotate WBEB EAP ECA MENA LAC SA); /*calculate imputed preparation using means EXCEPT for political economy variables*/ gen prep=sqrt(exp(_b[lnsig2u:ln_LPCRES]*mean_ln_LPCRES+_b[lnsig2u:IDA]*mean_IDA+_b[lnsig2u:SAL]*mean_SAL+_b[lnsig2u:L3war]*mean_L3war+_b[lnsig2u:L3ln_popRES]*mean_L3ln_popRES +_b[lnsig2u:L3ln_gdpRES]*mean_L3ln_gdpRES+_b[lnsig2u:L3democracy]*mean_L3democracy+_b[lnsig2u:L3FHRES]*mean_L3FHRES+_b[lnsig2u:L3USA_UN_importantRES]*L3USA_UN_importantRES +_b[lnsig2u:L3USA_UN_otherRES]*L3USA_UN_otherRES+_b[lnsig2u:L3G7minus1_UN_importantRES]*mean_L3G7minus1_UN_importantRES +_b[lnsig2u:L3G7minus1_UN_otherRES]*mean_L3G7minus1_UN_otherRES+_b[lnsig2u:L3USA_sig_milRES]*mean_L3USA_sig_milRES +_b[lnsig2u:L3ln_USA_tofgRES]*mean_L3ln_USA_tofgRES+_b[lnsig2u:L3ln_LM_tofgRES]*mean_L3ln_LM_tofgRES+_b[lnsig2u:L3ln_G7minus1_tofgRES]*mean_L3ln_G7minus1_tofgRES +_b[lnsig2u:L3ln_USA_tradeRES]*mean_L3ln_USA_tradeRES+_b[lnsig2u:L3ln_G7minus1_tradeRES]*mean_L3ln_G7minus1_tradeRES+_b[lnsig2u:L3ln_WLD_tradeRES]*mean_L3ln_WLD_tradeRES +_b[lnsig2u:L2UNSC_rotate]*L2UNSC_rotate+_b[lnsig2u:WBEB]*WBEB+_b[lnsig2u:EAP]*mean_EAP+_b[lnsig2u:ECA]*mean_ECA+_b[lnsig2u:MENA]*mean_MENA +_b[lnsig2u:LAC]*mean_LAC+_b[lnsig2u:SA]*mean_SA+_b[lnsig2u:_cons]))/365 if e(performance_sample); /*baseline specification -- report and save sample for descriptive stats*/ logit Outcome_last ln_LPC ln_pop ln_gdp growth i.year if prep<.; gen sample3=e(sample); estimates store Tab4_Col1; /*add preparation duration*/ logit Outcome_last prep ln_LPC ln_pop ln_gdp growth i.year; estimates store Tab4_Col2; /*add region dummies*/ logit Outcome_last prep ln_LPC ln_pop ln_gdp growth EAP SSA SA LAC MENA i.year; estimates store Tab4_Col3; /*conditional logit with country fixed effects*/ xtset cid; xtlogit Outcome_last prep ln_LPC ln_pop ln_gdp growth i.year, fe; estimates store Tab4_Col4; /*add geopolitical variables as exogeneity test*/ xtlogit Outcome_last prep L3USA_UN_importantRES L2UNSC_rotate WBEB ln_LPC ln_pop ln_gdp growth i.year, fe; estimates store Tab4_Col5; /*Side estimation: results still hold in this expanded specification*/ xtlogit Outcome_last prep IDA SAL SIL TA L3USA_UN_importantRES L2UNSC_rotate WBEB ln_LPC ln_pop ln_gdp growth transportation i.year, fe; /*conditional logit with government fixed effects*/ xtset L3gid2; xtlogit Outcome_last prep ln_LPC ln_pop ln_gdp growth i.year, fe; estimates store Tab4_Col6; label var Outcome_last "Outcome"; label var prep "Preparation"; label var ln_pop "Population"; label var ln_gdp "GDP per capita"; label var ln_LPC "Project Size"; label var growth "GDP growth"; esttab Tab4_Col1 Tab4_Col2 Tab4_Col3 Tab4_Col4 Tab4_Col5 Tab4_Col6 using "Table 4.txt", label title("Table 4: Impact of Preparation on Performance") nocons tab nogaps replace keep(prep ln_LPC ln_pop ln_gdp growth EAP SSA SA LAC MENA L3USA_UN_importantRES L2UNSC_rotate WBEB) order(prep ln_LPC ln_pop ln_gdp growth EAP SSA SA LAC MENA L3USA_UN_importantRES L2UNSC_rotate WBEB) starl(* .1 ** .05) addnotes("logit with year and government fixed effects"); estimates drop Tab4_Col1 Tab4_Col2 Tab4_Col3 Tab4_Col4 Tab4_Col5 Tab4_Col6; /*End Table 4*/ /*Simulations presented in paper*/ /*Run government fixed effects "manually" to get adjust and margins to evaluate at average fixed effect*/ quietly logit Outcome_last prep ln_LPC ln_pop ln_gdp growth i.year i.L3gid2 if e(sample); su prep if e(sample); local minus1SD=r(mean)-r(sd); local plus1SD=r(mean)+r(sd); local smallest=r(min); local largest=r(max); margins if e(sample), dydx(prep) atmeans noatlegend; margins if e(sample), at(prep=(`minus1SD' `plus1SD')) atmeans noatlegend; margins if e(sample), at(prep=(`smallest' `largest')) atmeans noatlegend; /*End Simulations*/ /**********/ /*Figure 2*/ /**********/ margins if e(sample), at(prep=(0.71(0.03)7.46)) atmeans noatlegend vsquish; mat b=r(b)'; /*could do this all with margins but I already have the code...*/ mat at=r(at); mat at=at[1...,"prep"]; mat se=r(V); mat se=vecdiag(cholesky(diag(vecdiag(se))))'; mat d=at,b,se; svmat d, names(d); gen ul = d2 + 1.96*d3; gen ll = d2 - 1.96*d3; /*graph of histogram doesn't show high values well -- too few observations */ /* Trick: increase # high values a little so they are visible in histogram */ gen x=_n; /*first observation in the sample is over 4000 so values below that can be changed and added for this histogram*/ gen new_prep=prep; replace new_prep=6.331988 if x>=1 & x<=4; /*originally only 2 observation like this*/ replace new_prep=7.463936 if x>=5 & x<=6; /*originally only 1 observation like this*/ gen hist_sample=e(sample) | x<=6; /*sometimes Stata messes up reading in line below -- this comment might help!*/ graph twoway (line d2 d1) (line ul d1, lcolor(gs6) lpattern(dash)) (line ll d1, lcolor(gs6) lpattern(dash)) (histogram new_prep if hist_sample, yaxis(2) fcolor(none) lcolor(black) lwidth(vthin) ylabel(none, axis(2)) ytick(none, axis(2))), yline(0) legend(off) xtitle("Preparation Duration (in years)") ytitle("P(Satisfactory Rating | Prep)") text(.74 5 "95% CI") ytitle("", axis(2)) ysc(r(2) axis(2)) ysc(r(.54 1) axis(1)); graph export "Figure 2.wmf", replace; drop d1 d2 d3 ul ll; mat drop b at se; drop new_prep x hist_sample; /*End Figure 2*/ /*********************************************************************************************************************/ /*Demonstrating that TFE and standard SFM yield similar results for predicted preparation and in performance equation*/ /* -- last paragraph of Section 4 */ /*********************************************************************************************************************/ xtset cid projnum; sfpanel adate projnum if projnum>20000 & projnum<75267 & year>1993 & done, cost model(tfe) distribution(exp) usigma(ln_LPCRES IDA SAL L3war L3ln_popRES L3ln_gdpRES L3democracy L3FHRES L3USA_UN_importantRES L3USA_UN_otherRES L3G7minus1_UN_importantRES L3G7minus1_UN_otherRES L3USA_sig_milRES L3ln_USA_tofgRES L3ln_G7minus1_tofgRES L3ln_LM_tofgRES L3ln_USA_tradeRES L3ln_G7minus1_tradeRES L3ln_WLD_tradeRES L2UNSC_rotate WBEB EAP ECA MENA LAC SA); /*calculate imputed preparation using means EXCEPT for political economy variables*/ gen prep2=sqrt(exp(_b[Usigma:ln_LPCRES]*mean_ln_LPCRES+_b[Usigma:IDA]*mean_IDA+_b[Usigma:SAL]*mean_SAL+_b[Usigma:L3war]*mean_L3war+_b[Usigma:L3ln_popRES]*mean_L3ln_popRES +_b[Usigma:L3ln_gdpRES]*mean_L3ln_gdpRES+_b[Usigma:L3democracy]*mean_L3democracy+_b[Usigma:L3FHRES]*mean_L3FHRES+_b[Usigma:L3USA_UN_importantRES]*L3USA_UN_importantRES +_b[Usigma:L3USA_UN_otherRES]*L3USA_UN_otherRES+_b[Usigma:L3G7minus1_UN_importantRES]*mean_L3G7minus1_UN_importantRES +_b[Usigma:L3G7minus1_UN_otherRES]*mean_L3G7minus1_UN_otherRES+_b[Usigma:L3USA_sig_milRES]*mean_L3USA_sig_milRES +_b[Usigma:L3ln_USA_tofgRES]*mean_L3ln_USA_tofgRES+_b[Usigma:L3ln_LM_tofgRES]*mean_L3ln_LM_tofgRES+_b[Usigma:L3ln_G7minus1_tofgRES]*mean_L3ln_G7minus1_tofgRES +_b[Usigma:L3ln_USA_tradeRES]*mean_L3ln_USA_tradeRES+_b[Usigma:L3ln_G7minus1_tradeRES]*mean_L3ln_G7minus1_tradeRES+_b[Usigma:L3ln_WLD_tradeRES]*mean_L3ln_WLD_tradeRES +_b[Usigma:L2UNSC_rotate]*L2UNSC_rotate+_b[Usigma:WBEB]*WBEB+_b[Usigma:EAP]*mean_EAP+_b[Usigma:ECA]*mean_ECA+_b[Usigma:MENA]*mean_MENA +_b[Usigma:LAC]*mean_LAC+_b[Usigma:SA]*mean_SA+_b[Usigma:_cons]))/365 if e(performance_sample); /*Demonstrate high correlation between the 2 measures of preparation*/ corr prep prep2 if sample3; /*Demonstrate that preparation coefficient (and statistical significance) are very similar with this alternative measure of preparation*/ xtlogit Outcome_last prep2 ln_LPC ln_pop ln_gdp growth i.year, fe; /*Compare with Table 4, Column 4*/ /*End comparison of TFE and SFM*/ /*******************/ /*Bootstrap CIs */ /*******************/ /*Proper Bootstrap of all specifications takes a LONG time (think days).*/ /*Below are bootstrap results reported in paper */ /* Seed is my birthday; limit iteration so program won't get hung up */ /*Bootstrap Table 4, Column 2*/ preserve; keep if SFA_sample | performance_sample; /*for bootstrap sampling*/ display "Start: `c(current_date)', `c(current_time)'"; bootstrap, reps(2000) saving(bstmp_42,replace) seed(04031963) reject(problem==1) nodrop notable: bsprog42; /*There are a few "features" of the bootstrap command that are important here. */ /* -doesn't catch estimation problems automatically so my program sets the "problem" scalar to flag this. */ /* -bootstap first runs the program without resampling then uses the sample in e(sample) as the starting sample. */ /* In the case of my program, that sample is only for the performance equation and thus loses part of the prep */ /* sample. The "nodrop" option prevents this so that bootstrap resamples from the full available sample instead */ /* -bootstrap reports the wrong sample size for the 2nd stage estimation; this is one reason I focus on percentile*/ /* confidence intervals rather than t/z statistics. */ display "End: `c(current_date)', `c(current_time)'"; estat bootstrap, percentile bc; restore; /*Bootstrap Table 4, Column 4*/ preserve; xtset cid projnum; quietly: xtlogit Outcome_last prep ln_LPC ln_pop ln_gdp growth i.year, fe iterate(1); /*just to get sample*/ keep if SFA_sample | e(sample); /*for bootstrap sampling--note that the conditional logit sample is slightly different*/ display "Start: `c(current_date)', `c(current_time)'"; xtset, clear; /*bootstrap requires for the clustered sampling to work properly*/ /*NOTE -- this can take hours to run. Using Stata 13 MP2, it took about 8 hours on my computer*/ bootstrap, reps(2000) cluster(cid) idcluster(newcid) saving(bstmp_44,replace) seed(04031963) reject(problem==1) nodrop notable: bsprog44; /*Same caveats as above. */ /*Note: if results are slightly different than in paper, I might have */ /* used a different seed (03041963 or 05041968) -- bootstrap was so slow, */ /* I did not rerun it with 2000 iterations for this final version of the do file. */ display "End: `c(current_date)', `c(current_time)'"; estat bootstrap, percentile bc; restore; /*End Bootstrap*/ /******************************************************************************/ /*Descriptive Statistics -- generates separate files */ /******************************************************************************/ /*********/ /*Table 3*/ /*********/ #delimit ; preserve; quietly: egen x=sum(sample3); quietly: scalar define nobs=x[_n]; display nobs " observations in project performance sample"; drop x; scalar drop nobs; collapse (mean) meanOutcome_last=Outcome_last meanprep=prep meanln_LPC=ln_LPC meanln_pop=ln_pop meanln_gdp=ln_gdp meangrowth=growth (sd) sdOutcome_last=Outcome_last sdprep=prep sdln_LPC=ln_LPC sdln_pop=ln_pop sdln_gdp=ln_gdp sdgrowth=growth (min) minOutcome_last=Outcome_last minprep=prep minln_LPC=ln_LPC minln_pop=ln_pop minln_gdp=ln_gdp mingrowth=growth (max) maxOutcome_last=Outcome_last maxprep=prep maxln_LPC=ln_LPC maxln_pop=ln_pop maxln_gdp=ln_gdp maxgrowth=growth if sample3, fast; gen id=1; reshape long mean sd min max, i(id) j(var) string; gen i=2; gen Description=""; replace Description="IEG overall project performance rating" if var=="Outcome_last"; replace var="Outcome" if var=="Outcome_last"; replace id=i if var=="prep"; replace Description="Estimated duration of World Bank project preparation in years" if var=="prep"; replace var="Preparation" if var=="prep"; replace i=i+1; replace id=i if var=="ln_LPC"; replace Description="Log of Total Project Cost in constant 2005 $ millions" if var=="ln_LPC"; replace var="Project Size" if var=="ln_LPC"; replace i=i+1; replace id=i if var=="ln_pop"; replace Description="Log of Population" if var=="ln_pop"; replace var="Population" if var=="ln_pop"; replace i=i+1; replace id=i if var=="ln_gdp"; replace Description="PPP GDP per capita in chained 2000 $" if var=="ln_gdp"; replace var="GDP per capita" if var=="ln_gdp"; replace i=i+1; replace id=i if var=="growth"; replace Description="Real growth rate of GDP per capita" if var=="growth"; replace var="GDP growth" if var=="growth"; sort id; rename var Variable; gen Mean="0"+string(mean,"%-12.4gc") if real(string(mean,"%-12.4gc"))>0 & real(string(mean,"%-12.4gc"))<1; replace Mean="-0"+string(abs(mean),"%-12.4gc") if real(string(mean,"%-12.4gc"))>-1 & real(string(mean,"%-12.4gc"))<0; replace Mean=string(mean,"%-12.4gc") if real(string(mean,"%-12.4gc"))<=-1 | real(string(mean,"%-12.4gc"))==0 | real(string(mean,"%-12.4gc"))>=1; gen StDev="0"+string(sd,"%-12.4gc") if real(string(sd,"%-12.4gc"))>0 & real(string(sd,"%-12.4gc"))<1; replace StDev=string(sd,"%-12.4gc") if real(string(sd,"%-12.4gc"))==0 | real(string(sd,"%-12.4gc"))>=1; gen Min="0"+string(min,"%-12.4gc") if real(string(min,"%-12.4gc"))>0 & real(string(min,"%-12.4gc"))<1; replace Min="-0"+string(abs(min),"%-12.4gc") if real(string(min,"%-12.4gc"))>-1 & real(string(min,"%-12.4gc"))<0; replace Min=string(min,"%-12.4gc") if real(string(min,"%-12.4gc"))<=-1 | real(string(min,"%-12.4gc"))==0 | real(string(min,"%-12.4gc"))>=1; gen Max="0"+string(max,"%-12.4gc") if real(string(max,"%-12.4gc"))>0 & real(string(max,"%-12.4gc"))<1; replace Max="-0"+string(abs(max),"%-12.4gc") if real(string(max,"%-12.4gc"))>-1 & real(string(max,"%-12.4gc"))<0; replace Max=string(max,"%-12.4gc") if real(string(max,"%-12.4gc"))<=-1 | real(string(max,"%-12.4gc"))==0 | real(string(max,"%-12.4gc"))>=1; sort id; outsheet Variable Mean StDev Min Max Description using "Table 3.txt", nolabel noquote replace; /*End Table 3*/ restore; log close; /*List country & year associated with min & max values for each variable*/ preserve; log using "Country Year list of performance extremes.log", replace; gen type="Performance Min"; display "Countries and years for min & max values in Allocation Sample"; foreach i in ln_LPC ln_pop ln_gdp growth prep {; quietly egen double tmp_min=min(`i') if sample3; list type name year `i' if `i'==tmp_min & sample3, noobs clean; quietly drop tmp_min; }; quietly replace type="Performance Max"; foreach i in ln_LPC ln_pop ln_gdp growth prep {; quietly egen double tmp_max=max(`i') if sample3; list type name year `i' if `i'==tmp_max & sample3, noobs clean; quietly drop tmp_max; }; log close; log using "Kilby JDE preparation performance.log", append; restore; /*************************************/ /*Alternate specifications -- Table 5*/ /*************************************/ gen prep_debt=prep*debt_service; gen prep_short=prep*short_debt; gen IEG_EvalLag_last=(IEG_EvalDate_last-closing_date)/365 if (IEG_EvalDate_last>closing_date); /*lag between closing and last rating*/ xtset L3gid2 projnum; /*Table 5, Column 1*/ xtlogit Outcome_last prep ln_LPC ln_pop ln_gdp growth audit_last i.year, fe; estimates store Tab5_Col1; su audit_last if e(sample), meanonly; /*Gives % of sample where audit rating is used*/ /*Table 5, Column 2*/ xtlogit Outcome_last prep ln_LPC ln_pop ln_gdp growth IEG_EvalLag_last i.year, fe; estimates store Tab5_Col2; su IEG_EvalLag_last if e(sample), meanonly; /*Gives sample information on evaluation lag*/ /*Table 5, Column 3*/ xtlogit Outcome_last prep ln_LPC ln_pop ln_gdp growth audit_last IEG_EvalLag_last i.year, fe; estimates store Tab5_Col3; su IEG_EvalLag_last if e(sample) & audit_last==0, meanonly; local reglag=r(mean); su IEG_EvalLag_last if e(sample) & audit_last==1, meanonly; local audlag=r(mean); /*Run dummy variable fixed effects to get margins to evaluate at average fixed effect*/ logit Outcome_last prep ln_LPC ln_pop ln_gdp growth audit_last IEG_EvalLag_last i.year i.L3gid2 if e(sample); margins if e(sample), at(audit_last = (0 1)) atmeans noatlegend; margins if e(sample), at(IEG_EvalLag_last =(`reglag' `audlag')) atmeans noatlegend; /*Table 5, Column 4*/ xtlogit Outcome_last prep ln_LPC ln_pop ln_gdp growth IDA i.year, fe; estimates store Tab5_Col4; /*Run dummy variable fixed effects to get margins to evaluate at average fixed effect*/ logit Outcome_last prep ln_LPC ln_pop ln_gdp growth IDA i.year i.L3gid2 if e(sample); margins if e(sample), at(IDA = (0 1)) atmeans noatlegend; /*Table 5, Column 5*/ xtlogit Outcome_last prep ln_LPC ln_pop ln_gdp growth SAL i.year, fe; estimates store Tab5_Col5; /*Run dummy variable fixed effects to get margins to evaluate at average fixed effect*/ logit Outcome_last prep ln_LPC ln_pop ln_gdp growth SAL i.year i.L3gid2 if e(sample); margins if e(sample), at(SAL = (0 1)) atmeans noatlegend; /*Table 5, Column 6*/ xtlogit Outcome_last prep ln_LPC ln_pop ln_gdp growth energy_mining transportation other i.year, fe; estimates store Tab5_Col6; label var audit_last "Audit Rating"; label var IEG_EvalLag_last "Evaluation Lag"; label var energy_mining "Energy/Mining Sector"; label var transportation "Transportation Sector"; label var other "Other Sectors"; esttab Tab5_Col1 Tab5_Col2 Tab5_Col3 Tab5_Col4 Tab5_Col5 Tab5_Col6 using "Table 5.txt", label title("Table 5: Alternate Specifications") nocons tab nogaps replace keep(prep ln_LPC ln_pop ln_gdp growth audit_last IEG_EvalLag_last IDA SAL energy_mining transportation other) starl(* .1 ** .05) addnotes("Conditional logit with year and government fixed effects"); estimates drop Tab5_Col1 Tab5_Col2 Tab5_Col3 Tab5_Col4 Tab5_Col5 Tab5_Col6; /*End Table 5*/ /*****************************************/ /*Vulnerability specifications -- Table 6*/ /*****************************************/ xtlogit Outcome_last prep ln_LPC ln_pop ln_gdp growth short_debt i.year, fe; estimates store Tab6_Col1; xtlogit Outcome_last prep ln_LPC ln_pop ln_gdp growth short_debt prep_short i.year, fe; estimates store Tab6_Col2; xtlogit Outcome_last prep ln_LPC ln_pop ln_gdp growth debt_service i.year, fe; estimates store Tab6_Col3; xtlogit Outcome_last prep ln_LPC ln_pop ln_gdp growth debt_service prep_debt i.year, fe; estimates store Tab6_Col4; label var short_debt "% Short Term Debt"; label var prep_short " × Prep"; label var debt_service "Debt Service/GNI"; label var prep_debt " × Prep"; esttab Tab6_Col1 Tab6_Col2 Tab6_Col3 Tab6_Col4 using "Table 6.txt", label title("Table 6: Economic Vulnerability") nocons tab nogaps replace keep(prep ln_LPC ln_pop ln_gdp growth short_debt prep_short debt_service prep_debt) starl(* .1 ** .05) addnotes("Conditional logit with year and government fixed effects"); estimates drop Tab6_Col1 Tab6_Col2 Tab6_Col3 Tab6_Col4; /*End Table 6*/ /**********/ /*Figure 3*/ /**********/ quietly xtlogit Outcome_last c.prep##c.short_debt ln_LPC ln_pop ln_gdp growth i.year, fe; margins, dydx(prep) at(short_debt=(0(.3)89)) atmeans noatlegend vsquish predict(xb); mat b=r(b)'; mat at=r(at); mat at=at[1...,"short_debt"]; mat se=r(V); mat se=vecdiag(cholesky(diag(vecdiag(se))))'; mat d=at,b,se; svmat d, names(d); gen ul = d2 + 1.96*d3; gen ll = d2 - 1.96*d3; /*sometimes messes up reading in line below -- this comment might help!*/ graph twoway (line d2 d1) (line ul d1, lcolor(gs6) lpattern(dash)) (line ll d1, lcolor(gs6) lpattern(dash)) (histogram short_debt if e(sample), yaxis(2) fcolor(none) lcolor(black) lwidth(vthin) ylabel(none, axis(2)) ytick(none, axis(2))), yline(0) legend(off) xtitle("% Short term debt") ytitle("Marignal effect of Prep") text(.3 90 "95% CI") xsca(titlegap(4)) ysca(titlegap(2)) ytitle("", axis(2)) ysc(r(-.0055 .1) axis(2)) legend(off) yline(0) ylabel(,labsize(5)) xlabel(,labsize(5)); graph export "Figure 3.wmf", replace; drop d1 d2 d3 ul ll; mat drop b at se; /*End Figure 3*/ /*Run dummy variable fixed effects to get margins to evaluate at average fixed effect*/ quietly logit Outcome_last prep short_debt prep_short ln_LPC ln_pop ln_gdp growth i.year i.L3gid2 if e(sample); su prep if e(sample); local lo_prep=r(mean)-r(sd); local hi_prep=r(mean)+r(sd); su short_debt if e(sample); local lo_short=r(mean)-r(sd); local hi_short=r(mean)+r(sd); local lo_prep_lo_short=`lo_prep'*`lo_short'; local hi_prep_lo_short=`hi_prep'*`lo_short'; local lo_prep_hi_short=`lo_prep'*`hi_short'; local hi_prep_hi_short=`hi_prep'*`hi_short'; margins if e(sample), at(prep=`lo_prep' short_debt=`lo_short' prep_short=`lo_prep_lo_short') atmeans noatlegend; margins if e(sample), at(prep=`hi_prep' short_debt=`lo_short' prep_short=`hi_prep_lo_short') atmeans noatlegend; margins if e(sample), at(prep=`lo_prep' short_debt=`hi_short' prep_short=`lo_prep_hi_short') atmeans noatlegend; margins if e(sample), at(prep=`hi_prep' short_debt=`hi_short' prep_short=`hi_prep_hi_short') atmeans noatlegend; /* NOTE: results not driven by outliers in short_debt*/ xtlogit Outcome_last c.prep##c.short_debt ln_LPC ln_pop ln_gdp growth i.year if short_debt<30, fe; /**********/ /*Figure 4*/ /**********/ quietly xtlogit Outcome_last c.prep##c.debt_service ln_LPC ln_pop ln_gdp growth i.year, fe; margins, dydx(prep) at(debt_service=(0(.5)108)) atmeans noatlegend vsquish predict(xb); mat b=r(b)'; mat at=r(at); mat at=at[1...,"debt_service"]; mat se=r(V); mat se=vecdiag(cholesky(diag(vecdiag(se))))'; mat d=at,b,se; svmat d, names(d); gen ul = d2 + 1.96*d3; gen ll = d2 - 1.96*d3; /*graph of histogram doesn't show high values well -- too few observations */ /* Trick: increase # high values a little so they are visible in histogram */ gen x=_n; /*first observation in the sample is over 4000 so values below that can be changed and added for this histogram*/ gen new_debt_service=debt_service; replace new_debt_service=36.17 if x>=1 & x<=2; /*originally only 1 observation like this*/ replace new_debt_service=45.73 if x>=3 & x<=4; /*originally only 1 observation like this*/ replace new_debt_service=80.76 if x>=5 & x<=12; /*originally only 4 observations like this*/ replace new_debt_service=107.3 if x>=13 & x<=16; /*originally only 2 observations like this*/ gen hist_sample=e(sample) | x<=16; /*sometimes Stata messes up reading in line below -- this comment might help!*/ graph twoway (line d2 d1) (line ul d1, lcolor(gs6) lpattern(dash)) (line ll d1, lcolor(gs6) lpattern(dash)) (histogram new_debt_service if hist_sample, yaxis(2) fcolor(none) lcolor(black) lwidth(vthin) ylabel(none, axis(2)) ytick(none, axis(2))),legend(off) xtitle("Debt service as % of GNI") ytitle("Marignal effect of Prep") text(.5 90 "95% CI") xsca(titlegap(4)) ysca(titlegap(2)) ytitle("", axis(2)) ysc(r(-.0055 .2) axis(2)) legend(off) yline(0) ylabel(,labsize(5)) xlabel(,labsize(5)); graph export "Figure 4.wmf", replace; drop d1 d2 d3 ul ll; mat drop b at se; drop new_debt_service x hist_sample; /*End Figure 4*/ /*Simulations presented in text*/ /*Run dummy variable fixed effects to get margins to evaluate at average fixed effect*/ quietly logit Outcome_last prep debt_service prep_debt ln_LPC ln_pop ln_gdp growth i.year i.L3gid2 if e(sample); su prep if e(sample); local lo_prep=r(mean)-r(sd); local hi_prep=r(mean)+r(sd); su debt_service if e(sample); local lo_service=r(mean)-r(sd); local hi_service=r(mean)+r(sd); local lo_prep_lo_service=`lo_prep'*`lo_service'; local hi_prep_lo_service=`hi_prep'*`lo_service'; local lo_prep_hi_service=`lo_prep'*`hi_service'; local hi_prep_hi_service=`hi_prep'*`hi_service'; margins if e(sample), at(prep=`lo_prep' debt_service=`lo_service' prep_debt=`lo_prep_lo_service') atmeans noatlegend; margins if e(sample), at(prep=`hi_prep' debt_service=`lo_service' prep_debt=`hi_prep_lo_service') atmeans noatlegend; margins if e(sample), at(prep=`lo_prep' debt_service=`hi_service' prep_debt=`lo_prep_hi_service') atmeans noatlegend; margins if e(sample), at(prep=`hi_prep' debt_service=`hi_service' prep_debt=`hi_prep_hi_service') atmeans noatlegend; /*End simulations*/ /*NOTE: results not driven by outliers in debt_service*/ xtlogit Outcome_last c.prep##c.debt_service ln_LPC ln_pop ln_gdp growth i.year if debt_service<15, fe; log close;