Skip to content
Prev 15357 / 29559 Next

How to import distance based spatial weight matrix into R to produceMoran's I

On Sat, 16 Jun 2012, ya wrote:

            
Do please read the posting guide, and the help pages of the functions 
involved, noting the classes of the objects passed as arguments. Your 
quoted code is unhelpfull, as foreign is superfluous, but you do not say 
which package moran() comes from. Please try to create a reprodicible 
example, once you have re-examined your workflow (I suggest writing out 
your sparse spatial weights from Matlab as a three-column text file, and 
reading that into R as a listw object using read.dat2listw() in spdep.

Roger

PS. Never use attach, it only makes problems more opaque.