Tutorials › Econometrics (Graduate) › Tests for Spatial Lag and Error Dependence

Spatial and Network Econometrics · Tutorial 942 of 952

Tests for Spatial Lag and Error Dependence

Construct and interpret score and likelihood-ratio tests for spatial dependence, including a joint test of spatial-lag and spatial-error parameters.

Advanced 11 min read

What You'll Learn

  • State the null hypotheses for spatial-lag, spatial-error, and joint tests.
  • Derive the score contributions for lag and error parameters at the no-spatial-dependence null.
  • Construct score statistics using efficient information, including for joint restrictions.
  • Compare restricted and unrestricted likelihoods to form likelihood-ratio tests.
  • Identify regularity conditions behind the reference chi-square distributions.
  • Interpret diagnostic p-values without treating them as evidence that a particular model is true.

Why Test for Spatial Dependence?

A spatial weights matrix \(W\) describes which units are connected and how those connections are weighted. Even after controlling for observed covariates, outcomes may depend on neighboring outcomes, or unobserved shocks may be spatially correlated. These are different mechanisms: a spatial-lag model represents dependence in the conditional mean, while a spatial-error model represents dependence in the disturbances. Tests can assess whether either parameter is needed relative to a model with neither form of dependence.

The distinction matters for specification. A rejection in a lag diagnostic is evidence against the no-lag null within the stated model; it does not by itself establish that a lag model is the uniquely correct explanation. Likewise, a rejection in an error diagnostic does not identify the source of spatial correlation. Joint testing provides a way to ask whether both parameters are zero, rather than treating two separate diagnostics as if they were independent.

Definition: In the spatial-lag model, \(y=\rho Wy+X\beta+\varepsilon\), the parameter \(\rho\) measures spatial dependence through neighboring outcomes. In the spatial-error model, \(y=X\beta+u\), with \(u=\lambda Wu+\varepsilon\), the parameter \(\lambda\) measures spatial dependence in the disturbances. The no-spatial-dependence null is \(\rho=0\) for the lag model and \(\lambda=0\) for the error model. In an encompassing model containing both parameters, the joint null is \(H_0:\rho=0,\lambda=0\).

Likelihood and the Score at the Null

For the standard likelihood calculations below, take \(W\) as known and fixed, \(X\) as the observed covariate matrix, and \(\varepsilon\sim N(0,\sigma^2 I)\). The matrix \(I-\rho W\) must be nonsingular for the lag model, and \(I-\lambda W\) must be nonsingular for the error model. At \(\rho=0\) or \(\lambda=0\), both models reduce to the same linear regression, \(y=X\beta+\varepsilon\).

