SPATIALREG Procedure

Spatial Autoregressive Models

The spatial autoregressive (SAR) model is useful for incorporating the spatial dependence in the dependent variable—that is, the endogenous interaction effect. Let y Subscript i denote the observation associated with a spatial unit bold s Subscript i for i equals 1 comma 2 comma ellipsis comma n. For these spatial units, let an n times n matrix bold upper W with nonnegative elements be a spatial weights matrix. Further, let bold x Subscript i be a p times 1 vector that denotes values of p regressors recorded for the spatial unit bold s Subscript i. The SAR model can be formulated as

y Subscript i Baseline equals rho sigma-summation Underscript j equals 1 Overscript n Endscripts upper W Subscript i j Baseline y Subscript j Baseline plus bold x prime Subscript i Baseline bold-italic beta plus epsilon Subscript i

where i equals 1 comma 2 comma ellipsis comma n. Here rho is the spatial autoregressive coefficient and bold-italic beta is a p times 1 parameter vector. Moreover, upper W Subscript i j is the left-parenthesis i comma j right-parenthesisth element of the matrix bold upper W subject to upper W Subscript i i Baseline equals 0. For the error term epsilon Subscript i related to the spatial unit bold s Subscript i, it is assumed that epsilon Subscript i Baseline tilde Overscript normal i normal i normal d Endscripts upper N left-parenthesis 0 comma sigma squared right-parenthesis.

The SAR model is often described in vector form as

bold y equals rho bold upper W bold y plus bold upper X bold-italic beta plus bold-italic epsilon

where bold y equals left-parenthesis y 1 comma y 2 comma ellipsis comma y Subscript n Baseline right-parenthesis prime, bold upper X is an n times p matrix where each row consists of bold x prime Subscript i, and bold-italic epsilon equals left-parenthesis epsilon 1 comma epsilon 2 comma ellipsis comma epsilon Subscript n Baseline right-parenthesis prime.

The standard estimator for the SAR model is the maximum likelihood estimator (MLE). For the SAR model, the log-likelihood function is (Anselin 2001)

script upper L equals minus StartFraction n Over 2 EndFraction ln left-parenthesis 2 pi sigma squared right-parenthesis minus StartFraction left-parenthesis bold upper A bold y minus bold upper X bold-italic beta right-parenthesis prime left-parenthesis bold upper A bold y minus bold upper X bold-italic beta right-parenthesis Over 2 sigma squared EndFraction plus ln StartAbsoluteValue bold upper A EndAbsoluteValue

where bold upper A equals bold upper I Subscript n Baseline minus rho bold upper W, with bold upper I Subscript n being an n times n identity matrix. StartAbsoluteValue bold upper A EndAbsoluteValue denotes the determinant of bold upper A.

The gradients can be derived as follows:

StartFraction partial-differential script upper L Over partial-differential bold-italic beta EndFraction equals StartFraction bold upper X prime left-parenthesis bold upper A bold y minus bold upper X bold-italic beta right-parenthesis Over sigma squared EndFraction
StartFraction partial-differential script upper L Over partial-differential rho EndFraction equals StartFraction 1 Over sigma squared EndFraction bold y prime bold upper W prime left-parenthesis bold upper A bold y minus bold upper X bold-italic beta right-parenthesis minus normal t normal r left-parenthesis bold upper A Superscript negative 1 Baseline bold upper W right-parenthesis
StartFraction partial-differential script upper L Over partial-differential sigma squared EndFraction equals minus StartFraction n Over 2 sigma squared EndFraction plus StartFraction left-parenthesis bold upper A bold y minus bold upper X bold-italic beta right-parenthesis prime left-parenthesis bold upper A bold y minus bold upper X bold-italic beta right-parenthesis Over 2 sigma Superscript 4 Baseline EndFraction

For the n times n matrix bold upper A, normal t normal r left-parenthesis bold upper A right-parenthesis equals sigma-summation Underscript i equals 1 Overscript n Endscripts a Subscript i i, where a Subscript i i is the ith diagonal element of bold upper A.

A SAR model does not account for exogenous interaction effects. However, in practice, the value of the dependent variable y for a spatial unit might be affected by some independent exploratory variables of other spatial units as well. In such a case, you can use the SDM model instead.

Last updated: June 19, 2025