Tutorials › Econometrics (Graduate) › Likelihood Estimation of Spatial Autoregressive Models

Spatial and Network Econometrics · Tutorial 940 of 952

Likelihood Estimation of Spatial Autoregressive Models

Derive and evaluate Gaussian likelihoods for spatial-lag and spatial-error models, with careful treatment of the Jacobian and admissible spatial coefficients.

Advanced 10 min read

What You'll Learn

  • Write the Gaussian likelihood for spatial-lag and spatial-error models.
  • Explain why each likelihood includes a log-determinant Jacobian.
  • Concentrate out regression coefficients and the innovation variance.
  • Evaluate candidate likelihoods using the determinant and transformed residuals.
  • Distinguish a nonsingular likelihood domain from additional stability restrictions.
  • Avoid sign errors when computing the log-determinant contribution.

Why the Spatial Likelihood Has an Extra Term

In an ordinary linear regression, the Gaussian likelihood is built from the residuals and their variance. Spatial autoregressive models require one more ingredient: the response or disturbance is transformed by a matrix that depends on the spatial coefficient. That transformation changes the density’s scale, so its Jacobian contributes a log-determinant to the likelihood. Omitting it, or using its sign incorrectly, changes the parameter being optimized.

The objective here is likelihood estimation for two familiar specifications: the spatial-lag model, in which the outcome depends on neighboring outcomes, and the spatial-error model, in which the disturbances have spatial dependence. The likelihood calculations condition on the observed spatial weights matrix and the regressors.

Models and Assumptions

Let \(y\) be an \(n\times 1\) outcome vector, \(X\) an \(n\times k\) matrix of regressors with full column rank, and \(W\) a fixed \(n\times n\) spatial weights matrix. Write \(I\) for the \(n\times n\) identity matrix. The entries of \(W\) and its normalization are treated as given during estimation.

Definition: The spatial-lag model is $$ y=\rho Wy+X\beta+\varepsilon, $$ where \(\rho\) is the spatial-lag coefficient and \(\beta\) is a \(k\times1\) coefficient vector. The spatial-error model is $$ y=X\beta+u,\qquad u=\lambda Wu+\varepsilon, $$ where \(\lambda\) is the spatial-error coefficient. In either model, assume \(\varepsilon\mid X,W\sim N(0,\sigma^2 I)\), with \(\sigma^2>0\). A candidate spatial coefficient is admissible for likelihood evaluation only when its transformation matrix is nonsingular.

For the spatial-lag model define \(A_\rho=I-\rho W\). Rearranging gives \(A_\rho y=X\beta+\varepsilon\). For the spatial-error model define \(A_\lambda=I-\lambda W\); rearrangement gives \(A_\lambda(y-X\beta)=\varepsilon\). In both cases the innovation vector is assumed to have independent, equal-variance Gaussian components conditional on \(X,W\). The transformations must be invertible so that the density of the observed outcome is well defined.

Deriving the Gaussian Log-Likelihood

