Spatial Data Analysis of Malaria Prevalence in The Gambia
# Spatial Data Analysis of Malaria Prevalence in The Gambia
Welcome! This repository contains my Spatial Data Analysis assignment completed at the University of Toronto.
The report was created using **R Markdown** and knitted to **HTML**, allowing all analyses, maps, and tables to be viewed directly in your web browser.
---
## How to View
Click the link below to open the HTML file via **GitHub Pages**.
No GitHub account is required — the HTML will open like a regular website.
**→ _View the full HTML report here_**
---
## About the Project
This assignment explores **geospatial statistics**, **Bayesian modeling**, and **spatial prediction** using malaria data from **The Gambia**.
Analyses were conducted in **R**, using packages such as **geoR**, **sf**, **INLA**, **tmap**, and **raster**.
The project demonstrates:
- Spatial data wrangling and visualization
- Prior predictive simulation
- Spatial binomial regression using INLA
- SPDE approaches with Matérn and exponential covariance models
- Spatial prediction and uncertainty quantification
- Mapping exceedance probabilities
---
# Assignment Overview
## Q1.1 – Spatial Data Preparation and Visualization
### Key Tasks
- Load the malaria dataset and aggregate malaria test results by sampling location.
- Convert coordinates to an **sf spatial object** with a proper CRS.
- Extract elevation values (altitude) from raster data.
- Produce a two-panel map displaying the **total number tested** and **prevalence** across The Gambia.
---
## Q1.2 – Prior Predictive Simulation
### Key Tasks
- Compute geodesic distance matrices between sampling locations.
- Simulate **100 prior predictive datasets** using Bayesian logistic regression with:
- Normal priors for regression coefficients
- Gamma priors for spatial range and smoothness
- A Matérn covariance structure
- For the first six locations, generate histograms of prior-predicted prevalence with observed values overlaid.
---
## Q1.3 – Mapping Prior Predictive Dra …