5  Spatial Weight Matrices

5.1 Spatial Weight Matrices

When working with spatial data, one of the most important ideas is that nearby locations can influence each other.

To quantify this idea, we use something called a spatial weight matrix.

A spatial weight matrix describes which locations are considered “neighbors” and how strongly they influence each other.


5.2 Why Do We Need Them?

In non-spatial statistics, we often assume observations are independent.

But in spatial data:

  • nearby places tend to be similar
  • processes spread through space (i.e. people, pollution, disease)
  • distance matters

5.3 What Is a Spatial Weight Matrix?

A spatial weight matrix is a grid (matrix) where:

  • rows = locations
  • columns = locations
  • values = strength of connection between them

If two locations are neighbors:

  • W=1

If they are not:

  • W=0

5.4 Types of Neighborhoods

There are many ways to define what “neighbor” means in space. Two of the most common are:

  • Rook
  • Queen

5.4.1 Rook connectivity

Rook neighbors are defined like a chess rook: Only shares edges (not corners)

In practice: A cell is a neighbor if it touches another cell up, down, left, or right.

  • 4-direction connectivity
  • no diagonal connections

5.4.2 Queen connectivity

Queen neighbors are defined like a chess queen: Shares edges OR corners

In practice: A cell is a neighbor if it touches:

  • up, down, left, right AND diagonals
  • 8-direction connectivity

5.5 Why Choice Matters

The definition of neighbors directly affects results:

  • cluster detection
  • spatial autocorrelation (e.g. Moran’s I - see Autocorrelation chapter)
  • diffusion

Different assumptions → different spatial patterns.


5.6 Simple Example

Using Queen connectivity, this image below shows an example of a spatial weight matrix for a cluster of polygons. Anywhere there is a value of 1 in the matrix, that means the two polygons (row and column) are neighbors.

Spatial Weight Matrix

Example of Spatial Weight Matrix from Roy et al., 2022 (https://www.researchgate.net/publication/365844130_Evaluating_urban_environment_quality_UEQ_for_Class-I_Indian_city_An_integrated_RS-GIS_based_exploratory_spatial_analysis)


5.7 Summary

  • Spatial weight matrices define spatial relationships between locations
  • They are essential for modeling spatial dependence
  • Rook contiguity:
    • 4 neighbors (edges only)
    • stricter structure
  • Queen contiguity:
    • 8 neighbors (edges + corners)
    • more flexible and common in natural systems
  • The choice of weights changes the outcome of spatial analysis