[R-sig-Geo] RE: [R] adjacency matrix
Orlando Zacarias
si-opz at dsv.su.se
Thu Oct 23 10:44:41 CEST 2003
Yes. i have managed to create the adjacency matrix in GeoDa. What i am now
struggling with is the map conversion from shapefile format to R, and from R
to WinBugs. Since i am running out of time, have downloaded the maptools and
trying to experiment it for data conversion. Will post you my results. BTW i
am working on malaria mapping adapting the hierarchical Bayes model (the
Besag, York and Mollié model).....
Tanxs all for the help and discussion so far.
Rgs,
Orlando.
-------Original Message-------
From: c.declercq at orsnpdc.org
Date: 23 October 2003 10:25:20
To: Roger.Bivand at nhh.no
Cc: anselin at uiuc.edu; r-sig-geo at stat.math.ethz.ch; si-opz at dsv.su.se
Subject: RE: [R-sig-Geo] RE: [R] adjacency matrix
> ----- Original Message -----
> From: "Roger Bivand" <Roger.Bivand at nhh.no>
> To: "Luc Anselin" <anselin at uiuc.edu>
> Cc: <cdeclercq at nordnet.fr>; <r-sig-geo at stat.math.ethz.ch>; "Orlando
> Zacarias" <si-opz at dsv.su.se>
> Sent: Wednesday, October 22, 2003 6:19 PM
> Subject: Re: [R-sig-Geo] RE: [R] adjacency matrix
>
>
> On Wed, 22 Oct 2003, Luc Anselin wrote:
>
> > Another alternative would be to use the "Tools" in GeoDa
> > (free from http://sal.agecon.uiuc.edu/csiss/geoda.html ).
> > This creates contiguity and distance based sparse weights
> > files (in ascii format) directly from point and polygon shape
> > files. The spdep package contains functions to read and
> > manipulate these weights files. I'm not familiar with the
> > format used by WinBUGS, but I doubt it can be very different.
> > L.
>
> >From links from the web page I googled (convert.r AND cgm), and from the
> GeoBUGS manual, their format can be generated, but looks a bit naive as
> is. We could implement it, and/or talk to the GeoBUGS developers about
> using GeoDa (and maybe R/spdep) as a convenient front end - then they
> would avoid having to generate the weights internally. Since they are
> Windows, and WinBUGS is closed source, GeoDa could be a useful
> pre-processing tool (also for spdep weights).
I did not know GeoDa so I will have a look at it.
I'm now working on a project with mortality mapping using smoothing with a
hierarchical Bayes model (the Besag, York and Mollié model) and I'm actually
using R/maptools/spdep as a front end to WinBUGS1.4.
I do all the data preparation for WinBUGS in R, I use the new scripting
facility in WinBUGS1.4 and I get back the samples in R to plot maps of the
estimates with plotpolys(). It works fine for me.
It's easy to get the adjacency data as WinBUGS want them.
Something along the lines of (if 'cantons' is a 'polylist' object):
> cantons.nb<-poly2nb(cantons, bb=cantons.bb) # calculate the neighbourhood
> data<-list(N = length(cantons),
+ O=lungcanc$o, E=lungcanc$e,
+ num=sapply(cantons.nb, length),
+ adj=unlist(cantons.nb),
+ sumNumNeigh=length(unlist(cantons.nb))
+)
Some care is needed in the formating of numbers. I use some of the functions
by Andrew Gelman at http://www.stat.columbia.edu/~gelman/bugsR (a web
appendix to the book Bayesian Data Analysis, Second Edition, by Andrew
Gelman, Donald B. Rubin, Hal S. Stern) to write the ascii files for WInBUGS.
Christophe
--
Christophe DECLERCQ, MD
Observatoire Régional de la Santé Nord-Pas-de-Calais
13, rue Faidherbe 59046 LILLE Cedex FRANCE
Phone +33 3 20 15 49 24
Fax +33 3 20 55 92 30
E-mail c.declercq at orsnpdc.org
.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://stat.ethz.ch/pipermail/r-sig-geo/attachments/20031023/3da73810/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: image/gif
Size: 494 bytes
Desc: not available
URL: <https://stat.ethz.ch/pipermail/r-sig-geo/attachments/20031023/3da73810/attachment.gif>
More information about the R-sig-Geo
mailing list