Replication files: IBRD Lending as a Tool to Avoid Future Debt Crises in IDA Countries (draft, Sept 2026, v8)

01_data.py       Builds country panel: IMF LIC-DSA ratings (30 Sep 2025) + IMF WEO April 2026.
                 Needs the WEO April 2026 bulk CSV (IMF.RES:WEO 9.0.0) saved as data/weo2026.csv
                 (or set the WEO_CSV environment variable to its path). Not re-run for v4; the
                 shipped data/panel.csv and data/dsa.csv already include the v4 corrections below.
02_headroom.py   RSDL headroom, sensitivity grid, savings, PV/debt-service comparison, IBRD capital.
                 v4: computes TWO universes. The primary universe is the 30 countries whose latest
                 Atlas GNI per capita is below IDA's $1,365 operational cutoff (UNDER_1365);
                 outputs use no suffix (headroom_base.csv, results_headroom.json, etc). v8: UNDER_1365
                 is further restricted to IDA-only countries (blend == 0), dropping Nigeria (the one
                 blend country below the threshold) -- see "Changes from v7" below -- so the primary
                 universe is now 29 countries (19 eligible for this backward-looking test, of which
                 Mali is still the only one with positive headroom; unaffected numerically, since
                 Nigeria had zero headroom here anyway). The
                 robustness universe is the full 78-country IDA-eligible list; outputs use a
                 "_robust" suffix. data/panel.csv and data/dsa.csv were corrected first: Moldova
                 removed (graduated from IDA in FY2020, despite remaining on the IMF's PRGT-eligible
                 list this project's country list was built from); Guyana, Sri Lanka, Kosovo and
                 Syria added (current IDA borrowers the original 75-country list missed). Only
                 Guyana has usable WEO data and enters the calculations. dsa.csv also carries each
                 country's Atlas GNI per capita and under_threshold flag (World Bank API,
                 NY.GNP.PCAP.CD, checked Oct 2026).
06_stresstest.py Introduced in v4, extended in v5, REWRITTEN in v7. This is the paper's CENTRAL
                 analysis (Section 4.1). v7 changes the basis of the calculation after the user
                 flagged that Table 1 looked wrong: the replaceable amount is now private_share x
                 RSDL (a country's sustainable external-debt capacity, lambda x its
                 capacity-based threshold x GDP), not private_share x current/haircut debt capped
                 at RSDL. The counterfactual is forward-looking: absent this proposal, a country's
                 debt would on average rebuild toward its RSDL in the same official/private mix
                 observed for its country group today; IBRD's offer is to take up the private share
                 of that capacity instead, driving it toward zero. This removes the old
                 per-country debt-relief-haircut step entirely (it was a calculation device, not a
                 substantive mechanism) and makes the total scale exactly in proportion to lambda
                 (previously it barely moved, since the old current-debt-anchored total rarely hit
                 the RSDL cap). It also means a country's current debt data is no longer needed to
                 size its figure, so South Sudan (missing current-debt data, previously excluded)
                 is now included, taking the primary universe from 27 to 28 countries and the
                 robustness universe from 69 to 74.
                 v7 also moves from a single uniform private-creditor share to two
                 group-specific ones, after checking (at the user's request) whether IDR 2025's 37%
                 -- a blended average across the full 78-country IDA-eligible list -- is a
                 reasonable number specifically for under-threshold countries. It is not: that
                 average is pulled up by large blend/gap borrowers with deep bond-market access
                 (Bangladesh, Nigeria, Pakistan, Uzbekistan, Kenya among the most active 2024
                 Eurobond/syndicated-loan issuers in the full IDA-eligible list), and the one
                 country-group-specific figure IDR 2025 discloses -- IDA-only South Asian countries
                 excluding India: 76.5% official, i.e. 23.5% private -- is well below 37%. v7 uses
                 PRIVATE_SHARE_PRIMARY = 25% (rounding that one data point up slightly, flagged in
                 Section 4.1 and Section 6 as a rougher estimate) for the primary universe, and
                 keeps PRIVATE_SHARE_ROBUST = 37% for the robustness universe, which is exactly
                 IDR 2025's own universe definition. Private non-guaranteed (PNG) debt is excluded
                 throughout -- it is private corporate debt (e.g. Mozambique's LNG project
                 financing), not sovereign debt. build(lam, private_share) runs for both
                 lambda=0.8 (unsuffixed outputs, e.g. stresstest.csv) and lambda=0.9 (suffixed
                 _lam09), for both universes (4 output files, plus matching
                 results_stresstest*.json). Needs data/ids_dppg.json and data/country_iso3.csv
                 (both shipped; dppg is now used only for the current-debt/RSDL comparison in
                 Table 2/A4 and the in_distress/debt_above_rsdl context columns, not for sizing
                 the central refinance_bn figure). v8: the primary-universe summarize() call now
                 also filters on blend == 0 (IDA-only), dropping Nigeria -- see "Changes from v7"
                 below -- which takes the primary universe from 28 to 27 countries and the total
                 from $82.4bn/$92.7bn to $59.1bn/$66.5bn (lambda=0.8/0.9); the robustness universe
                 (74 countries, $360.2bn/$405.3bn) is unaffected, since Nigeria is still part of the
                 full IDA-eligible list.
08_table1_rows.py    NEW in v7 (the ad hoc version used in v5/v6 is no longer accurate after the
                 v7 formula change). Builds table1_v5_rows.json and tableA3_v5_rows.json from
                 06_stresstest.py's lambda=0.8/0.9 output pairs. Run after 06_stresstest.py and
                 before 07_savings_table.py.
07_savings_table.py  NEW in v6, numbers updated in v7 after 06_stresstest.py's formula change
                 (unchanged itself -- it reads whatever 06_stresstest.py produced). Builds Table 2
                 (main text, primary universe) and Table A4 (Appendix, robustness universe): each
                 country's current external PPG debt/GDP against its RSDL/GDP (both at
                 lambda=0.8), and the annual interest-service saving from swapping the
                 private-creditor share for IBRD debt, using the same IBRD-vs-Eurobond rate
                 differential (4.43 percentage points) as 02_headroom.py and Section 4.3. Outputs
                 data/savings_table.csv, data/savings_table_robust.csv, table2_v5_rows.json and
                 tableA4_v5_rows.json. Aggregate savings (v7): ~$3.6bn/yr (primary, 28 countries),
                 ~$16.0bn/yr (robustness, 74 countries); 8/28 and 22/74 countries respectively
                 currently have external PPG debt above their own RSDL, even before any formal
                 distress rating.
