⌛ 25 minutes

<aside> 💡

In this practical, you will revisit John Snow's 1854 Soho cholera outbreak (his map was published in 1855) and ask whether neighbouring housing blocks have similar numbers of deaths:

  1. Define who is a neighbour of whom, and turn that into spatial weights with spdep
  2. Measure global spatial autocorrelation with Moran's I and the Moran scatterplot
  3. Find local clusters with local Moran's I, and map them with tmap </aside>

Your route through the 25 minutes


This is the second of five practicals in a 2-hour session. There are six stations, numbered 0 to 5. Use the times in the table to keep on track.

Station Minutes What you do You leave with
0 Set up 0–3 Packages, data, check the CRS A snow object you can trust
1 Who is my neighbour? 3–9 Build neighbours with poly2nb(), fix the error, make weights A spatial weights list
2 Global Moran's I 9–13 moran.test() and moran.plot() One number for the whole map
3 Local Moran's I 13–17 localmoran(), pull out the columns you need A local I, z-score and p-value per block
4 Map the local statistics 17–21 Four tmap maps side by side A panel of maps
5 Cluster map 21–25 Classify blocks into High-High, Low-Low, … A LISA cluster map

Station 0 · Set up


⏱️ 0–3 min

We want to test whether blocks close to each other have similar death counts, which might then suggest a proximal cause for the epidemic.

<aside> 📥

Download

snow.zip

</aside>

library(sf)
library(spdep)   # neighbours, spatial weights, Moran's I
library(tmap)    # thematic maps

Unzip snow.zip into your project folder and load snow.shp into an sf object. What do you notice about the CRS? What should we do?

Plot snow, or only snow$deaths.

<aside> ✅

EXPECT TO SEE

40 housing blocks in a small patch of Soho. Deaths per block range from 0 to 66 (median 5, mean about 12).

</aside>

<aside> 🎉

MILESTONE!

You have the outbreak data loaded and you know which coordinate system it is in.

</aside>