# Spatial weights

Spatial statistics integrate space and spatial relationships directly into their mathematics (area, distance, length, or proximity, for example). Typically, these spatial relationships are defined formally through values called spatial weights structured as a spatial weights matrix file.

A spatial weights matrix quantifies the spatial relationships that exist among the features in your dataset (or at least it quantifies your conceptualization of those relationships). While the physical format of the spatial weights matrix file may vary, the conceptual idea is a table with one row and one column for every feature in the dataset. The cell value for any given row/column combination is the weight that quantifies the spatial relationship between those row and column features.

There are a multitude of weighting possibilities including inverse distance, fixed distance, K nearest neighbors, contiguity, and spatial interaction (these conceptual models of spatial relationships are described in Modeling Spatial Relationships). Recognize that the conceptualization you select to model spatial relationships for a particular analysis will impose a structure onto your data. Consequently, you will want to select a conceptualization that best reflects how the features being analyzed actually interact with each other in the real world.

At a very basic level, however, weights are either binary or variable. Binary weighting, used with fixed distance, K nearest neighbors, and contiguity spatial relationships, for example, will, for a particular target feature, assign a value of 1 to neighboring features and 0 to all other features. For inverse distance or inverse time spatial relationships, weights fall into a range from 0 to 1 with nearby neighbors getting larger weights than neighbors farther away.

Spatial weights are often row standardized, particularly with binary weighting strategies. Row standardization is used to create proportional weights in cases where features have an unequal number of neighbors. Row standardization involves dividing each neighbor weight for a feature by the sum of all neighbor weights for that feature, and is recommended whenever the distribution of your features is potentially biased due to sampling design or an imposed aggregation scheme.