03_backtest.py   Distress-onset coding (entries marked [v] need verification), ROC/AUC, logit, episode table.
                 Unaffected by the v4 universe change (the backtest validates the RSDL signal
                 against history, independent of which countries are "eligible" today). Still
                 excludes the 7 MAC-SRDSF countries (see MAC) and adds lead_min/lead_max/n_caught.
04_seniority.py  Recovery-waterfall model of junior repricing. Unaffected by v4; B_LOGIT is read
                 from results_backtest.json.
05_figures.py    Rewritten in v5. Main-text figures: fig1.png (NEW -- central post-relief stress
                 test, primary universe, top 15 of 27, lambda=0.8), fig2.png (debt paths into
                 distress), fig3.png (ROC), fig4.png (seniority/repricing). Appendix figures:
                 figA1.png (headroom-today test, two-panel primary/robustness -- this was the old
                 Figure 1), figA2.png (sensitivity of the headroom-today test, two-panel -- old
                 Figure 2), figA3.png (NEW -- central stress test, robustness universe, top 15 of
                 69, lambda=0.8). The main-text figures therefore now lead with the paper's central
                 result instead of the backward-looking eligibility test.
build_paper.js   Builds the Word document (docx-js). STALE since v4 -- it was not updated for the
                 v4 or v5 restructuring, because this environment has no Node.js to test a rebuild
                 against. The shipped .docx was instead hand-edited directly (patch_v4_*.py and
                 patch_v5_*.py, below); it is the source of truth, not build_paper.js. Bringing
                 build_paper.js back in sync remains the main outstanding item.
patch_v4_*.py    The four scripts that carried the v3 .docx to v4: prose substitutions (summary,
                 Sections 3.1/3.3/4.1/4.2/4.5/4.6), the Table 1 / Table 1b split, Section 4.7 +
                 Table 6 + Figure 6, and the Design-implications bullet. Superseded by patch_v5_*.py
                 below but kept as a record of what changed and how.
patch_v5_summary.py     Rewrote the Summary to lead with the post-relief private-debt-replacement
                 framing (both lambda=0.8 and 0.9), with the backward-looking eligibility test and
                 the full-IDA-list robustness check demoted to secondary bullets pointing at the
                 new Appendix.
