[R] R: Moran's I

Roger Bivand Roger.Bivand at nhh.no
Sat Mar 5 11:32:41 CET 2005

On Fri, 4 Mar 2005, Theresa Sinicrope Talley wrote:

> Hi-
> I would like to assign distance classes (lags) to the moran's I test in R.
>  I don¹t have equally spaced points since I was mapping shrubs across a
> landscape (vs. an experiment or survey in a grid).   I somehow need to
> select points based on the distances in the distance matrix (i.e., I need to
> select all pairs of points that occur 0-25 m from each other, 25-50 m,
> etc...).  
> Does anyone have code or a detailed procedure for subsampling or dividing a
> dataset into distance classes for moran¹s I (or mantel test)?
> I know there is sp.correlogram  but I need significance values for each I
> value and I need to use distance lags, not lags of number of polygons.

If you need to follow this up further, please consider moving your reply 
to the r-sig-geo list (access from http://www.r-project.org/Rgeo).

In the spdep package, you can define distance based lists of neighbours 

nb0_25 <- dnearneigh(points, d1=0, d2=25)
nb25_50 <- dnearneigh(points, d1=25, d2=50)

then calculate Moran's I (moran.test()) or a chosen Mantel test
(sp.mantel.mc()) using these lists. You are right that sp.correlogram()
is not appropriate in this setting.

> Any suggestions would be appreciated.
> Best wishes, theresa

Roger Bivand
Economic Geography Section, Department of Economics, Norwegian School of
Economics and Business Administration, Breiviksveien 40, N-5045 Bergen,
Norway. voice: +47 55 95 93 55; fax +47 55 95 93 93
e-mail: Roger.Bivand at nhh.no

More information about the R-help mailing list