1

I am trying to estimate a SAR spatial model without row-normalizing the matrix. For some reason, when I do not row-normalize, the command does not return the correct estimates. Am I missing something on the command options?

Here is an example of what I mean.

If I run the following code, simulating a data with a row-normalized matrix, lagsarlm returns the correct estimates:

set.seed(20100817)

rho <- .5
B <- c(2, 5)
e <- as.matrix(rnorm(100, sd=2))
X0 <- matrix(1, ncol=1, nrow=100) # create Intercept
X1 <- matrix(runif(100, min = -10, max = 10), nrow=100) # generate covariate
Xbe <- X0*B[1]+X1*B[2]+e
I <- diag(100)

W <- rgraph(100, m=1, tprob=0.1, mode="graph", diag=FALSE) #assume I need to start with a matrix of relationships
spatialList <- mat2listw(W)
nb7rt <- spatialList$neighbours
listw <- nb2listw(nb7rt)
W <- nb2mat(nb7rt)

y <- solve(I - rho*W) %*% Xbe

model <- lagsarlm(y ~ X1, listw=listw) 
summary(model) 

However, if I try to do exactly the same but without row-normalizing, the results are incorrect:

set.seed(20100817)

rho <- .5
B <- c(2, 5)
e <- as.matrix(rnorm(100, sd=2))
X0 <- matrix(1, ncol=1, nrow=100) # create Intercept
X1 <- matrix(runif(100, min = -10, max = 10), nrow=100) # generate covariate
Xbe <- X0*B[1]+X1*B[2]+e
I <- diag(100)

W <- rgraph(100, m=1, tprob=0.1, mode="graph", diag=FALSE) #assume I need to start with a matrix of relationships
spatialList <- mat2listw(W, style ="B")
nb7rt <- spatialList$neighbours
listw <- nb2listw(nb7rt, style="B")
W <- nb2mat(nb7rt, style="B")

y <- solve(I - rho*W) %*% Xbe

model <- lagsarlm(y ~ X1, listw=listw) 
summary(model) 

The base for this code can be found here https://stat.ethz.ch/pipermail/r-sig-geo/2010-August/009023.html.

Miranda
  • 148
  • 13

0 Answers0