s-news
[Top] [All Lists]

Spatial Neighbors from Contiguity Matrices

To: splus list <s-news@wubios.wustl.edu>
Subject: Spatial Neighbors from Contiguity Matrices
From: Alastair Dempster <demp2979@mach1.wlu.ca>
Date: Mon, 30 Apr 2001 12:30:46 -0400
Organization: Wilfrid Laurier University
I am having trouble rebuilding a spatial neighbor object from a
contiguity matrix.  (This requires the S+ Spatial Stats module).

atest.grid<-neighbor.grid(4,4, neighbor.type='first')
atest.contig<-spatial.weights(atest.grid)
rebuilt.grid<-spatial.neighbor(neighbor.matrix=atest.contig)
rebuilt.contig<-spatial.weights(rebuilt.grid)


The first line builds a neighbor object and  it has the 48 expected
pairs:
The second line builds the corresponding contiguity matrix from the
neighbor object and is correct.
The third line produces a neighbor object but with only 24 of the
pairs.  It should have the full 48 pairs.
The fourth line produces a contiguity matrix.  It is correct with
the full 48 relationships.

I checked the neighbor objects with summary() as suggested by tech
support at Insightful.  The summaries were identical except that
atest.grid was 'not symmetric' and rebuilt.grid is defined as
symmetric.

By the way,  I have also tried specifying the options on the spatial
neighbor command regarding row and col id, number of regions and
symmetry to no avail. e.g.

rebuilt.grid<-spatial.neighbor(neighbor.matrix=atest.contig, nregion
= 48, symmetric = T)

Why am I missing 24 pairs from the rebuilt spatial neighbor object?
If the spatial neighbor object is missing 24 pairs, how can it
rebuild the contiguity matrix correctly?  Am I misunderstanding the
intended output of spatial.neighbor() or is this behaviour a bug?

Thank you,

Alastair Dempster
Graduate Student
Wilfrid Laurier University
Waterloo, Ontario
Canada
demp2979@mach1.wlu.ca





<Prev in Thread] Current Thread [Next in Thread>