Skip to contents

Model \(y = \rho W y + X\beta + u\), \(u = \lambda W_2 u + e\) (Kelejian and Prucha 1998), as spatialreg::gstsls: 2SLS of y on (Wy, X) with instruments X, WX, \(W^2X\) (lags of the non-intercept columns); \(\lambda\) from the generalised moments of those residuals on \(W_2\); then 2SLS of \(y - \lambda W_2 y\) on \((Wy - \lambda W_2 Wy, X - \lambda W_2 X)\) with the same instruments. Covariance \(s^2 (Z_p'Z_p)^{-1}\), \(s^2 = e'e/df\) (df = n unless sig2n_k), or the HC0 / HC1 sandwich.

Usage

GS2SLSSAC(
  y,
  X,
  W,
  W2 = NULL,
  robust = NULL,
  sig2n_k = FALSE,
  interval = c(-0.999, 0.999)
)

Arguments

y

Response.

X

Design matrix; a leading column of ones is the intercept.

W

Weights of the spatial lag.

W2

Weights of the error process (default W).

robust

NULL, "HC0" or "HC1".

sig2n_k

Divide by \(n - k\).

interval

Search interval for \(\lambda\).

Value

List with rho, lambda, sigma2_gm, coefficients (rho first), se, cov, s2, residuals.

References

Kelejian, H. H. and Prucha, I. R. (1998). A generalized spatial two-stage least squares procedure for estimating a spatial autoregressive model with autoregressive disturbances. Journal of Real Estate Finance and Economics 17, 99-121.

Examples

W <- 1 * (abs(outer(1:8, 1:8, "-")) == 1)
W <- W / rowSums(W)
X <- cbind(1, c(.1, .6, .2, .9, .3, .5, .8, .4))
GS2SLSSAC(c(1, 2.2, 1.4, 3.1, .9, 2, 2.6, 1.1), X, W)$rho
#> [1] -0.5612591