An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-sig-geo/attachments/20120807/f61fb928/attachment.pl>
Problems with lm.LMtests and lm.morantest
2 messages · laurence delattre, Roger Bivand
7 days later
On Tue, 7 Aug 2012, laurence delattre wrote:
Hi,
I'm a French PhD student in Economics and I would like to tests the
existence of spatial autocorrelation in a linear model with the functions
lm.morantest and lm.LMtest of the package spded (I'm not a specialist in
R!).
Its seems to be ok with lm.morantest() but with lm.LMtest() I have the
error message:
?NOTE: lm.LMtests(LM1, LISTW, zero.policy = NULL, test = "LMlag", spChk
= NULL, : Spatial weights matrix not row standardized?
So, I tried to row-standardized the matrix and I nomore have this
message when processing lm.LMtest().
However the results seems odd. Indeed with the initial matrix,
converted into a listw object with ?LISTW<-mat2listw (W, row.names=NULL)?,
I rejected the null hypothesis both with the Moran's tests and the LMtest
(LMerr). To the contrary, with the row-standardized matrix, I cannot
reject the null hypothesis according the LMerr test and the Morantest gives
me a Moran's I statistic standard deviate equal to 0 and a p-value eual to
0.5 (which seems odd?).
So I don?t know which matrix is adequate for which test and if the
results with the row-standardized matrix are ok...
Maybe it comes from the characteristics of my W matrix in which wij=
population j * exp (-dij/h)? , so because of the population terms, its not
a symmetric matrix?
Maybe it comes from the way I row-standardized it, with
?LISTWW<-nb2listw(LISTW$neighbours, glist=NULL, style="W",
zero.policy=FALSE)? ?
Here you have thrown away the general weights implied in your initial representation, use the glist= argument to pass them through. I guess that LISTW$neighbours includes all observations except i as neighbours of i, flattening out the lagged variable completely, and leading to an expected absence of spatial autocorrelation. Moran's I is known to work for asymmetric general weights (weights are made symmetric internally), but the LM tests were developed assuming row standardisation (but not symmetry), so their properties are not well known when the weights are not row standardised, hence the warning - not error. Roger
I thank you in advance for your help. Best regards, Laurence [[alternative HTML version deleted]]
Roger Bivand Department of Economics, NHH Norwegian School of Economics, 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