Skip to content

self-made WX in lagsarlm

3 messages · Michael E. Rose, Roger Bivand

#
On Sun, 17 May 2015, Michael E. Rose wrote:

            
Be careful with using matrices created elsewhere, as you may not have the 
insight you believe into the structures involved (row/column order is not 
infrequently changed). style="M" is equivalent to unknown, and should be 
known.
This isn't the real problem. This will actually be the fact that the 
impacts (see references to ?spdep::impacts) are unknown, as the reduced 
form - data generation process of what you want to do is:

y = (I - rho_{Lag} W)^{-1} (Xb + WXg + W*Xd + e)

where W is the weights object in the lag model applied to the dependent 
variable, g are the spatial Durbin coefficients. W* is your extra weights 
object, for which none of b, g, or d may be inferred from directly as 
the impacts of changes in X on y are filtered through (I - rho_{Lag} 
W)^{-1}.

y = (I - rho_{Lag} W)^{-1} (Xb + W*Xd + e)

is a lag model, and

y = (I - rho_{Lag} W)^{-1} ([X, WX][b,g] + W*[X, WX][c,d] + e)

is an augmented spatial Durbin, for both of which something is known about 
impacts.

Adding a matrix to a formula is trivial by comparison:

library(spdep)
data(oldcol)
lw <- nb2listw(COL.nb, style="W")
X <- model.matrix(CRIME ~ INC + HOVAL, data=COL.OLD)
class(X)
WX <- create_WX(X, lw)
class(WX)
lm(CRIME ~ INC + HOVAL + WX, data=COL.OLD)

and equivalently elsewhere, but until you resolve the impacts, do not use 
models including a coefficient on the spatially lagged dependent variable.

Roger