From contiguity matrices to neighbours lists

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view

From contiguity matrices to neighbours lists

Millo Giovanni
An embedded and charset-unspecified text was scrubbed...
Name: not available
URL: <>

Reply | Threaded
Open this post in threaded view

From contiguity matrices to neighbours lists

Roger Bivand
On Tue, 25 May 2004, Millo Giovanni wrote:

> Dear all,
> Having previously constructed by hand a (plain vanilla) contiguity
> matrix among n regions, i.e. nxn with x_ij=1 if i and j are neighbours,
> 0 otherwise, we wondered if there is some convenient function for
> transforming this into a neighbours list in order to carry on an
> analysis in spdep.

mat2listw(<your matrix>)$neighbours should do it.

> Else, if we are forced to do this by hand, it would be good to have a
> precise spec sheet of "how an nb object should look like"... We didn't
> find that in the spdep manual, maybe because it is easier than we think
> :^).
I'll add this to the documentation TODO - are vignettes or regular help
files preferable?

> Third way: we have a map of the regions of interest (Italy, NUTS3) in
> the maps package, maybe there is some conversion tool towards "nb"?

This will be happening, as of now in relation to the "sp" package on
sourceforge, but it hasn't happened yet. Keeping the region names
associated with the polygons is essential, and knowing when to use
multi-polygons (how many polygons make up a region) too, so there is
plenty to do -- help welcome!


> Thank you for your help
> Giovanni Millo
> R&D Dept.
> Assicurazioni Generali SpA
> Trieste, Italy
> Ai sensi del D.Lgs. 196/2003 si precisa che le informazioni contenute in questo messaggio sono riservate ed a uso esclusivo del destinatario. Qualora il messaggio in parola Le fosse pervenuto per errore, La invitiamo ad eliminarlo senza copiarlo e a non inoltrarlo a terzi, dandocene gentilmente comunicazione. Grazie.<BR><BR>Pursuant to Legislative Decree No. 196/2003, you are hereby informed that this message contains confidential information intended only for the use of the addressee. If you are not the addressee, and have received this message by mistake, please delete it and immediately notify us. You may not copy or disseminate this message to anyone. Thank you.
> [[alternative HTML version deleted]]

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

Roger Bivand
Department of Economics
Norwegian School of Economics
Helleveien 30
N-5045 Bergen, Norway