Spatial simultaneous autoregressive error model estimation by GMM
An implementation of Kelejian and Prucha's generalised moments estimator for the autoregressive parameter in a spatial model.
GMerrorsar(formula, data = list(), listw, na.action = na.fail, zero.policy = NULL, method="nlminb", arnoldWied=FALSE, control = list(), pars, scaleU=FALSE, verbose=NULL, legacy=FALSE, se.lambda=TRUE, returnHcov=FALSE, pWOrder=250, tol.Hcov=1.0e-10) ## S3 method for class 'Gmsar' summary(object, correlation = FALSE, Hausman=FALSE, ...) GMargminImage(obj, lambdaseq, s2seq)
formula |
a symbolic description of the model to be fit. The details
of model specification are given for |
data |
an optional data frame containing the variables in the model. By default the variables are taken from the environment which the function is called. |
listw |
a |
na.action |
a function (default |
zero.policy |
default NULL, use global option value; if TRUE assign zero to the lagged value of zones without
neighbours, if FALSE (default) assign NA - causing |
method |
default |
arnoldWied |
default FALSE |
control |
A list of control parameters. See details in |
pars |
starting values for lambda and sigma squared for GMM optimisation, if missing (default), approximated from initial OLS model as the autocorrelation coefficient corrected for weights style and model sigma squared |
scaleU |
Default FALSE: scale the OLS residuals before computing the moment matrices; only used if the |
verbose |
default NULL, use global option value; if TRUE, reports function values during optimization. |
legacy |
default FALSE - compute using the unfiltered values of the response and right hand side variables; if TRUE - compute the fitted value and residuals from the spatially filtered model using the spatial error parameter |
se.lambda |
default TRUE, use the analytical method described in http://econweb.umd.edu/~prucha/STATPROG/OLS/desols.pdf |
returnHcov |
default FALSE, return the Vo matrix for a spatial Hausman test |
tol.Hcov |
the tolerance for computing the Vo matrix (default=1.0e-10) |
pWOrder |
default 250, if returnHcov=TRUE, pass this order to |
object, obj |
|
correlation |
logical; (default=FALSE), TRUE not available |
Hausman |
if TRUE, the results of the Hausman test for error models are reported |
... |
|
lambdaseq |
if given, an increasing sequence of lambda values for gridding |
s2seq |
if given, an increasing sequence of sigma squared values for gridding |
When the control list is set with care, the function will converge to values close to the ML estimator without requiring computation of the Jacobian, the most resource-intensive part of ML estimation.
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.
The GMargminImage
may be used to visualize the shape of the surface of the argmin function used to find lambda.
A list object of class Gmsar
type |
"ERROR" |
lambda |
simultaneous autoregressive error coefficient |
coefficients |
GMM coefficient estimates |
rest.se |
GMM coefficient standard errors |
s2 |
GMM residual variance |
SSE |
sum of squared GMM errors |
parameters |
number of parameters estimated |
lm.model |
the |
call |
the call used to create this object |
residuals |
GMM residuals |
lm.target |
the |
fitted.values |
Difference between residuals and response variable |
formula |
model formula |
aliased |
if not NULL, details of aliased variables |
zero.policy |
zero.policy for this model |
vv |
list of internal bigG and litg components for testing optimisation surface |
optres |
object returned by optimizer |
pars |
start parameter values for optimisation |
Hcov |
Spatial DGP covariance matrix for Hausman test if available |
legacy |
input choice of unfiltered or filtered values |
lambda.se |
value computed if input argument TRUE |
arnoldWied |
were Arnold-Wied moments used |
GMs2 |
GM argmin sigma squared |
scaleU |
input choice of scaled OLS residuals |
vcov |
variance-covariance matrix of regression coefficients |
na.action |
(possibly) named vector of excluded or omitted observations if non-default na.action argument used |
Luc Anselin and Roger Bivand
Kelejian, H. H., and Prucha, I. R., 1999. A Generalized Moments Estimator for the Autoregressive Parameter in a Spatial Model. International Economic Review, 40, pp. 509–533; Cressie, N. A. C. 1993 Statistics for spatial data, Wiley, New York.
Roger Bivand, Gianfranco Piras (2015). Comparing Implementations of Estimation Methods for Spatial Econometrics. Journal of Statistical Software, 63(18), 1-36. https://www.jstatsoft.org/v63/i18/.
#require("spdep", quietly=TRUE) data(oldcol, package="spdep") COL.errW.eig <- errorsarlm(CRIME ~ INC + HOVAL, data=COL.OLD, spdep::nb2listw(COL.nb, style="W"), method="eigen") (x <- summary(COL.errW.eig, Hausman=TRUE)) coef(x) COL.errW.GM <- GMerrorsar(CRIME ~ INC + HOVAL, data=COL.OLD, spdep::nb2listw(COL.nb, style="W"), returnHcov=TRUE) (x <- summary(COL.errW.GM, Hausman=TRUE)) coef(x) aa <- GMargminImage(COL.errW.GM) levs <- quantile(aa$z, seq(0, 1, 1/12)) image(aa, breaks=levs, xlab="lambda", ylab="s2") points(COL.errW.GM$lambda, COL.errW.GM$s2, pch=3, lwd=2) contour(aa, levels=signif(levs, 4), add=TRUE) COL.errW.GM1 <- GMerrorsar(CRIME ~ INC + HOVAL, data=COL.OLD, spdep::nb2listw(COL.nb, style="W")) summary(COL.errW.GM1) require("sf", quietly=TRUE) nydata <- st_read(system.file("shapes/NY8_bna_utm18.gpkg", package="spData")[1], quiet=TRUE) suppressMessages(nyadjmat <- as.matrix(foreign::read.dbf(system.file( "misc/nyadjwts.dbf", package="spData")[1])[-1])) suppressMessages(ID <- as.character(names(foreign::read.dbf(system.file( "misc/nyadjwts.dbf", package="spData")[1]))[-1])) identical(substring(ID, 2, 10), substring(as.character(nydata$AREAKEY), 2, 10)) nyadjlw <- spdep::mat2listw(nyadjmat, as.character(nydata$AREAKEY)) listw_NY <- spdep::nb2listw(nyadjlw$neighbours, style="B") esar1f <- spautolm(Z ~ PEXPOSURE + PCTAGE65P + PCTOWNHOME, data=nydata, listw=listw_NY, family="SAR", method="eigen") summary(esar1f) esar1gm <- GMerrorsar(Z ~ PEXPOSURE + PCTAGE65P + PCTOWNHOME, data=nydata, listw=listw_NY) summary(esar1gm) esar1gm1 <- GMerrorsar(Z ~ PEXPOSURE + PCTAGE65P + PCTOWNHOME, data=nydata, listw=listw_NY, method="Nelder-Mead") summary(esar1gm1)
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.