Skip to content
Review Open access

Environmental and household factors associated with depressive symptoms in rural Kilifi County, Kenya: a machine learning analysis

Sep 2026 · Frontiers in Public Health · Vol 14 · 0 citations · 40 references
Medicine

Abstract

Background Depression is a leading global cause of disability, that disproportionately affects populations in low-resource settings in sub-Saharan Africa, where poverty, limited healthcare, and environmental stressors such as climate variability, poor water and sanitation, and household air pollution compound vulnerability. In Kilifi County, Kenya, recurrent droughts and economic insecurity amplify these challenges, yet the associations between environmental exposures and mental health impacts remain poorly characterized. This study applies machine learning models to examine how climate perceptions, water and sanitation access, and household air pollution proxies are associated with depressive symptoms in Kilifi County. Methodology This cross-sectional study analyzed primary household survey data collected from July to December 2021 within the Kaloleni/Rabai Community Health and Demographic Surveillance System. Structured surveys captured demographics, mental health status via the Patient Health Questionnaire-9 (PHQ-9), and environmental exposures, including climate perceptions, agricultural stressors, water and sanitation access, and air pollution proxies. Depression was defined as PHQ-9 ≥ 10. Thirty-one variables were grouped into environmental perceptions, climate impacts, air pollution proxies, and water/sanitation categories. Random Forest and XGBoost models were trained in Python using 80/20 household-grouped train-test split (GroupShuffleSplit) to prevent data leakage, with 10-fold stratified group cross-validation. Class imbalance was addressed using balanced class weights (Random Forest) and scale_pos_weight (XGBoost). Model performance was assessed using accuracy, balanced accuracy, ROC-AUC, PR-AUC, sensitivity, specificity, precision, recall, F1-scores, and Brier scores with bootstrap 95% confidence intervals. Feature contributions were evaluated using Gini importance, gain and SHAP values. Results Among 17,738 participants (median age 41.0 [IQR 31.0–54.0], 77.8% female), 14.9% (n = 2,635) screened positive for depression (PHQ-9 ≥ 10). XGBoost outperformed Random Forest across all metrics: 0.802 (95% CI: 0.788–0.815) versus 0.796 (95% CI: 0.782–0.808), ROC-AUC 0.845 (95% CI, 0.826–0.862) versus 0.823 (95% CI, 0.804–0.841), balanced accuracy 0.753 versus 0.738, and sensitivity 0.684 versus 0.657. Both models showed moderate precision for depression-positive cases (XGBoost 0.40, Random Forest 0.38) reflecting the precision-sensitivity trade-off inherent in class-imbalance handling. Key predictors across Gini importance, gain and SHAP analyses included drinking water source, heat-related health risks, drought exposure, home thermal discomfort and cooking with open fire highlighting the convergence of water/sanitation, climate, and household air quality factors. Conclusion Environmental and household exposures are consistently associated with depression in rural Kilifi County. Machine learning identified water and sanitation conditions, climate variability perceptions, and household energy practices as leading predictors. Integrating environmental and climate-sensitive indicators into community health workflows, alongside interventions such as clean cookstoves, water access and climate-resilient agriculture, could reduce depression burden and enhance precision public health for climate-vulnerable communities. Longitudinal studies with refined exposure measurement are needed to clarify the temporal and causal nature of these associations.

Read PDF

We use cookies to run the site and, with your consent, for analytics and to show ads. See our Cookie Policy.