An end-to-end data analysis of the distance between getting children into school and getting them through it in Sub-Saharan Africa — enrollment vs completion, gender parity, learning poverty, and an honest backtest of whether machine learning forecasts completion rates better than the two simplest baselines imaginable. Built on the World Bank Open Data API (UNESCO Institute for Statistics indicators), 1990–2024.
Why it matters: the school-access battle in Sub-Saharan Africa has largely been won — gross primary enrollment is near-universal. But enrollment is a promise, not a result. The result is a child who finishes primary school able to read. This project measures how far the region still is from that result, where the distance is shrinking, and where "progress" in the enrollment statistics quietly stopped translating into completed educations.
1. Enrollment surged; completion crawled — and the gap is wider than in 1990. Sub-Saharan Africa's gross primary enrollment rose from 71% (1990) to 97% (2024), but primary completion went only from 53% to 69%. The region-level enrollment–completion gap grew from 18 to 28 percentage points. The world's gap is 14 pp, half of SSA's, and world completion (88%) is where SSA enrollment was two decades ago.
2. In the median SSA country, roughly a quarter of the enrollment boom never becomes a completed primary education. Across the 42 countries with recent data (2015–2024), the median enrollment–completion gap is 24 pp. The largest gaps combine mass enrollment with mass repetition and dropout: Rwanda enrolls at 150% gross but completes at 67% (gap 83 pp), Madagascar 133% vs 61% (gap 72 pp), Malawi 139% vs 70% (gap 69 pp). Gross ratios above 100% are themselves a symptom — they count over-age repeaters, so part of each gap is children cycling through grades rather than leaving (see Limitations).
3. The gap is closing in most countries — but not everywhere, and slowly. OLS trends over 2000–2024 show the gap narrowing in 29 of 42 countries (20 statistically significant at p<0.05) and widening in 13 (5 significant: Central African Republic at +2.1 pp/yr, DR Congo, Guinea, Namibia, The Gambia). Median completion progress is +0.95 pp/yr; at that pace the median still-below-90% country needs ~21 more years to reach 90% primary completion — around 2045, not 2030. Six countries have falling completion rates, including Nigeria (−1.3 pp/yr) and significant declines in Zimbabwe and Mauritius.
4. The gender story has flipped. SSA's completion gender parity index climbed from 0.81 in 1990 to 0.98 in 2024 — near parity at the regional level. At country level the frontier has moved past parity: in 24 of 42 countries boys now complete primary school at lower rates than girls (GPI > 1), most extremely in Senegal (GPI 1.40). Girls remain far behind mainly where completion is lowest overall: Central African Republic (GPI 0.68) and Chad (0.77).
5. Completing school is not the same as learning. In the latest learning-poverty assessments (23 SSA countries), the median share of 10-year-olds unable to read a simple text is 82%. The scatter against completion is the sobering part: Kenya completes primary school at 102% (gross) yet has 79% learning poverty (2023); South Africa 95% and 82%; Togo 91% and 82%. High completion is compatible with very low learning — which is why the completion gap understates the education gap.
6. The forecasting result: the last observed value beat both the linear trend and the ML model. Backtesting on data frozen at 2015 and scored on 2016–2024 observations (207 test points, 38 SSA countries), mean absolute error was 7.7 pp for persistence (carry the last value forward), 9.1 pp for gradient boosting with covariates, and 13.8 pp for the linear trend. Extrapolating momentum is the worst thing you can do with these series — countries like Sierra Leone (declining to 2015, then +42 pp by 2022) and Benin (rising to 2015, then reversing) break trends routinely. Under the "if 2000s trends continue" linear scenario, only 12 of 37 countries reach ≥90% completion by 2030 (8 are already there today) — and the backtest says even that is likely too generous a reading of trends.
| Task | Forecast country-level primary completion rate 1–9 years ahead |
| Models | (a) persistence: last observed value; (b) per-country OLS linear trend on trailing 15 years; (c) pooled HistGradientBoostingRegressor on country level, 10-year slope, enrollment, gender parity, education spending (% GDP), log GDP per capita, and horizon — trained on 15,487 origin/horizon pairs from 181 countries worldwide |
| Evaluation | Temporal backtest: all training targets ≤ 2015, test on SSA observations 2016–2024, identical test set for all three models |
| Result | Persistence MAE 7.7 pp (best in 24/38 countries) < GBM 9.1 pp (best in 9) < linear 13.8 pp (best in 5). The ordering holds at almost every horizon; the GBM beats persistence only at horizon 3 |
| Reading | The GBM did learn something — it beats the linear trend at every horizon, largely by learning to damp trends toward persistence. But it cannot beat the naive baseline it is imitating. UIS completion series contain revisions, gaps and genuine trend breaks (policy shifts, conflict, fee abolition), so recent level carries nearly all the usable signal and recent slope is actively misleading at long horizons |
| Intended use | Honest uncertainty framing for 2030 projections — not country-level point predictions. Fig 6b's linear scenario is a "what if trends continue" illustration, shown precisely because the backtest quantifies how much to distrust it |
- Source: World Bank Open Data API
(education indicators originate from the UNESCO Institute for
Statistics). 12 indicators, 1990–2024, downloaded by
src/fetch_data.py; raw responses, exact URLs and license notes indata/raw/. - Coverage: 217 countries (48 Sub-Saharan African) plus regional
aggregates, which the API mixes in with countries — they are separated
using the API's country metadata (aggregates carry
region.id == "NA") and kept in a separate table for regional comparisons. - Key indicators: primary completion rate (total/female/male), gross and net primary enrollment, gender parity index, learning poverty (SE.LPV.PRIM — sparse, used cross-sectionally only), education spending (% GDP) and GDP per capita as forecast covariates.
| Step | Choice | Rationale |
|---|---|---|
| Gap metric | Gross enrollment − completion rate, pp | The two most widely reported through-the-system measures; both "gross", so the difference is not distorted by one-sided over-age adjustment (caveat below) |
| Country vs aggregate split | API country metadata (region.id == "NA" flags aggregates) |
Verified empirically; treating "Sub-Saharan Africa" as a country would double count every SSA observation |
| Trends | Per-country OLS on 2000–2024, ≥8 observations, with p-values | Slope in pp/yr is directly interpretable; p-values separate movement from noise in short, gappy series |
| Snapshot rule | Latest observation, but only if ≥2015 | Prevents a 2003 data point from being presented as "where a country stands today" |
| Backtest | Train ≤2015 / test 2016–2024, identical test set for all models | Out-of-sample, out-of-time comparison is the only honest way to rank forecasters; in-sample fit would flatter the GBM |
| ML model | HistGradientBoostingRegressor, pooled across all countries |
Handles missing covariates natively; pooling gives the ML its best shot with far more training data than SSA alone |
| Learning poverty | Cross-sectional cut only | Assessment rounds, not annual series — a "trend" would be an artifact of changing country composition |
- Gross rates exceed 100%. Both enrollment and completion count over-age and repeating pupils, so the enrollment–completion gap mixes true dropout with repetition and late entry (Sierra Leone's 162% gross enrollment is the clearest example). It measures system inefficiency broadly, not dropout narrowly.
- The completion rate is a proxy. SE.PRM.CMPT.ZS is technically the gross intake ratio to the last primary grade — children can reach the last grade without mastering anything (see finding 5), and the indicator can exceed 100%.
- UIS reporting gaps are severe. Kenya has 5 completion observations since 2000; Somalia has none. Countries missing from figures are missing because of data, not because they lack a gap. Region aggregates also embed World Bank imputations.
- Trend breaks dominate. The backtest shows per-country linear trends mislead more than they inform at 5+ year horizons. Every forward-looking number here should be read with fig 6a's error curves next to it.
- Learning poverty is sparse and dated. Latest values range from 2006 (Mauritius) to 2023; cross-country comparison mixes assessment years and instruments.
- No causal claims. Everything here is descriptive; covariates in the GBM are predictive features, not policy estimates.
git clone https://github.com/CollinsAnyona/african-learning-poverty.git
cd african-learning-poverty
pip install -r requirements.txt
python run_all.py # runs offline from cached data/raw; ~2 minutesrun_all.py skips the download step when data/raw/ is populated (the
raw CSVs ship with the repo). To refetch from the live API:
python src/fetch_data.py --force.
├── data/
│ ├── raw/ # World Bank API responses + SOURCE.md
│ └── processed/ # analysis outputs (CSV)
├── src/
│ ├── config.py # paths, indicator codes, constants
│ ├── fetch_data.py # API download (the only networked step)
│ ├── prepare_data.py # country/aggregate split, wide panel
│ ├── gap_metrics.py # gap, gender parity, learning poverty cuts
│ ├── trends.py # per-country OLS trends with significance
│ ├── forecast_comparison.py # backtest: persistence vs linear vs GBM
│ └── make_figures.py # all charts
├── figures/ # generated PNGs
└── run_all.py # one-command pipeline
- Add lower-secondary completion (SE.SEC.CMPT.LO.ZS) to trace the gap one level up the system.
- Interrupted time-series around school-fee abolition dates to test whether fee removal drives the enrollment–completion divergence.
- Quantile regression forests for calibrated forecast intervals instead of point comparisons.
- Join UIS out-of-school microdata to split the gap into dropout vs repetition components.
Code: MIT. Data: World Bank Open Data / UNESCO Institute for Statistics,
CC BY-4.0 — details in data/raw/SOURCE.md.





