row-standardized spatial weighting matrix
On Thu, 29 Nov 2007, Christina Li wrote:
Dear list members, I have a couple of questions: 1. I kept getting this warning "spatial weights matrix not row-standardized" when I ran LM tests, although I already row standardized the weights matrix. Here are the specific steps: I row standardized a square contiguity matrix in MatLab, exported it as an ASCII file. I then imported the ASCII file into R as a matrix (as.matrix). I then convert the matrix to a weights list object (mat2listw). Then I ran LM tests. Could it because that the row standardization was done in MatLab, not in R? I couldn't find out how to do it in R, so had to do it in MatLab.
The code shows that what is happening is that an attribute of the weights component of the object set by nb2listw() is being checked. If the attribute is not found, the warning is issued. When weights are converted from a matrix, the attribute is not set, and the style component of the listw object as a whole is set to "M". The usual solution is to do something like: x <- mat2listw(xmat) xW <- nb2listw(x$neighbours, style="W") to get to a listw object for which we know that row standardisation holds. If the original specification was for general weights, use the glist= argument to pass x$weights. lm.LMtests() could check itself, and not issue the warning, but checking would be costly, and it is better to do this once by hand rather than many times automatically. I'm pretty sure in addition that the ASCII file route introduced rounding errors, so even if it did check, row sums might miss unity by machine fuzz (say 1e-12).
Can anyone tell me how to do row standardization in R directly? Thank you!!! 2. I got significantly different LM test results for LMlag, when i used the original contiguity matrix and the row-standardized one. Is there supposed to be a big difference?
If you check this out on the example on the help page for lm.LMtests(), you'll see the difference between nb2listw(COL.nb, style = "B") and nb2listw(COL.nb, style = "W"). If I remember correctly, the test is based on row-standardised weights. In general, row-standardisation increases the influence of observations with few neighbours, while other styles may increase the influence of those with many neighbours. Roger
Any help is much appreciated! Christina Li --------------------------------- [[alternative HTML version deleted]]
_______________________________________________ R-sig-Geo mailing list R-sig-Geo at stat.math.ethz.ch https://stat.ethz.ch/mailman/listinfo/r-sig-geo
Roger Bivand Economic Geography Section, Department of Economics, Norwegian School of Economics and Business Administration, Helleveien 30, N-5045 Bergen, Norway. voice: +47 55 95 93 55; fax +47 55 95 95 43 e-mail: Roger.Bivand at nhh.no