Replication in R

R code that regenerates the numbers this paper reports, starting from the dataset published on this site. It reproduces 33 of 39. The 6 it does not produce are listed below.

Run it

Rscript run.R

run.R is the whole package. Save it and run it: it reads the dataset from this site if the CSV is not sitting beside it, and loads the shared conventions file the same way, so it works on its own in an empty directory. It needs R with fixest, and depending on the paper lme4, metafor, plm, BMS or LowRankQP. It writes results.json, one value per number, each named for where it appears in the paper.

How it compares with Stata

Most of these papers were estimated in Stata, and the two programs differ in places that change printed digits. Those conventions are stated once, in stata_compat.R, and shared by every replication on this site: ivreg2's large-sample variance, SSC winsor's order statistics, xtreg's treatment of singleton groups, and the restricted-ML default of xtmixed, which is not the default of the mixed command that replaced it.

Numbers this code does not produce

cellpaperthis code
HEADLINE_ivmethod_FE_implied_elasticity4not computed
HEADLINE_ivmethod_IV_implied_elasticity4not computed
HEADLINE_developing_FE_implied_elasticity2.5not computed
HEADLINE_developing_IV_implied_elasticity2.5not computed
HEADLINE_developed_FE_implied_elasticity4not computed
HEADLINE_developed_IV_implied_elasticity4not computed

This number is not produced here. The paper's '4' and '2.5' are rounded verbal summaries of Bayesian model averaging results (Table 5's 3.7, 95% CI 2 to 20), which the wrappers in stata_compat.R cannot fit. The numbers shown are the FE and IV implied elasticities on the same subsample, which bracket the paper's figure but are a different estimator. Abstract/Sec.I: 'the elasticity of substitution around 4' (Panel B, IV-method primary studies). FE and IV are the only two of Table 1's five estimators with a stata_compat.R wrapper; their implied elasticities (-1/effect_coef) bracket the stated 4 from above.

This number is not produced here. The paper's '4' and '2.5' are rounded verbal summaries of Bayesian model averaging results (Table 5's 3.7, 95% CI 2 to 20), which the wrappers in stata_compat.R cannot fit. The numbers shown are the FE and IV implied elasticities on the same subsample, which bracket the paper's figure but are a different estimator. Same claim as above; brackets 4 from below. The paper's precise '4' (and Table 5's 3.7, 95% CI 2-20) is a Bayesian-model-averaging combination over 24 moderators with no stata_compat.R wrapper, not independently reproducible; these two bracketing numbers are the closest evidence obtainable from the allowed toolkit.

This number is not produced here. The paper's '4' and '2.5' are rounded verbal summaries of Bayesian model averaging results (Table 5's 3.7, 95% CI 2 to 20), which the wrappers in stata_compat.R cannot fit. The numbers shown are the FE and IV implied elasticities on the same subsample, which bracket the paper's figure but are a different estimator. Sec.III: 'developing countries (around 2.5)' (online appendix table C3-C5, developing_country==1 & inverted_estimate==1 subsample). Matches closely: 2.87.

This number is not produced here. The paper's '4' and '2.5' are rounded verbal summaries of Bayesian model averaging results (Table 5's 3.7, 95% CI 2 to 20), which the wrappers in stata_compat.R cannot fit. The numbers shown are the FE and IV implied elasticities on the same subsample, which bracket the paper's figure but are a different estimator. Same claim; IV column gives 2.19, also close to the stated 'around 2.5'.

This number is not produced here. The paper's '4' and '2.5' are rounded verbal summaries of Bayesian model averaging results (Table 5's 3.7, 95% CI 2 to 20), which the wrappers in stata_compat.R cannot fit. The numbers shown are the FE and IV implied elasticities on the same subsample, which bracket the paper's figure but are a different estimator. Sec.III: 'developed countries (above 4)'. The FE corrected inverse elasticity for this subsample is statistically indistinguishable from zero (t=0.22), so -1/coefficient is large in magnitude but its sign is not meaningful, reported as an honest miss on the point value, though a near-zero corrected inverse elasticity is qualitatively consistent with 'a large elasticity'.

This number is not produced here. The paper's '4' and '2.5' are rounded verbal summaries of Bayesian model averaging results (Table 5's 3.7, 95% CI 2 to 20), which the wrappers in stata_compat.R cannot fit. The numbers shown are the FE and IV implied elasticities on the same subsample, which bracket the paper's figure but are a different estimator. Same claim, IV column; also not statistically distinguishable from zero (t=1.00) and first-stage F=8.7 signals a weak instrument for this subsample, reported as an honest miss on the point value, same qualitative caveat as the FE column.

Files