This release contains the complete code repository, data processing scripts, and model optimisation pipelines used for the study: "Malaria prevalence near African mangroves: negative association with mangrove extent, but positive association with mangrove greenness".
This project presents the first continent-scale, multi-country analysis linking African mangrove forests to human malaria (Plasmodium falciparum) prevalence across 27 African countries spanning 11 years of survey data (1996, 2007–2010, and 2014–2020). Using piecewise structural equation models (SEMs) and supervised machine learning algorithms, the pipeline assesses how mangrove land cover and mangrove vegetation greenness (NDVI) directly and indirectly associate with malaria transmission across variable spatial resolutions ($1\text{ to }50\text{ km}$).
The pipeline includes a piecewise SEM suite in R (piecewiseSEM, MASS::glmmPQL) to evaluate direct and indirect malaria drivers across 27 African countries while accounting for spatial autocorrelation and temporal random effects. It features multi-scale data processing scripts to extract spatial radii ($1\text{--}50\text{ km}$) for mangrove extent and vegetation greenness (NDVI), alongside machine learning benchmarks in Python (scikit-learn, XGBoost, Keras) to assess predictive performance against SEM results. An interactive R Shiny application (src/Mangrove-Malaria_ShinyApp) allows users to explore path diagrams, effect sizes, and model support across scales, complemented by a robustness suite covering $k\text{NN}$ imputation, buffer variation ($5\text{--}20\text{ km}$), non-linear weather terms, and healthcare control variables.