Learn R Programming

spdep (version 0.2-3)

lm.LMtests: Lagrange Multiplier diagnostics for spatial dependence in linear models

Description

The function reports the estimates of tests chosen among five statistics for testing for spatial dependence in linear models. The statistics are the simple LM test for error dependence (LMerr), the simple LM test for a missing spatially lagged dependent variable (LMlag), variants of these robust to the presence of the other (RLMerr, RLMlag - RLMerr tests for error dependence in the possible presence of a missing lagged dependent variable, RLMlag the other way round), and a portmanteau test (SARMA, in fact LMerr + RLMlag).

Usage

lm.LMtests(model, listw, zero.policy=FALSE, test="LMerr", spChk=NULL)
print.LMtestlist(x, ...)
tracew(listw)

Arguments

model
an object of class lm returned by lm; weights and offsets should not be used
listw
a listw object created for example by nb2listw, expected to be row-standardised (W-style)
zero.policy
if TRUE assign zero to the lagged value of zones without neighbours, if FALSE assign NA
test
a character vector of tests requested chosen from LMerr, LMlag, RLMerr, RLMlag, SARMA; test="all" computes all the tests.
spChk
should the data vector names be checked against the spatial objects for identity integrity, TRUE, or FALSE, default NULL to use get.spChkOption()
x
object to be printed
...
printing arguments to be passed through

Value

  • A list of class LMtestlist of htest objects, each with:
  • statisticthe value of the Lagrange Multiplier test.
  • parameternumber of degrees of freedom
  • p.valuethe p-value of the test.
  • methoda character string giving the method used.
  • data.namea character string giving the name(s) of the data.

Details

The two types of dependence are for spatial lag $\rho$ and spatial error $\lambda$:

$$\mathbf{y} = \mathbf{X \beta} + \rho \mathbf{W_{(1)} y} + \mathbf{u},$$ $$\mathbf{u} = \lambda \mathbf{W_{(2)} u} + \mathbf{e}$$

where $\mathbf{e}$ is a well-behaved, uncorrelated error term. Tests for a missing spatially lagged dependent variable test that $\rho = 0$, tests for spatial autocorrelation of the error $\mathbf{u}$ test whether $\lambda = 0$. $\mathbf{W}$ is a spatial weights matrix; for the tests used here they are identical.

References

Anselin, L. 1988 Spatial econometrics: methods and models. (Dordrecht: Kluwer); Anselin, L., Bera, A. K., Florax, R. and Yoon, M. J. 1996 Simple diagnostic tests for spatial dependence. Regional Science and Urban Economics, 26, 77--104.

See Also

lm

Examples

Run this code
data(oldcol)
oldcrime.lm <- lm(CRIME ~ HOVAL + INC, data = COL.OLD)
summary(oldcrime.lm)
lm.LMtests(oldcrime.lm, nb2listw(COL.nb), test=c("LMerr", "LMlag", "RLMerr",
  "RLMlag", "SARMA"))

Run the code above in your browser using DataLab