
What if a short household survey could flag where depression is most likely to cluster, using nothing more than questions about the water people drink, the stove they cook on and how hot their home feels? A team at Aga Khan University (AKU) in Nairobi tested exactly that idea in rural Kenya, and the results are a useful lesson in both the promise and the limits of machine learning for public health.
In a paper published in Frontiers in Public Health on 23 September 2026, researchers trained two popular algorithms on survey answers from 17,738 adults in Kilifi County. The models picked out depression screening status with an ROC-AUC of 0.845. Even more interesting than the score is what the models leaned on: drinking water source, heat discomfort, drought and open-fire cooking.
The study at a glance
- Paper: “Environmental and household factors associated with depressive symptoms in rural Kilifi County, Kenya: a machine learning analysis”
- Journal and date: Frontiers in Public Health, Environmental Health and Exposome section, published 23 September 2026 (open access, CC BY)
- DOI: https://doi.org/10.3389/fpubh.2026.1826112
- AKU team: John Andrew, Ashley Njoroge, David Andai, Edna Bosire and Jasmit Shah, from the Brain and Mind Institute, the Department of Population Health and the Department of Medicine at Aga Khan University, Nairobi
- Design: cross-sectional analysis of household survey data collected from July to December 2021
- Setting: the Kaloleni/Rabai Community Health and Demographic Surveillance System in Kilifi County, Kenya
- Sample: 17,738 participants (7,821 household heads and 9,917 spouses)
- Funding: the authors declared that no financial support was received
The problem and why it matters
Depression is a leading cause of disability worldwide, and the burden falls hardest on low-resource settings where services are scarce. In coastal Kenya, the authors note, recurrent droughts, heavy rainfall and flooding arrive almost every year, and many households face poverty and limited access to safe water and sanitation. In the Kaloleni and Rabai sub-counties, they report that about 70% of people live in poverty, 62% face food insecurity and 56% lack good access to safe water.
Research on how climate and the home environment affect mental health has mostly come from wealthier countries. The authors argue that this leaves a gap, because the exposures that matter in rural sub-Saharan Africa tend to arrive together: smoke from cooking fires, unreliable water, heat and drought. Traditional single-factor analyses can miss that tangle, which is where machine learning comes in.
How the researchers did it
Field workers surveyed household heads and spouses face to face in English or Kiswahili. Mental health was measured with the Patient Health Questionnaire-9 (PHQ-9), a nine-question screening tool scored from 0 to 27. A score of 10 or higher counted as screening positive for depression. The Swahili version has been validated in Kilifi, according to the paper.
The team fed 31 variables into the models, grouped into four themes: perceptions of climate change, climate impacts such as drought and farming stress, air pollution proxies (cooking fuel, lighting and where people cook), and water and sanitation. They trained two tree-based algorithms, Random Forest and XGBoost, on 80% of the data and tested them on the remaining 20%.
Two design choices stand out. First, the split was done by household, so members of the same home never appeared in both the training and test sets, which prevents the model from simply memorizing families. Second, only 14.9% of people screened positive, so the team used class weighting to stop the models from ignoring the minority. They then used SHAP values, a method that shows how much each answer pushed a prediction up or down, to open the black box.
What they found
Of the 17,738 participants, 14.9% (2,635 people) screened positive for depression. By severity, 47.9% scored none or minimal, 37.7% mild, 11.5% moderate, 2.6% moderately severe and 0.7% severe, as reported in the paper’s text.
The household conditions were stark. According to the paper, 86.0% cooked on an open or stone fire, 59.9% used an open wick lamp for lighting, only 29.7% had electricity, 64.6% had been hit by drought in the past 12 months and 64.4% said their home felt uncomfortably hot in the hot season. Only 35.2% had a piped source of drinking water.
On the independent test set, XGBoost had the edge:
- Accuracy: 0.802 for XGBoost versus 0.796 for Random Forest
- ROC-AUC: 0.845 (95% CI 0.826 to 0.862) versus 0.823 (95% CI 0.804 to 0.841)
- Sensitivity: 0.684 versus 0.657
- Specificity: 0.822 versus 0.819
- Precision for depression-positive cases: 0.40 versus 0.38
In practical terms, the XGBoost model caught about two-thirds of screening-positive people, but its precision of 0.40 means many flagged people would not actually screen positive. The confusion matrix reported 356 true positives and 560 false positives for XGBoost. The authors describe this as a deliberate trade-off that may be acceptable for community screening, where a follow-up assessment can sort out the false alarms.
The most influential predictors varied slightly by method but converged on a theme. In XGBoost, the top features by gain were open-fire cooking, drought shock, home thermal discomfort, cooking and washing water source, and perceived hotter temperatures. In Random Forest, drinking water source, heat-related health risk, cooking and washing water source, water treatment and toilet type led the list. SHAP analysis put drinking water source, thermal discomfort, drought exposure and heat-related risks among the top contributors for both models, with open-fire cooking in the top 10.
What is new here
Depression and climate have been linked before. What this study adds is a large community sample from a rural African setting, a grouped train and test design that avoids a common leakage trap, and three complementary ways of ranking features rather than one. Where several methods agree, confidence in the signal goes up.
It also shows how cheap the inputs are. None of the 31 variables needed a blood test or a sensor. They came from questions a community health worker can ask in minutes, which is the kind of data a surveillance system like Kaloleni/Rabai already collects.
Limitations the authors state
The authors are candid, and readers should be too. This is a cross-sectional study, so it cannot show cause and effect, and depression itself may color how people perceive heat or drought. The PHQ-9 is a screening tool, not a diagnosis, and it is self-reported.
Key confounders such as income, education, marital status, occupation, social support, food insecurity and prior mental health history were not available. The authors warn that the models may be capturing a general poverty signal rather than isolating specific environmental effects. Exposure was measured by proxies such as cooking type and perceived heat, which do not capture dose, duration or ventilation. Model calibration was not formally assessed, there was no external validation, and spatial clustering at the community health unit level was not tested. Finally, 77.8% of participants were female, which may limit how well the findings apply to men.
What it means for health systems and policy
For health systems, the message is practical rather than flashy. Environmental indicators could be added to routine community screening to help target scarce mental health resources toward the households most at risk. The authors point to interventions that deliver benefits on several fronts: clean cookstoves, better water and sanitation, heat mitigation and climate-resilient farming. They suggest such investments may yield mental health co-benefits alongside physical health gains, though this study cannot prove that.
For technology and data teams, the study is a reminder that a respectable AUC does not make a deployable tool. With precision around 0.40, any real screening workflow would need confirmatory assessment, careful handling of false positives, and validation in new districts before anyone relies on it.
Conclusion
The Kilifi study offers a grounded view of machine learning in global health: modest accuracy, honest caveats and a pattern worth following up. Water, heat, drought and smoky kitchens keep rising to the top of the models, and these are things that policy and infrastructure can change. The next step, as the authors say, is longitudinal work with better exposure measurement. This article reports research findings and is not medical advice.
Sources
- Andrew J, Njoroge A, Andai D, Bosire E, Shah J. Environmental and household factors associated with depressive symptoms in rural Kilifi County, Kenya: a machine learning analysis. Frontiers in Public Health, 23 September 2026. https://doi.org/10.3389/fpubh.2026.1826112
- Full text on Frontiers in Public Health