Code and data for "Structural Dynamics and Predictive Performance of Agricultural Production in Sub-Saharan Africa" - ARIMA-GARCH, XGBoost, and structural break analysis for agricultural forecasting under data constraints
# Agricultural Forecasting in Sub-Saharan Africa
**Structural Dynamics and Predictive Performance of Agricultural Production in Sub-Saharan Africa: A Robust Forecasting Approach Under Data Quality Constraints**
This repository contains the full reproducible codebase for a methodological framework that performs robust agricultural production forecasting in data-constrained environments. The framework combines rigorous quality control, structural break detection, and formal model comparison to deliver reliable forecasts for food security planning in Sub-Saharan Africa.
The study uses national agricultural production data (1961–2024) from the FAOSTAT database for five Southern African countries (Angola, Democratic Republic of Congo, Malawi, Mozambique, Zambia) and six crops (maize, cassava, beans, sweet potato, soybean, coffee).
## Methods
- **Data quality control** with explicit inclusion/exclusion criteria: minimum 20 observations, maximum 3-year gaps, MAPE 19 approved, 73% approval rate).
- **ARIMA(-GARCH)** and **XGBoost** forecasting models with expanding-window validation.
- **Bai-Perron structural break detection** integrated as a diagnostic and model-augmentation tool.
- **Diebold-Mariano tests** for formal model comparison and selection (XGBoost selected only where statistically superior, e.g., Angola Maize, p = 0.0127).
## Repository structure
```
.
├── data/
│ ├── agricultural_production_data.xlsx # FAOSTAT-based dataset (1961-2024)
│ └── final_results.csv # Model results (MAPE, DM p-values, projections)
├── notebooks/
│ ├── 01_agricultural_forecasting_analysis.ipynb # Main analysis (quality control, ARIMA/XGBoost, breaks, DM)
│ ├── 03_artigo_producao_agricola_artigo_revisto.ipynb # Internationalized (English) analysis release
│ ├── 04_graficos_de_diagnosticos.ipynb # Diagnostic plots (residuals, DM, validation)
│ └── 05_artigo_cientifico_scientific_african.ipynb # Graph extractor for LaTeX
└── figures/
└ …