Choosing a spatial weight matrix

Spatial methods02 / NOTE

Before any spatial test or model, you have to declare who counts as whose neighbour. The W matrix is that declaration — an assumption, not a fact handed over by the data.

Every spatial statistic — Moran’s I, a spatial lag, a spatial error term — rests on one prior decision: who is whose neighbour? The spatial weights matrix W is where you answer it. It is an n × n matrix whose entry w_ij encodes how connected unit i is to unit j, with w_ii = 0 by convention. Once fixed, the spatial lag Wz is just the (weighted) average of each unit’s neighbours — the object every spatial method actually operates on.

The data do not hand you W. You choose its structure:

  • Contiguity. w_ij = 1 if areas i and j share a border. Rook contiguity requires a shared edge; Queen also counts a shared corner (so more neighbours). Natural for areal units like districts or census tracts.
  • Distance band. w_ij = 1 if the distance d_ij is within a cutoff δ, else 0. Simple, but the cutoff is delicate: too small and some units become islands with no neighbours; too large and dense areas acquire enormous neighbour sets.
  • k-nearest-neighbours. Each unit links to its k closest others, guaranteeing exactly k neighbours everywhere. Robust when density is uneven (a crowded centre, a sparse edge), at the cost of being asymmetric by construction — i can be a neighbour of j without the reverse.

Then row-standardise: divide each row by its sum so Σ_j w_ij = 1. Now Wz is a true average — comparable across units with different neighbour counts — and the spatial parameters (ρ, λ) land in an interpretable, bounded range. This is standard for both Moran’s I and spatial regression.

The point to internalise: W is a modelling assumption, not a measurement. It is exogenous and pre-specified — you do not estimate it from the outcome y. And it has teeth: a denser W generally inflates measured autocorrelation, and a badly chosen W can flip the diagnostic tests that decide which spatial model you fit. So the discipline is:

  1. Pick a structure with a substantive rationale — why these neighbours?
  2. Fix it before looking at results, so you can’t tune W toward a wanted answer.
  3. Re-run the analysis over alternative W (different k, rook vs queen, other cutoffs) and report whether the conclusions survive.

If the story only holds for one hand-picked weighting, it is a story about your W, not about space.