This project applies chemometric and machine learning techniques to predict soil properties from mid-infrared (MIR) spectroscopy collected in Bungoma County, Kenya.
# Digital Soil Spectroscopy for Soil Health Assessment
## Overview
This repository demonstrates an end-to-end workflow for analyzing soil spectroscopy data using statistical and machine learning techniques. The project uses Mid-Infrared (MIR) spectra, laboratory reference measurements, and Portable X-Ray Fluorescence (pXRF) data collected from soil samples in Bungoma County, Kenya.
The objective is to evaluate the potential of digital soil spectroscopy for predicting soil properties and supporting soil health assessment.
---
## Key Results
- Processed MIR spectral data from 140 soil samples.
- Developed PLS regression models for four soil properties.
- Achieved the strongest predictive performance for Acidified Nitrogen (R² = 0.822, RPD = 2.38).
- Applied spectral preprocessing, PCA, cross-validation, and independent test-set evaluation.
- Generated reproducible visualizations and model-performance reports using R.
## Objectives
- Import and clean soil spectroscopy datasets
- Explore laboratory reference data
- Perform spectral preprocessing
- Conduct Principal Component Analysis (PCA)
- Develop Partial Least Squares (PLS) regression models
- Compare PLS with Random Forest models
- Assess model performance using independent validation datasets
- Visualize spectral patterns and prediction accuracy
---
## Study Area
Bungoma County, Kenya
---
## Data Sources
The project integrates multiple datasets:
- MIR spectral data
- Laboratory reference soil properties
- Carbon and Nitrogen (CN) measurements
- Portable X-Ray Fluorescence (pXRF) data
- Calibration datasets
- Validation datasets
*Raw datasets are not included in this repository where they are subject to data ownership or confidentiality restrictions.*
---
## Project Workflow
1. Data Import
2. Data Cleaning
3. Exploratory Data Analysis
4. Spectral Preprocessing
5. Principal Component Analysis
6. Partial Least Squares Regression
7. Random Forest Modelling
8. Model Validation
9. Result …