If a random vector \(z\) has density \(f_z\), and \(z=g(y)\) is a one-to-one differentiable transformation, then the density of \(y\) is \(f_y(y)=f_z(g(y))|\det(\partial g(y)/\partial y')|\). Taking logarithms adds the log absolute determinant of the transformation’s Jacobian. In the spatial-lag model, the transformation from \(y\) to innovations is \(\varepsilon=A_\rho y-X\beta\), whose derivative with respect to \(y\) is \(A_\rho\). In the spatial-error model it is \(\varepsilon=A_\lambda(y-X\beta)\), with derivative \(A_\lambda\). Thus each model contributes its own log-determinant term.

$$ \ell_L(\rho,\beta,\sigma^2) =\log|A_\rho|-\frac{n}{2}\log(2\pi\sigma^2) -\frac{(A_\rho y-X\beta)'(A_\rho y-X\beta)}{2\sigma^2}, \qquad A_\rho=I-\rho W. $$
$$ \ell_E(\lambda,\beta,\sigma^2) =\log|A_\lambda|-\frac{n}{2}\log(2\pi\sigma^2) -\frac{\{A_\lambda(y-X\beta)\}'\{A_\lambda(y-X\beta)\}}{2\sigma^2}, \qquad A_\lambda=I-\lambda W. $$

Here \(|A|\) denotes the absolute value of the determinant of a square matrix \(A\), so \(\log|A|\) is defined whenever \(A\) is nonsingular. The sign is important: the log-likelihood contains \(+\log|A|\), not its negative. If a transformation compresses volume, its determinant has magnitude below one and this term is negative; if it expands volume, the term is positive.

Concentrating Out Regression Coefficients and Variance

For any fixed admissible spatial coefficient, if the minimized transformed sum of squared residuals is positive, the likelihood can be maximized over the ordinary regression coefficients and innovation variance. If that sum is zero, the likelihood is unbounded as \(\sigma^2\to0\) (with \(\sigma^2>0\)), so there is no finite variance MLE or attained maximum. In the spatial-lag model, the transformed outcome is \(A_\rho y\) and the regression matrix remains \(X\). The conditional maximum-likelihood coefficient is the ordinary least-squares coefficient from regressing \(A_\rho y\) on \(X\). In the spatial-error model, the transformed residual is \(A_\lambda(y-X\beta)\); minimizing its squared length gives a transformed least-squares coefficient.

$$ \widehat\beta_L(\rho)=(X'X)^{-1}X'A_\rho y,\qquad SSR_L(\rho)=\{A_\rho y-X\widehat\beta_L(\rho)\}'\{A_\rho y-X\widehat\beta_L(\rho)\}. $$
$$ \widehat\beta_E(\lambda)=(X'A_\lambda'A_\lambda X)^{-1}X'A_\lambda'A_\lambda y,\qquad SSR_E(\lambda)=\{A_\lambda(y-X\widehat\beta_E(\lambda))\}'\{A_\lambda(y-X\widehat\beta_E(\lambda))\}. $$

These expressions require the indicated matrices to be invertible; full column rank of \(X\) suffices for the spatial-lag expression, while the spatial-error expression also uses nonsingularity of \(A_\lambda\). When the relevant \(SSR\) is positive, the variance estimate at a fixed spatial coefficient is the maximum-likelihood estimate \(SSR/n\), not a degrees-of-freedom-adjusted unbiased estimate. Substituting it into the likelihood gives the concentrated log-likelihood.

$$ \ell_{L,c}(\rho)=\log|A_\rho|-\frac{n}{2}\left[\log(2\pi)+1+\log\left\{\frac{SSR_L(\rho)}{n}\right\}\right], \qquad \ell_{E,c}(\lambda)=\log|A_\lambda|-\frac{n}{2}\left[\log(2\pi)+1+\log\left\{\frac{SSR_E(\lambda)}{n}\right\}\right]. $$

The formula follows by differentiating the Gaussian log-likelihood with respect to \(\sigma^2\). If \(SSR\) is the relevant transformed sum of squared residuals, the variance-dependent part is \(-\frac{n}{2}\log(\sigma^2)-\frac{SSR}{2\sigma^2}\). Its derivative is \(-n/(2\sigma^2)+SSR/(2(\sigma^2)^2)\), which is zero at \(\widehat{\sigma}^2=SSR/n\). The second derivative there is negative, so this is a maximum. Substitution yields the displayed concentrated expression. Estimation then searches over the admissible spatial coefficient, recomputing both the determinant and the transformed residual sum of squares at each candidate.

Worked Example: Checking the Jacobian Sign

Suppose a hypothetical spatial-lag calculation at \(\rho=0.3\) gives \(|A_\rho|=1/0.91=1.09890\), and the transformed residual sum of squares is \(3.38\) for \(n=2\). Thus \(\widehat{\sigma}^2=3.38/2=1.69\). Evaluate the concentrated log-likelihood at this candidate.

For \(n=2\), the multiplier \(n/2\) equals one. The determinant contribution is \(\log(1.09890)=-\log(0.91)=0.0943107\). Therefore,

$$ \begin{aligned} \ell_{L,c}(0.3) &=0.0943107-\left[\log(2\pi)+1+\log(1.69)\right]\\ &=0.0943107-\left[1.837877+1+0.524729\right]\\ &=0.0943107-3.362606\\ &=-3.268295\approx -3.268. \end{aligned} $$

The calculation depends on the determinant being \(1.09890\), not \(0.91\). A frequent sign trap is to see \(-\log(0.91)\) and mistake it for the log-determinant of a matrix whose determinant is \(0.91\). It is instead the log-determinant when the determinant is \(1/0.91\). If \(|A_\rho|=0.91\), the contribution would be \(\log(0.91)=-0.0943107\), and the likelihood would be \(-3.45692\) for the same residual variance. The determinant must be checked before the likelihood is evaluated.

Numerical Evaluation Over the Admissible Region

A spatial coefficient is excluded whenever \(I-\theta W\) is singular, where \(\theta\) denotes \(\rho\) or \(\lambda\). At such a value, the transformation has no inverse and the Gaussian density transformation used above fails. In applied work, the optimization region is typically a specified admissible interval containing zero and bounded away from determinant singularities. Additional stability restrictions may also be imposed. For example, a condition ensuring a convergent spatial multiplier is not identical to the minimal requirement that the likelihood transformation be nonsingular; the model’s stated parameter restrictions should determine the region used.

For a real eigenvalue \(\omega\) of \(W\), a singularity occurs when \(1-\theta\omega=0\). This gives a practical way to locate possible boundaries. The determinant can be evaluated directly using a numerically stable factorization, such as pivoted LU. Alternatively, when eigenvalues are available, \(\log|I-\theta W|\) can be computed from the factors \(1-\theta\omega_j\), combining complex conjugate pairs to obtain the real log absolute determinant. Near a singularity, both the determinant term and numerical conditioning require particular care.

Worked Example: Comparing Candidate Spatial-Lag Coefficients

Consider a hypothetical two-unit spatial-lag model with \(W=\begin{pmatrix}0&1\\1&0\end{pmatrix}\), no regressors, and outcomes \(y=(2,1)'\). Restrict the search to \(-1<\rho<1\), where \(A_\rho\) is nonsingular because \(|A_\rho|=1-\rho^2\). At each candidate, calculate \(A_\rho y\), its sum of squares, the variance estimate, and the concentrated likelihood. There are no regression coefficients to estimate in this example.

At \(\rho=0.3\), \(A_\rho y=(1.7,0.4)'\), so \(SSR=1.7^2+0.4^2=3.05\), and \(\widehat{\sigma}^2=3.05/2=1.525\). The determinant is \(0.91\), so \(\log|A_\rho|=\log(0.91)=-0.0943107\). Hence

$$ \ell_{L,c}(0.3) =-0.0943107-\left[\log(2\pi)+1+\log(1.525)\right] \approx -0.0943107-3.2598715=-3.3541822. $$

At \(\rho=0.6\), \(A_\rho y=(1.4,-0.2)'\), giving \(SSR=1.4^2+(-0.2)^2=2.00\) and \(\widehat{\sigma}^2=1.00\). Since \(|A_\rho|=1-0.6^2=0.64\),

$$ \ell_{L,c}(0.6) =\log(0.64)-\left[\log(2\pi)+1+\log(1)\right] =-0.446287-2.837877=-3.284164. $$

At \(\rho=0.8\), the transformed outcome is \((1.2,-0.6)'\), with \(SSR=1.80\), variance estimate \(0.90\), and determinant \(0.36\). Thus \(\ell_{L,c}(0.8)=\log(0.36)-[\log(2\pi)+1+\log(0.90)]\approx-3.75417\). Among these three candidates, \(0.6\) has the largest concentrated log-likelihood. This comparison does not establish that \(0.6\) is the continuous maximum: a numerical optimizer would refine the search and compare the objective throughout the admissible interval.

Practical Optimization and Common Pitfalls

A reliable numerical procedure treats the determinant and residual calculations as parts of one objective, not as optional corrections. For each admissible coefficient, form the transformation matrix, compute its log absolute determinant, estimate the conditional regression coefficients, calculate the transformed residual sum of squares, and evaluate the concentrated likelihood. A grid can help locate promising regions, followed by a bounded one-dimensional optimizer. If the admissible set has multiple components, optimize within each component and compare the resulting maxima rather than allowing an algorithm to cross a singularity.

The spatial-error model uses the same overall strategy but a different transformed residual and a different conditional coefficient estimate. Its residual is \(A_\lambda(y-X\beta)\), not \(A_\lambda y-X\beta\). Applying the spatial-lag coefficient formula to the error model would therefore optimize the wrong sum of squares. Likewise, a determinant evaluated for one model or parameter value cannot be reused for another.

  • Wrong: “The determinant is below one, so I add a positive adjustment.” Correction: Use \(\log|A|\) exactly as calculated; if \(|A|<1\), its log is negative.
  • Wrong: “A small residual sum of squares must give the largest likelihood.” Correction: The likelihood also includes the log-determinant and the variance term, so compare the complete concentrated objective.
  • Wrong: “Any coefficient with a finite numerical output is admissible.” Correction: Check that the transformation is nonsingular and that the coefficient satisfies the model’s stated admissibility restrictions.
  • Wrong: “The variance estimate is \(SSR/(n-k)\) in the concentrated Gaussian likelihood.” Correction: Maximum likelihood uses \(SSR/n\); degrees-of-freedom adjustments serve a different purpose.
Key takeaway: Gaussian likelihood estimation of spatial autoregressive models balances transformed residual fit against the Jacobian term \(\log|I-\theta W|\). The transformation, determinant sign, variance estimate, and admissible search region must all be handled consistently.

Check Your Understanding

Try these questions without looking back.

  1. Why does the Gaussian likelihood for a spatial-lag model include \(\log|I-\rho W|\)?
  2. For \(n=10\) and a transformed residual sum of squares of \(18\), what is the maximum-likelihood estimate of the innovation variance at a fixed spatial coefficient?
  3. If \(|I-\lambda W|=0.8\), what is the sign of the spatial-error model’s log-determinant contribution?
  4. Explain why the spatial-error model’s transformed residual is not generally \(A_\lambda y-X\beta\).
  5. What must be checked before evaluating or optimizing the likelihood at a candidate spatial coefficient?
Clinical Biostats