Learn R Programming

spdep (version 0.5-3)

errorsarlm: Spatial simultaneous autoregressive error model estimation

Description

Maximum likelihood estimation of spatial simultaneous autoregressive error models of the form:

$$y = X \beta + u, u = \lambda W u + \varepsilon$$

where $\lambda$ is found by optimize() first, and $\beta$ and other parameters by generalized least squares subsequently (one-dimensional search using optim performs badly on some platforms).

Usage

errorsarlm(formula, data=list(), listw, na.action,
 method="eigen", quiet=NULL, zero.policy=NULL,
 interval = NULL, tol.solve=1.0e-10, trs=NULL, control=list())

Value

  • A list object of class sarlm
  • type"error"
  • lambdasimultaneous autoregressive error coefficient
  • coefficientsGLS coefficient estimates
  • rest.seGLS coefficient standard errors (are equal to asymptotic standard errors)
  • LLlog likelihood value at computed optimum
  • s2GLS residual variance
  • SSEsum of squared GLS errors
  • parametersnumber of parameters estimated
  • lm.modelthe lm object returned when estimating for $\lambda=0$
  • methodthe method used to calculate the Jacobian
  • callthe call used to create this object
  • residualsGLS residuals
  • lm.targetthe lm object returned for the GLS fit
  • fitted.valuesDifference between residuals and response variable
  • aseTRUE if method=eigen
  • formulamodel formula
  • se.fitNot used yet
  • lambda.seif ase=TRUE, the asymptotic standard error of $\lambda$
  • LMtestNULL for this model
  • aliasedif not NULL, details of aliased variables
  • LLNullLlmLog-likelihood of the null linear model
  • HcovSpatial DGP covariance matrix for Hausman test if available
  • intervalline search interval
  • fdHessfinite difference Hessian
  • optimHessoptim or fdHess used
  • insertlogical; is TRUE, asymptotic values inserted in fdHess where feasible
  • timingsprocessing timings
  • zero.policyzero.policy for this model
  • na.action(possibly) named vector of excluded or omitted observations if non-default na.action argument used
  • The internal sar.error.* functions return the value of the log likelihood function at $\lambda$.

Control arguments

  • tol.opt
{the desired accuracy of the optimization - passed to optimize() (default=square root of double precision machine tolerance, a larger root may be used needed, see help(boston) for an example)} returnHcov{default TRUE, return the Vo matrix for a spatial Hausman test} pWOrder{default 250, if returnHcov=TRUE and the method is not eigen, pass this order to powerWeights as the power series maximum limit} fdHess{default NULL, then set to (method != "eigen") internally; use fdHess to compute an approximate Hessian using finite differences when using sparse matrix methods; used to make a coefficient covariance matrix when the number of observations is large; may be turned off to save resources if need be} optimHess{default FALSE, use fdHess from nlme, if TRUE, use optim to calculate Hessian at optimum} LAPACK{default FALSE; logical value passed to qr in the SSE log likelihood function} compiled_sse{default FALSE; logical value used in the log likelihood function to choose compiled code for computing SSE} Imult{default 2; used for preparing the Cholesky decompositions for updating in the Jacobian function} super{default FALSE using a simplicial decomposition for the sparse Cholesky decomposition, if TRUE, use a supernodal decomposition} cheb_q{default 5; highest power of the approximating polynomial for the Chebyshev approximation} MC_p{default 16; number of random variates} MC_m{default 30; number of products of random variates matrix and spatial weights matrix}

Details

The asymptotic standard error of $\lambda$ is only computed when method=eigen, because the full matrix operations involved would be costly for large n typically associated with the choice of method="spam" or "Matrix". The same applies to the coefficient covariance matrix. Taken as the asymptotic matrix from the literature, it is typically badly scaled, being block-diagonal, and with the elements involving $\lambda$ being very small, while other parts of the matrix can be very large (often many orders of magnitude in difference). It often happens that the tol.solve argument needs to be set to a smaller value than the default, or the RHS variables can be centred or reduced in range.

Note that the fitted() function for the output object assumes that the response variable may be reconstructed as the sum of the trend, the signal, and the noise (residuals). Since the values of the response variable are known, their spatial lags are used to calculate signal components (Cressie 1993, p. 564). This differs from other software, including GeoDa, which does not use knowledge of the response variable in making predictions for the fitting data.

References

Cliff, A. D., Ord, J. K. 1981 Spatial processes, Pion; Ord, J. K. 1975 Estimation methods for models of spatial interaction, Journal of the American Statistical Association, 70, 120-126; Anselin, L. 1988 Spatial econometrics: methods and models. (Dordrecht: Kluwer); Anselin, L. 1995 SpaceStat, a software program for the analysis of spatial data, version 1.80. Regional Research Institute, West Virginia University, Morgantown, WV (www.spacestat.com); Anselin L, Bera AK (1998) Spatial dependence in linear regression models with an introduction to spatial econometrics. In: Ullah A, Giles DEA (eds) Handbook of applied economic statistics. Marcel Dekker, New York, pp. 237-289; Cressie, N. A. C. 1993 Statistics for spatial data, Wiley, New York.

See Also

lm, lagsarlm, similar.listw, predict.sarlm, residuals.sarlm

Examples

Run this code
data(oldcol)
COL.errW.eig <- errorsarlm(CRIME ~ INC + HOVAL, data=COL.OLD,
 nb2listw(COL.nb, style="W"), method="eigen", quiet=FALSE)
summary(COL.errW.eig, correlation=TRUE)
COL.errB.eig <- errorsarlm(CRIME ~ INC + HOVAL, data=COL.OLD,
 nb2listw(COL.nb, style="B"), method="eigen", quiet=FALSE)
summary(COL.errB.eig, correlation=TRUE)
W <- as(as_dgRMatrix_listw(nb2listw(COL.nb)), "CsparseMatrix")
trMatc <- trW(W, type="mult")
COL.errW.M <- errorsarlm(CRIME ~ INC + HOVAL, data=COL.OLD,
 nb2listw(COL.nb, style="W"), method="Matrix", quiet=FALSE, trs=trMatc)
summary(COL.errW.M, correlation=TRUE)
NA.COL.OLD <- COL.OLD
NA.COL.OLD$CRIME[20:25] <- NA
COL.err.NA <- errorsarlm(CRIME ~ INC + HOVAL, data=NA.COL.OLD,
 nb2listw(COL.nb), na.action=na.exclude)
COL.err.NA$na.action
COL.err.NA
resid(COL.err.NA)
system.time(COL.errW.eig <- errorsarlm(CRIME ~ INC + HOVAL, data=COL.OLD,
 nb2listw(COL.nb, style="W"), method="eigen"))
system.time(COL.errW.eig <- errorsarlm(CRIME ~ INC + HOVAL, data=COL.OLD,
 nb2listw(COL.nb, style="W"), method="eigen", control=list(LAPACK=TRUE)))
system.time(COL.errW.eig <- errorsarlm(CRIME ~ INC + HOVAL, data=COL.OLD,
 nb2listw(COL.nb, style="W"), method="eigen", control=list(compiled_sse=TRUE)))

Run the code above in your browser using DataLab