Skip to content
Prev 15925 / 29559 Next

spdep/splm: k-nearest neighbors, normalizations, listw2U, spatial models, methods

On Tue, 21 Aug 2012, Roger Bivand wrote:

            
I can confirm that row-standardised k=5 asymmetric weights give the same 
regression coefficients in lagsarlm() and Stata's spreg ml. Nothing 
untoward is going on, and no changes are being made to the weights.
Running listw2U() and 0.5*(W + t(W)) are fully equivalent for asymmetric 
neighbours:

set.seed(1) # or your choice of seed
res <- logical(500)
for (i in seq(along=res)) {
   nb5 <- knn2nb(knearneigh(cbind(runif(100), runif(100)), k=5))
   lw5 <- nb2listw(nb5, style="W")
   m5 <- listw2mat(lw5)
   MU5 <- 0.5*(m5 + t(m5))
   lwU5 <- listw2U(lw5)
   MUU5 <- listw2mat(lwU5)
   res[i] <- all.equal(MU5, MUU5)
}
table(res)

make.sym.nb() is used to find the "missing" cross-diagonal entries.
The output of lm.morantest(), and its equivalents in PySAL and OpenGeoDa 
are identical for k=5 asymmetric weights.
Ord normalization can be used on W and S style, for underlying symmetric 
weights. If the underlying weights are not symmetric, it cannot be used, 
and the eigenvalues will be complex. For comparison use the LU method, 
which can also handle intrinsically asymmetric weights.

Roger