Machine Learning Models and Mixed Models to predict vaccine hesitancy in Africa
# Vaccine Hesitancy in Africa: A Dual Machine Learning & Multilevel Analysis
**Author:** Paul Marie Mweni | KU Leuven — Master's Thesis (QASS)
---
## Overview
This project investigates the structural and individual-level determinants of **vaccine hesitancy** across **39 African countries** using data from the **Afrobarometer Round 9** (n ≈ 22,600). It combines machine learning for predictive modeling and feature evaluation with multilevel statistical modeling to account for the hierarchical, cross-national structure of the data.
The dual-method approach bridges the gap between predictive power and causal interpretability — a combination increasingly valued in applied public health research and data science roles.
---
## Research Question
> What are the strongest individual-level and country-level predictors of vaccine hesitancy among unvaccinated Africans, and how do these vary across national contexts?
---
## Methods
### Machine Learning Pipeline
Three classifiers were benchmarked on the full sample and on two age-based subgroups (youth: 18–35; adults: 35+):
| Model | Full Sample AUC | Youth AUC | Adult AUC |
|----------|:-----------:|:---------:|:---------:|
| Logistic Regression (GLM) | 0.629 | 0.624 | 0.632 |
| Random Forest | 0.674 | 0.661 | 0.676 |
| **XGBoost** | **0.686** | **0.674** | **0.691** |
Key steps:
- **Missing data imputation** via `missForest` (country-stratified, parallelized)
- **Hyperparameter tuning** via 5-fold cross-validation with 30 grid combinations
- **Optimal threshold selection** using the Youden Index
- **Feature evaluation** with SHAP values (beeswarm + bar plots) and permutation importance
### Multilevel Analysis
A stepwise **mixed-effects logistic regression** (GLMER, `lme4`) with countries as random intercepts:
- **Null model ICC = 0.108** → 10.8% of variance attributable to country-level differences, justifying multilevel modeling
- 10 nested models built incrementally: from language profile only → individual …