Logo Lanfrica

shadowhgni/farm_size_analysis

Domaine:

agriculturegeospatial

Type de record:

dataset
Créateur:
sha
Hôte:
Variation in smallholder farm size across Sub Saharan Africa # 🌍 Farm Size Prediction Across Sub-Saharan Africa **Random Forest and Quantile Regression Forest models to predict farm size distributions and number of farms across Sub-Saharan Africa** *Trained on ~180,000 LSMS farm surveys from 16 countries · Applied continent-wide at ~10 km resolution* --- ## 📋 Overview This project develops machine learning models to characterize the spatial distribution of smallholder farm sizes across Sub-Saharan Africa. Starting from harmonized LSMS household survey data, the pipeline builds Random Forest (RF) and Quantile Regression Forest (QRF) models that predict the full empirical distribution of farm sizes — not just the mean — in every 10×10 km grid cell across the continent. | | | |---|---| | 📐 **Spatial resolution** | 10 × 10 km grid cells | | 🗺️ **Spatial extent** | Sub-Saharan Africa (continent-wide) | | 🌾 **Training data** | ~180,000 farms · 16 countries · LSMS surveys | | 🤖 **Models** | Random Forest · Quantile RF · ExtraTrees | | 📦 **Languages** | R (statistical modelling, figures) · Python (ML pipeline) | --- ## 🚀 Quick Start ### Option 1 — Run Locally with Synthetic Data The test suite uses synthetic stubs: randomly generated data that mimic the structure of real inputs. This verifies that the entire pipeline runs correctly without requiring real survey or spatial data. > ⚠️ Synthetic results are **not scientifically meaningful**. Use real data (Option 3) to reproduce the paper's findings. ```r # Clone and enter the scripts directory git clone github.com cd farm_size_analysis/scripts # Generate synthetic stubs and run the full pipeline (~7 min) Rscript 00.4_run_all_tests.R ``` ### Option 2 — Run with GitHub Actions (No Local Setup) 1. **Fork** this repository 2. Navigate to **Actions** → **Test R Scripts** → **Run workflow** 3. The pipeline runs automatically on every push to `main` The workflow uses synthetic stub data — no downloads needed. ### Option 3 — …