patch_v5_section4.py   Captured (for deletion) the old Table 1b, Table 2 (by-rating), and the
                 associated two-panel Figures 1/2 images from the then-current Section 4.1, then
                 rewrote the surviving prose into a brief new Section 4.2 ("How much additional
                 headroom exists today?"). The captured elements were not reused directly; the
                 Appendix tables/figures were instead rebuilt from the underlying CSV/JSON by
                 patch_v5_appendix.py.
patch_v5_section4b.py  Renumbered old Sections 4.1-4.6 to 4.2-4.7, then deleted the old Section 4.7
                 ("A stress test: refinancing private creditors") block entirely -- its content was
                 replaced by a freshly written new Section 4.1 (see below) with updated lambda=0.9
                 results, not reused verbatim.
patch_v5_newsection41.py  Inserted the new, central Section 4.1 ("Replacing private debt after debt
                 relief") at the front of Section 4, with the full 27-country primary-universe
                 Table 1 (both lambda=0.8 and 0.9 columns, from table1_v5_rows.json) and Figure 1.
patch_v5_appendix.py   Added a new Appendix ("Robustness: the full IDA-eligible list"), before the
                 References, with two subsections: A.1 (Table A3 / Figure A3, the central stress
                 test for the full IDA-eligible list) and A.2 (Table A1 / Figure A1, the
                 headroom-today test for the full list; Table A2, the same by LIC-DSF risk rating;
                 Figure A2, its sensitivity; and the debt-carrying-capacity verification narrative
                 previously captured, then discarded, by patch_v5_section4.py). Data for the new
                 tables comes from tableA1_v5_rows.json, tableA2_v5_rows.json and
                 tableA3_v5_rows.json (all derived from the data/*_robust.csv files already
                 produced by 02_headroom.py and 06_stresstest.py).
                 Together, the patch_v5_*.py scripts also fixed every cross-section reference
                 (e.g. "Section 4.1" -> "Section 4.2") made stale by the renumbering, and rewrote
                 the "Target the right countries" design-implications bullet (Section 5), which had
                 claimed the mechanism does nothing for under-threshold countries -- true only of
                 the old backward-looking eligibility test, not of the new central (post-relief)
                 result.
                 Expect to re-run extract_blocks.py and build_pdf.py (in paper_pdf/) after any of
                 the patch_v5_*.py scripts; paper_pdf/build_pdf.py's FIG_FILES list and its
                 generic (not just 11-column) total-row shading were updated in v5 to match.
patch_v6_table2.py     Added new Table 2 ("RSDL versus current debt, and interest-service savings
                 from swapping private creditors for IBRD debt", primary universe) to Section 4.1,
                 right after Figure 1, using 07_savings_table.py's table2_v5_rows.json. Also
                 renumbered the old Table 2 (headroom-today eligibility test) through Table 5
                 (seniority) up by one, to Table 3 through Table 6, and fixed every inline
                 "(Table N)"/"(Table N, Figure M)" cross-reference accordingly, including two
                 pre-existing figure-number bugs this surfaced: Section 4.4's AUC sentence cited
                 "(Figure 4)" for the ROC chart, which is actually Figure 3; Section 4.5 cited
                 "(Table 5, Figure 5)" for the seniority model, whose figure was renumbered to
                 Figure 4 in v5 but never updated inline. Also rewrote Section 4.3's aggregate
                 savings sentence, which had been computed off the old (pre-v5) "central headroom"
                 wording -- a stale reference to the small backward-looking-eligibility-test
                 headroom ($0.05bn/$3.9bn), not the actual central post-relief swap -- to report the
                 correct $3.7bn (primary) / $11.0bn (robustness) figures from Table 2 / Table A4.
patch_v6_tableA4.py    Added a new Appendix subsection A.3 ("RSDL versus current debt, full
                 IDA-eligible list") with Table A4, the robustness-universe counterpart of Table 2,
                 using tableA4_v5_rows.json. Placed after A.2, before References, so as not to
                 disturb the existing A1/A2/A3 table lettering (which is cross-referenced from the
                 main text in several places).

patch_v7_rsdl_basis.py  Rewrote Section 4.1's methodology paragraph, results paragraph, Table 1
                 sourcing note, Table 2 narrative, the post-relief equity/risk paragraph, Section
                 4.3's aggregate-savings sentence, the "Target the right countries" design bullet,
                 the Appendix A.1 intro, Table A3/A4 captions and notes, the Limitations bullet on
                 the creditor-split proxy, and five Summary bullets (scale, debt relief's role,
                 lambda-sensitivity -- which flips direction in v7 -- savings per dollar, and risk
                 to IBRD), to match 06_stresstest.py's v7 formula change and the new 25%/37%
                 private-share split. Pure prose; does not touch table cell contents.
patch_v7_tables.py    Rebuilds Table 1, Table 2, Table A3 and Table A4's actual cell contents from
                 table1_v5_rows.json / table2_v5_rows.json / tableA3_v5_rows.json /
                 tableA4_v5_rows.json, by deleting and re-inserting each table in place (needed
                 because the surrounding-prose patch scripts don't touch table cell contents, and
                 Table 1/2's row count keeps changing as the primary-universe country list changes).
                 Table indices are hardcoded (0, 1, 6, 9) and asserted against the expected header
                 before any edit. Re-used as-is in v8 after the IDA-only restriction (below); just
                 re-run it after regenerating the row JSONs. Re-run 05_figures.py, extract_blocks.py
                 and build_pdf.py afterwards.
patch_v8_ida_only.py  Rewrote Section 3.3's universe definitions, the Section 4.2 Nigeria-liquidity
                 illustration (moved to describe the robustness universe only), Section 4.1/4.3's
                 results and savings paragraphs, the Design-implications bullet, the Limitations DCC
                 bullet, the Appendix A.1 intro and Table A4 narrative, and four Summary bullets, to
                 match 02_headroom.py/06_stresstest.py's v8 IDA-only restriction. Also restructured
                 Section 4.7 ("Risk and cost to IBRD") so it states the central scenario's equity
                 and expected-loss numbers directly instead of only the backward-looking
                 eligibility-test ones with a forward reference -- the previous structure read as
                 if an ~$80bn lending scenario needed only $0.2bn of equity, which is what the user
                 flagged. Two more stale references (a Summary bullet and the Appendix A.1 intro
                 still describing Nigeria as part of the primary universe) were fixed by hand
                 afterwards; a final whole-document grep for "of 20 ", "28 countr" etc. is worth
                 re-running after any similar universe-definition change.

09a_build_risk_inputs.py  NEW (Oct 2026), first step of the IBRD portfolio-risk analysis. Joins the
                 IDA universe, RSDLs, IBRD/IDA loans by country (FY25), sovereign ratings, region,
                 commodity dependence and engagement status into data/risk_inputs_country.csv (136
                 countries: 78 IDA-eligible + 58 other IBRD borrowers). New IBRD exposure is 25% of
                 each country's RSDL ($59.1bn primary, $243.4bn robustness). Raw downloads, URLs and
                 extraction checks are listed in data/raw/SOURCES.md.
09b_entry_ratings.py  NEW (Oct 2026). Estimates each IDA-eligible country's sovereign rating at the
                 point the proposal starts to operate for it (not in default, external debt at its
                 RSDL). Fits a cross-country rating regression (141 rated sovereigns) and predicts the
                 entry state with and without the IBRD swap. Rated countries are anchored on their
                 actual rating plus the modelled change; unrated countries use the model level.
                 Outputs data/entry_ratings.csv, data/rating_model_coefs.csv and
                 data/results_entry_ratings.json. Run after 09a. Also applies the governance screen
                 (GOV_FLOOR = -1.7): columns screen_arrears / screen_paused / screen_governance /
                 screen_credit, screened_out_by and eligible. The portfolio-risk central case uses
                 eligible == True.
09_portfolio_risk.py  NEW (Oct 2026). What the proposal does to IBRD's portfolio risk (for the Section
                 4.7 rewrite). Existing IBRD book by country + new lending (25% of RSDL, screened
                 countries only in the central case). MDB default probabilities from a log-linear fit to
                 GEMs 10-year cumulative rates (back-tested: 0.25% borrower-average on today's book vs
                 IBRD's observed 0.32% for 2001-23); IBRD historical LGD (9.6% mean, 36.9% p95);
                 one-factor Gaussian copula (rho 0.10 central, 0.25 stress, estimated by MLE from IBRD,
                 GEMs and BoC-BoE default series); 400k Monte Carlo draws, 1- and 3-year horizons. S&P
                 RAC proxy calibrated to reproduce S&P's FY25 40.1% exactly; E/L, Moody's-style WABR and
                 mitigant sizing. Nine scenarios. Outputs data/portfolio_risk_scenarios.csv,
                 data/portfolio_risk_countries.csv, data/results_portfolio_risk.json. Run after 09a, 09b.
09c_figure5.py   NEW (Oct 2026). Figure 5 (Section 4.7): S&P RAC and equity-to-loans by scenario
                 against their 23% / 18% limits. Reads data/results_portfolio_risk.json.
patch_v10_cap_and_risk.py  NEW (Oct 2026). Makes 25% of the RSDL a design CAP on IBRD lending in both
                 universes, justified in Section 4.6 by the incentive it creates on its own (at
                 lambda = 0.8 the IBRD stake equals the RSDL-to-threshold buffer: 0.25 x 0.8 = 0.2).
                 Rewrites Section 4.7 around 09b/09 (new Table 7 and Figure 5), adds Appendix A.4 and
                 Table A5, and updates the Summary, Sections 1, 3.1, 3.3, 4.1, 4.3, 4.6, 5 and 6,
                 Appendix A.1/A.3, the Annex and References. Reads every number from the results files
                 and asserts the rounded ones. Order to rebuild from the v9 document
                 (IBRD_Lending_IDA_Debt_Crises_Extended.v9.bak.docx): 06, 08, 07, 05, 09a, 09b, 09, 09c,
                 patch_v7_tables.py, then patch_v10, then paper_pdf/extract_blocks.py and build_pdf.py
                 (build_pdf.py's FIG_FILES now includes fig5.png after fig4.png).
                 NOTE: after v10, Table 7 sits at table index 6, so patch_v7_tables.py's hardcoded
                 indices (0, 1, 6, 9) are valid only on the v9 document; on the v10 document Tables A3
                 and A4 are at indices 7 and 10.
06_stresstest.py (v10 change): IBRD_CAP = 0.25 now sizes both universes; the 25%/37% private shares
                 are kept as context only, and private_remaining_bn reports what the cap leaves with
                 private creditors (robustness: $117bn at lambda = 0.8). Robustness totals are now
                 $243.4bn / $273.8bn (lambda 0.8 / 0.9), was $360.2bn / $405.3bn.
patch_v9_governance_screen.py  NEW (Oct 2026). Adds "Add a governance screen" to Section 5 (after
                 "Target the right countries"): eligibility also requires (a) no WBG arrears,
                 (b) normal World Bank engagement (no OP 7.30 pause), (c) WGI average >= -1.7 and
                 (d) IBRD credit rating at entry no worse than CCC-. Removes 7 primary-universe
                 countries ($15bn of $59bn), leaving $44bn across 20 countries at about B-. Reads its
                 numbers from data/results_entry_ratings.json and asserts them. Backs up the v8
                 .docx as IBRD_Lending_IDA_Debt_Crises_Extended.v8.bak.docx. Re-run
                 paper_pdf/extract_blocks.py and build_pdf.py afterwards (with PYTHONIOENCODING=utf-8
                 on Windows consoles).

10_relief_needed.py  NEW (Oct 2026, v11). How much debt relief, from current levels, each country would
                 need to become eligible -- i.e. to get at or below its RSDL. Headline = the larger of
                 (a) external PPG debt (IDS, end-2024) above the external RSDL and (b) general government
                 gross debt (WEO 2025) above the total-debt RSDL, nominal, against 2025 GDP. Reported
                 alongside: the liquidity test (not in the headline, since the proxy compares total interest
                 with an external debt-service threshold), the same test after the IBRD swap, a 2026-31
                 WEO-path variant, PV (pi = 0.8) and lambda = 0.9. External relief is also expressed as a
                 haircut on non-multilateral external PPG debt (IDS DT.DOD.MLAT.ZS x total external debt;
                 IMF credit not separated). NO_DATA countries are assessed on the external test only, as in
                 02_headroom.py. Run after 06_stresstest.py and 09b_entry_ratings.py. Outputs
                 data/relief_needed{,_lam09,_robust,_robust_lam09}.csv, data/results_relief.json,
                 table_relief_rows.json, tableA6_relief_rows.json and figures/figA4.png. Primary universe,
                 lambda = 0.8: 21 of 27 countries need relief, $117bn ($60bn excluding Sudan), of which only
                 $18bn is external; robustness universe: 45 of 74, $362bn.
patch_v11_relief.py  NEW (Oct 2026). Adds Section 4.3 ("How much debt relief would eligibility
                 require?") with Table 4, Appendix A.5 with Table A6 and Figure A4, a rewritten Summary
                 bullet (replacing "Debt relief matters for three countries specifically", which the new
                 numbers contradict), a fifth Section 1 question, a Section 5 bullet ("Calibrate relief to
                 the RSDL, not the threshold"), a Section 6 bullet and an Annex row. Renumbers old Sections
                 4.3-4.7 to 4.4-4.8 and Tables 4-7 to 5-8 everywhere (figures are not renumbered; the new
                 figure is A4). Also fixes the Annex's stale "sensitivity in Figure 2" (now Appendix Figure
                 A2). Backs up the v10 document as IBRD_Lending_IDA_Debt_Crises_Extended.v10.bak.docx and
                 always patches from that backup, so it can be re-run. Then re-run paper_pdf/extract_blocks.py
                 and build_pdf.py (FIG_FILES now ends with figA4.png).
                 NOTE: after v11 the old hardcoded table indices in patch_v7_tables.py / patch_v10 are stale
                 again (Table 4 is inserted at index 3; Table A6 after Table A5).

patch_v12_reconcile.py  NEW (Oct 2026). Reconciles the text with the code, after building the v11
                 replication package surfaced figures that predated the v2 backtest-sample fix: 923
                 country-years / 59 countries (was 940 / 60, Sections 3.4, 4.5 and Summary); interest/
                 revenue AUC 0.70 (was 0.71); calm years flagged 40% (was 39%); Table 7 rebuilt from
                 data/seniority.csv (implied PD fall 13.5/19.5%, was 13.6/19.7; last share 27%, was 28%);
                 Section 4.6 "around 13.5 percent" and "27–48 percent" (were 14 and 30–55); Summary
                 break-even "1.5–4.5 percent" and "a quarter to a half" (were 2–4 and a third to a half).
                 Backs up v11 as IBRD_Lending_IDA_Debt_Crises_Extended.v11.bak.docx.

All scripts resolve data/figures paths relative to their own location (a `data/` and `figures/`
subfolder next to the script). Run 01-08 in order from this directory (08_table1_rows.py before
07_savings_table.py), then the patch_v7_*.py / patch_v8_*.py scripts; 02-08 will work directly off
the data/ folder as shipped even without re-running 01 (which needs the WEO source file).

Key assumptions: see Annex table in the paper (now also includes the $1,365 GNI threshold and the
25%/37% official/private splits used in the central analysis).

Changes from v7 (this patch, v8): two fixes prompted by user review. (1) Restricted the primary
universe to IDA-only countries below the $1,365 threshold, dropping Nigeria (the one blend country
under it) -- consistent with the v7 finding that 25% is specifically an IDA-only private-share
estimate, which Nigeria's deeper bond-market access does not represent. Primary universe: 27
countries (was 28), total $59.1bn/$66.5bn at lambda=0.8/0.9 (was $82.4bn/$92.7bn); new leaders
Ethiopia ($8.7bn), Tanzania ($7.0bn), Myanmar ($6.6bn). Equity needed is now almost exactly in line
with IBRD's current base (about $61bn vs $60bn, previously 1.1x); expected losses about $22m/yr
(GEMs) to $2.1bn/yr (harsh case), down from $31m-$3.0bn. The robustness universe (74 countries,
$360.2bn/$405.3bn) is unchanged, since Nigeria remains part of the full IDA-eligible list. (2)
Restructured Section 4.7 to state the central scenario's equity and loss numbers directly, after a
user flagged that reading "$0.2 billion of equity -- immaterial" in that section, with no central
scenario numbers stated nearby, looked wrong next to an ~$80bn lending scenario; the $0.2bn figure
was correct but belonged to the small backward-looking eligibility test (Section 4.2), not the
central analysis, which Section 4.7 had previously only gestured at via a forward reference to
Section 4.1 rather than restating.

Changes from v6 (v7): changed the central analysis's basis from private_share x
current/haircut debt (capped at RSDL) to private_share x RSDL itself -- see 06_stresstest.py's
module docstring for the full reasoning -- after the user flagged that Table 1 looked wrong and
asked us to check whether IDR 2025's uniform 37% private-creditor share was reasonable specifically
for under-threshold countries. It was not: we found no official global figure for the under-$1,365
group specifically, but IDR 2025 does disclose that IDA-only South Asian countries (excluding
India) were 76.5% official-creditor-financed (23.5% private) in 2024, well below the 37% blended
average for the full 78-country IDA-eligible list, consistent with private bond/syndicated-loan
market access being concentrated in larger blend/gap borrowers. v7 therefore uses 25% for the
primary universe and keeps 37% (IDR 2025's own figure) for the robustness universe. Combined with
the RSDL-basis change, the central total is now $82.4bn (lambda=0.8) to $92.7bn (lambda=0.9) for
the primary universe (28 countries, up from 27 -- South Sudan is now includable since the new
formula no longer needs current-debt data to size a country) and $360.2bn to $405.3bn for the
robustness universe (74 countries, up from 69); the result now scales exactly in proportion to
lambda, a reversal of the v5/v6 finding that it was insensitive to lambda. New Table 1/Table 2
figures: Nigeria $23.2bn, Ethiopia $8.7bn, Tanzania $7.0bn (lambda=0.8).

Changes from v5 (v6): added new Table 2 (main text) and Table A4 (Appendix), comparing
each country's current external PPG debt/GDP to its RSDL/GDP and estimating the annual
interest-service saving from swapping private-creditor debt for IBRD debt under the RSDL
(superseded by the v7 numbers above). This also surfaced and fixed three
pre-existing errors: a stale savings sentence in Section 4.3 that was computed off the small
backward-looking eligibility-test headroom rather than the actual central post-relief swap, and two
inline figure-number references (Sections 4.4 and 4.5) left over from the v5 figure renumbering.

Changes from v4: reframed the paper around a single question -- after the debt
relief now underway or recently completed, how much of a country's private debt could IBRD
realistically replace without pushing it back over its own RSDL -- and made that the central
analysis (new Section 4.1, Table 1, Figure 1), reported at both lambda=0.8 and lambda=0.9 for the
primary (under-$1,365-threshold) universe: $84.5bn and $85.1bn respectively, almost entirely
unaffected by lambda because the RSDL ceiling rarely binds once debt relief has happened. The old
backward-looking eligibility test (previously the paper's lead result) is demoted to a short
Section 4.2, kept mainly to show how little conventional headroom the primary universe has today
(only Mali, ~$1.1bn) -- part of the case for a post-relief, debt-replacing mechanism rather than a
new-money one. All full-IDA-list (robustness) results, for both the central analysis and the
eligibility test, moved to a new Appendix (Tables A1-A3, Figures A1-A3). Section numbering within
Section 4 shifted throughout (4.1=central post-relief result, 4.2=headroom today, 4.3=savings,
4.4=backtest, 4.5=seniority, 4.6=incentives, 4.7=risk and cost to IBRD).

Changes from v3: switched the paper's primary result from "all IDA-eligible countries"
to "countries under IDA's own $1,365 Atlas-GNI graduation threshold" (30 countries; only Mali has
positive headroom, ~$1.1bn), with the full 78-country IDA-eligible list reported throughout as a
named robustness check (~$87bn, driven entirely by countries already above the threshold); added a
new private-creditor-refinancing stress test (Section 4.7, Table 6, Figure 6) for both universes;
and the universe correction (Moldova out; Guyana, Sri Lanka, Kosovo, Syria in) that made the
robustness totals $82bn -> $87bn along the way.

Changes from v2 (Oct 2026 patch): corrected 6 debt-carrying-capacity misclassifications (Chad,
Haiti, Burundi, Timor-Leste: medium -> weak; Tajikistan, Nicaragua: medium -> strong) against
each country's latest published DSA; fixed a backtest sample-contamination bug (MAC-SRDSF
countries, above); fixed one data-entry error in the Table 4 episode data (Congo, Rep. breached
the RSDL in 2009, 8 years before its 2017 crisis, not 2015/2 years as previously shown, which had
driven an incorrect "two to five years" claim in the text); replaced several hardcoded prose
figures with computed ones; corrected a risk-rating transcription error (27 moderate/7 low, not
26/8); and disclosed that Pakistan, Somalia and Zambia drop out of the headroom table for lack of
a usable WEO projection, not by design.
