Logo Lanfrica

shadowhgni/farm_size_analysis

Domain:

agriculturegeospatial

Record type:

dataset
Creator:
sha
Host:
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 β€” …