Day 3 — Spatial Analysis & Statistical Modelling
Wednesday 2 September · 09:30–16:30
Where the day goes
Two ways of asking “what explains this?” — a model and a map. Both on survey data with weights, both interpreted for a reader who does not know what a coefficient is.
Sessions
| Time | Session | Material |
|---|---|---|
| 09:30–11:15 | Modelling for evidence — linear and logistic; svyglm; odds ratios, CIs, diagnostics |
scripts/linear-regression.R · scripts/car-price-regression.R · 01-dhs-model-datasets.qmd |
| 11:30–13:00 | Spatial data & mapping — WFP food prices — sf, joins to boundaries, tmap choropleths |
scripts/pakistan-district-choropleth.R |
| 14:00–15:15 | Interactive maps — leaflet popups and layers, mapview for exploration |
scripts/pakistan-maps-geoboundaries.R |
| 15:30–16:30 | Applied policy modelling with AI support — affordability from price and wage series; debugging CRS and join errors | scripts/survey-health-indicators.R · AI prompt library |
Scripts in this folder
| Script | What it does |
|---|---|
linear-regression.R |
OLS from scratch, interpreted for policy |
car-price-regression.R |
a worked regression on a small, honest dataset |
survey-health-indicators.R |
weighted health indicators from survey microdata |
survey-demographics.R |
the wider demographic survey walkthrough |
pdhs-indicators.R, pdhs-explore-0.R, pdhs-explore-1.R |
PDHS indicator construction, three passes |
mics-child.R |
MICS child module |
fertility-analysis.R |
fertility measures from the survey files |
wdi-demographic-south-asia.R |
South Asia demographic comparison from WDI |
pakistan-district-choropleth.R |
district boundaries, joins, tmap class breaks |
pakistan-maps-geoboundaries.R |
geoBoundaries + leaflet interactive layers |
WarningThe two errors that eat this day
A join key whose spelling differs between the indicator file and the shapefile, and a CRS mismatch. Check anti_join() counts and st_crs() before you blame the map.
By 16:30 you should be able to
- fit a survey-weighted model and say what one coefficient means in a sentence
- join an indicator to district boundaries and know how many rows failed to match
- produce a print-ready choropleth and an interactive map of the same indicator