Spatial weight matrix

The concept of a spatial weight is used in spatial analysis to describe neighbor relations between regions on a map. If location $$i$$ is a neighbor of location $$j$$ then $$w_{ij} \neq 0$$ otherwise $$w_{ij} = 0$$. Usually (though not always) we do not consider a site to be a neighbor of itself so $$w_{ii} = 0$$. These coefficients are encoded in the spatial weight matrix

W = \begin{pmatrix} w_{11} & w_{12} & \ldots & w_{1N} \\ w_{21} & w_{22} & \ldots & w_{2N} \\ \vdots & \vdots & \vdots & \vdots \\ w_{N1} & w_{N2} & \ldots & w_{NN} \\ \end{pmatrix} $$ Where $$N$$ is the number of sites under consideration. The spatial weight matrix is a key quantity in the computation of many spatial indices like Moran's I, Geary's C, Getis-Ord statistics and Join Count Statistics.

Contiguity-Based Weights


This approach considers spatial sites as nodes in a graph with links determined by a shared boundary or vertex. The elements of the spatial weight matrix are determined by setting $$w_{ij} = 1$$ for all connected pairs of nodes $$ij$$ with all the other elements set to 0. This makes the spatial weight matrix equivalent to the adjacency matrix of the corresponding network. It is common to row-normalize the matrix $$W$$,
 * $$w_{ij} \rightarrow w_{ij}/\sum_j w_{ij}$$

In this case the sum of all the elements of $$W$$ equals $$N$$ the number of sites.

There are three common methods for linking sites named after the chess pieces which make similar moves:
 * Rook: sites are neighbors if they share an edge
 * Bishop: sites are neighbours if they share a vertex
 * Queen: sites are neighbours if they share an edge or a vertex

In some cases statistics can be quite different depending on the definition used, especially for discrete data on a grid. There are also other cases where the choice of neighbors is not obvious and can affect the outcome of the analysis. Bivand and Wong describe a situation where the value of spatial indices of association (like Moran's I) depend on the inclusion or exclusion of a ferry crossing between counties. There are also cases where regions meet in a tripoint or quadripoint where Rook and Queen neighborhoods can differ.

Distance-Based Weights
Another way to define spatial neighbors is based on the distance between sites. One simple choice is to set $$w_{ij} = 1$$ for every pair $$(i,j)$$ separated by a distance less than some threshold $$\delta$$. Cliff and Ord suggest the general form

w_{ij} = g(d_{ij}, \beta_{ij}) $$ Where $$g$$ is some function of $$d_{ij}$$ the distance between $$i$$ and $$j$$ and $$\beta_{ij}$$ is the proportion of the perimeter of $$i$$ in contact with $$j$$. The function

w_{ij} = d_{ij}^{-\alpha} \beta_{ij}^{b} $$ is then suggested. Often the $$\beta$$ term is not included and the most common values for $$\alpha$$ are 1 and 2. Another common choice for the distance decay function is

w_{ij} = \exp( - d_{ij} ) $$ though a number of different Kernel functions can be used. The exponential and other Kernel functions typically set $$w_{ii} = 1$$ which must be considered in applications.

It is possible to make the spatial weight matrix a function of 'distance class': $$w_{ij} \rightarrow w_{ij}(d)$$ where $$d$$ denotes the 'distance class', for example $$d=1,2,3,\ldots$$ corresponding to first, second, third etc. neighbors. In this case, functions of the spatial weight matrix become distance class dependent. For example, Moran's I is
 * $$ I(d) = \frac{ N }{|W(d)|} \frac {\sum_{i=1}^N \sum_{j=1}^N w_{ij}(d)(x_i-\bar x) (x_j-\bar x)} {\sum_{i=1}^N (x_i-\bar x)^2} $$

This defines a type of spatial correlogram, in this case, since Moran's I measures spatial autocorrelation, $$I(d)$$ measures how the autocorrelation of the data changes as a function of distance class. Remembering Tobler's first law of geography, "everything is related to everything else, but near things are more related than distant things" it usually decreases with distance.

Common distance functions include Euclidean distance, Manhattan distance and Great-circle distance.

Spatial Lag
One application of the spatial weight matrix is to compute the spatial lag

[Wx]_i = \sum_j w_{ij} x_j $$ For row-standardised weights initially set to $$w_{ij} = 1$$ and with $$w_{ii} = 0$$, $$[Wx]_i$$ is simply the average value observed at the neighbors of $$i$$. These lagged variables can then be used in regression analysis to incorporate the dependence of the outcome variable on the values at neighboring sites. The standard regression equation is

y_i = \sum_k x_{ik} \beta_k + \epsilon_i $$ The spatial lag model adds the spatial lag vector to this

y_i = \rho\sum_j w_{ij}y_j + \sum_k x_{ik} \beta_k + \epsilon_i $$ where $$\rho$$ is a parameter which controls the degree of autocorrelation of $$y$$. This is similar to an autoregressive model in the analysis of time series.