Let \(\hat\beta_0\) be the null-model maximum-likelihood estimate, \(e=y-X\hat\beta_0\) its residual vector, and \(\hat\sigma_0^2=e'e/n\) the Gaussian maximum-likelihood estimate of the error variance under the null. The log likelihood for the lag model, apart from constants, is

$$ \ell_{\text{lag}}(\rho,\beta,\sigma^2) =\log|I-\rho W|-\frac{n}{2}\log(\sigma^2) -\frac{\{(I-\rho W)y-X\beta\}'\{(I-\rho W)y-X\beta\}}{2\sigma^2}. $$

For the error model, the transformed disturbance is \((I-\lambda W)(y-X\beta)\), giving the corresponding log likelihood with \(\rho,y\) in the expression above replaced by \(\lambda,y-X\beta\) inside the transformation. Differentiating each likelihood at the null gives the score contributions

$$ U_\rho(0)=-\operatorname{tr}(W)+\frac{e'Wy}{\hat\sigma_0^2}, \qquad U_\lambda(0)=-\operatorname{tr}(W)+\frac{e'We}{\hat\sigma_0^2}. $$

The trace term comes from differentiating the log determinant. The other term comes from differentiating the transformed residual sum of squares. These expressions are evaluated at the null estimates of \(\beta\) and \(\sigma^2\); they are not estimates of \(\rho\) or \(\lambda\).

Score Tests and Their Reference Distributions

A score test asks whether the likelihood would increase locally if a parameter constrained to its null value were allowed to move. It requires fitting the restricted model, not maximizing the likelihood over the alternative. For nuisance parameters \(\nu\), such as \(\beta\) and \(\sigma^2\), define the efficient information for tested parameters \(\theta\) by

$$ I_{\theta\theta\cdot\nu} =I_{\theta\theta}-I_{\theta\nu}I_{\nu\nu}^{-1}I_{\nu\theta}. $$

Here \(I\) is the expected Fisher information under the null. This adjustment accounts for estimating nuisance parameters. The efficient score is \(U_{\theta\cdot\nu}=U_\theta-I_{\theta\nu}I_{\nu\nu}^{-1}U_\nu\). At the restricted maximum-likelihood estimates, the nuisance score \(U_\nu\) is zero, though the information adjustment still matters.

Theorem: For \(q\) regular restrictions, the score statistic is \(LM=U_{\theta\cdot\nu}'I_{\theta\theta\cdot\nu}^{-1}U_{\theta\cdot\nu}\). Under the null and standard likelihood regularity conditions, \(LM\) converges in distribution to \(\chi^2_q\). A single lag or error restriction has \(q=1\); the joint restriction \(\rho=\lambda=0\) has \(q=2\).

For a single spatial parameter, this reduces to the squared efficient score divided by its efficient information. In common specifications where \(W\) has zero diagonal, \(\operatorname{tr}(W)=0\), so the trace term in the displayed score formulas vanishes. The efficient information should still be calculated for the chosen model and nuisance parameters; it should not automatically be replaced by the unadjusted information for \(\rho\) or \(\lambda\).

Worked Example: Score Test for a Spatial Lag

Suppose a hypothetical analysis of 80 districts uses a prespecified weights matrix with zero diagonal and a null regression whose residuals are \(e\). The null fit gives \(\hat\sigma_0^2=4.00\) squared outcome units and \(e'Wy=18.0\) squared outcome units. Suppose the efficient information for \(\rho\), after accounting for the regression nuisance parameters, is 45.0.

The null is \(H_0:\rho=0\), against a two-sided alternative that \(\rho\ne0\). Because \(\operatorname{tr}(W)=0\), the score is

$$ U_\rho(0)=0+\frac{18.0}{4.00}=4.50, \qquad LM_\rho=\frac{(4.50)^2}{45.0}=0.450. $$

The statistic is compared with \(\chi^2_1\), giving a p-value of approximately 0.502. At the 5% significance level, this test does not reject the no-lag null. This result is not proof that \(\rho=0\), and it does not rule out spatial-error dependence; it says that these hypothetical data do not provide strong evidence against the specified lag null.

Worked Example: Score Test for Spatial Error Dependence

In a separate hypothetical analysis of 60 counties, suppose \(W\) again has zero diagonal. The null regression has \(\hat\sigma_0^2=9.00\) squared outcome units and \(e'We=27.0\) squared outcome units. The efficient information for \(\lambda\) is 12.0. The disturbance model and the null regression are assumed to use the same observations and the stated \(W\).

Test \(H_0:\lambda=0\). The error score and score statistic are

$$ U_\lambda(0)=0+\frac{27.0}{9.00}=3.00, \qquad LM_\lambda=\frac{(3.00)^2}{12.0}=0.750. $$

Against the \(\chi^2_1\) reference distribution, the p-value is approximately 0.386. Thus the 5% test does not reject the no-error-dependence null. The statistic concerns the specified error mechanism; it is not a test of every possible form of spatial dependence.

Joint Score Testing

In an encompassing model containing both spatial parameters, collect their efficient scores in \(U=(U_\rho,U_\lambda)'\), and let \(I_{\theta\theta\cdot\nu}\) be their \(2\) by \(2\) efficient information matrix. The joint score statistic uses the full matrix, including its off-diagonal entries. Unless the scores are uncorrelated in the relevant information metric, adding two separate one-parameter score statistics does not give the joint test.

Worked Example: Joint Test of Lag and Error Dependence

For a hypothetical joint diagnostic, suppose the efficient score vector at \(H_0:\rho=\lambda=0\) is \(U=(3.00,4.00)'\), and the efficient information matrix is

$$ I_{\theta\theta\cdot\nu} = \begin{pmatrix} 10&2\\ 2&8 \end{pmatrix}. $$

Its determinant is \(10(8)-2(2)=76\), so its inverse is

$$ I_{\theta\theta\cdot\nu}^{-1} =\frac{1}{76} \begin{pmatrix} 8&-2\\ -2&10 \end{pmatrix}. $$

Therefore,

$$ LM=U'I_{\theta\theta\cdot\nu}^{-1}U =\frac{8(3.00)^2-4(3.00)(4.00)+10(4.00)^2}{76} =\frac{184}{76}=2.421. $$

There are two restrictions, so compare this with \(\chi^2_2\). The p-value is approximately 0.298, and the joint test does not reject at 5%. The conclusion concerns the joint null; it is not obtained by requiring both separate tests to reject, nor does it identify which mechanism would be responsible if the joint null were rejected.

Likelihood-Ratio Tests

The likelihood-ratio (LR) test compares the maximized likelihood under a restricted null with the maximized likelihood under a nested alternative. For a lag test, estimate the null regression and the unrestricted lag model; for an error test, compare the null regression with the unrestricted error model. For the joint test, compare the null regression with the model containing both parameters. The models must use the same observations and likelihood definition.

Definition: If \(\ell_R\) is the maximized log likelihood under the null restrictions and \(\ell_U\) is the maximized log likelihood under the nested alternative, the LR statistic is \(LR=2(\ell_U-\ell_R)\). Under regularity conditions and the null, it converges to \(\chi^2_q\), where \(q\) is the number of restrictions.

Worked Example: Likelihood-Ratio Test for a Spatial Lag

A hypothetical sample of 100 municipalities is fit using the same Gaussian likelihood under the null regression and the unrestricted lag model. Suppose the maximized log likelihoods are \(\ell_R=-210.0\) and \(\ell_U=-207.8\). Test \(H_0:\rho=0\), a one-restriction null.

$$ LR=2\{-207.8-(-210.0)\}=2(2.2)=4.40. $$

Against \(\chi^2_1\), this gives a p-value of approximately 0.036. At \(\alpha=0.05\), reject the no-lag null in favor of the specified lag alternative. This conclusion relies on the likelihoods being comparable and the model satisfying the regularity conditions; it does not establish a causal effect of neighboring outcomes.

Conditions, Interpretation, and Practical Choices

The usual chi-square reference distributions are asymptotic results, not exact finite-sample guarantees. Their use requires a correctly specified regular likelihood under the null, a null value in the interior of the admissible parameter space, differentiability, and nonsingular information for the tested parameters after nuisance adjustment. Spatially, the matrices \(I-\rho W\) and \(I-\lambda W\) must remain invertible in the parameter region, and the parameters must be locally identified. Standard large-sample arguments also require suitable control of spatial dependence as the number of units grows. If the likelihood is only a quasi-likelihood under misspecification, ordinary likelihood-based chi-square calibration need not apply; robust quasi-likelihood inference requires its corresponding variance adjustment.

A score test is convenient when the restricted model is simple to fit and the alternative is expensive to estimate. An LR test requires fitting both restricted and unrestricted models, but directly measures their maximized likelihood difference. Under regular conditions, both have the same asymptotic chi-square reference distribution for the same restrictions. Their finite-sample results can differ, so they should not be treated as numerically interchangeable.

When both mechanisms are of interest, the joint test \(H_0:\rho=\lambda=0\) is a direct diagnostic of no lag and no error dependence in the encompassing model. A rejection says at least one restriction is inconsistent with the data under that model. Separate lag and error diagnostics can provide additional clues, but neither the separate nor the joint test alone selects a final specification. In particular, the spatial weights matrix and the substantive model still matter.

Common Pitfall

  • Wrong reasoning: “The lag test has a small p-value and the error test does not, so the lag model is proven correct.”
  • Correction: Each p-value assesses a particular null under a particular likelihood and weights matrix. A small p-value is evidence against that null, not proof of an alternative. To assess whether both dependence parameters can be zero, use the joint two-restriction test; then interpret all diagnostics in light of model assumptions and substantive context.
  • Wrong reasoning: “The joint score statistic is the sum of the lag and error statistics.”
  • Correction: The joint statistic is \(U'I_{\theta\theta\cdot\nu}^{-1}U\). It uses the covariance between the efficient scores as well as their individual information, so the sum is valid only under special information-matrix conditions.

Check Your Understanding

Use the definitions and procedures above to answer the following questions.

  1. State the null hypothesis for a one-parameter spatial-error score test and identify the restricted model used to evaluate it.
  2. Why does the score for a spatial-lag parameter include a log-determinant trace term?
  3. A joint score test has two tested parameters. Which reference distribution is used under the regular null, and why is the full information matrix needed?
  4. Suppose restricted and unrestricted log likelihoods are \(-150.0\) and \(-147.5\) for a one-restriction test. Calculate the LR statistic.
  5. Give one reason why a standard chi-square calibration may be unreliable under spatial misspecification.
Clinical Biostats