End‑to‑end reproducible pipeline for subnational maize yield forecasting in Nigeria using Earth observation and machine learning (Random Forest, LOYO, SHAP).
# Maize Yield Forecasting Pipeline for Nigeria
### Earth Observation + Machine Learning · Fully Reproducible
This repository contains the complete, end-to-end computational pipeline described in the paper:
> **Operational Value of Earth Observation and Reanalysis Predictors for Subnational Maize Yield Forecasting in Nigeria**
> *Taiwo Adedeji Michael, Adeyeye Daniel Oludayo, Oladeji Qudus Olamide, and Olaniyi Bolaji Samuel*
> Preprint available at Operational Value of Earth…
---
## What this repo does
This pipeline builds a **19-year state-level panel** (2004–2022) for Nigeria by merging:
- **HarvestStat Africa** – subnational maize yield statistics
- **MODIS NDVI (MOD13A3)** – cropland-masked phenology
- **CHIRPS** – dekadal rainfall
- **ERA5-Land** – growing-season air temperature
- **MODIS LST (MOD11A2)** – daytime land surface temperature
- **SoilGrids 2.0** – static soil properties
A **Random Forest** model is evaluated under strict **Leave-One-Year-Out (LOYO)** cross-validation with a **predictor-block ablation** design. The ablation quantifies the marginal predictive value of each data stream, with a particular focus on whether MODIS LST adds any operational skill beyond ERA5-Land air temperature.
**Key findings:**
- MODIS LST added **negligible** forecast skill (ΔRMSE = 0.001 t ha⁻¹), explained by high collinearity with ERA5-Land (r = 0.89).
- A simple persistence baseline (prior-year yield) **outperformed** the full EO-only model.
- The best EO-only model (NDVI + CHIRPS + ERA5) achieved RMSE = 0.475 t ha⁻¹, MAPE = 29.4%.
- Adding soil properties and a lagged yield term reduced RMSE to 0.407 t ha⁻¹, MAPE = 22.6%.
- Forecast skill varied sharply across agro-ecological zones and was structurally bounded by yield variability.
---
## Repository structure
```bash
.
├── data/ # input CSVs (yield, NDVI, rainfall, temperature, LST, soil)
├── results/ # all generated tables and CSVs
├── figures/ …