# 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. Spatial weights are structured into a spatial weights matrix and stored 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 quantifies your conceptualization of those relationships). While the physical format of the spatial weights matrix file may vary, conceptually, you can think of the spatial weights matrix as 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 is 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, for example, is used with fixed distance, K nearest neighbors, and contiguity spatial relationships. For a particular target feature, binary weighting assigns a weight of 1 to all neighboring features and a weight of 0 to all other features. For inverse distance or inverse time spatial relationships, weights are variable. Variable weights fall into a range from 0 to 1 so that nearby neighbors get 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.