Frontiers in public health
Environmental and household factors associated with depressive symptoms in rural Kilifi County, Kenya: a machine learning analysis
By Andrew J, Njoroge A, Andai D and 2 others.
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.





