[R-sig-Geo] RE: [R] adjacency matrix

Orlando Zacarias si-opz at dsv.su.se
Wed Nov 26 13:30:02 CET 2003


Dear list friends,
I should have written this msg before, but so many things happened in
between that made it impossible.... So, i have to thank everybody for the
help, suggestion and discussion on this issue. I have solved the problem by
using GeoDa to produce the adj. matrix and loaded the results of WinBugs run
into arcview to produce my maps. Anyway, i will continue to learn R-software
to avoid all these complications.
Regards,
orlando.

-------Original Message-------

From: cdeclercq at nordnet.fr
Date: 27 October 2003 10:43:00
To: Roger.Bivand at nhh.no; Orlando Zacarias
Cc: r-sig-geo at stat.math.ethz.ch; yuecui at biostat.umn.edu
Subject: RE: [R-sig-Geo] RE: [R] adjacency matrix


> -----Message d'origine-----
> De : r-sig-geo-bounces at stat.math.ethz.ch
> [mailto:r-sig-geo-bounces at stat.math.ethz.ch]De la part de Roger Bivand
> Envoyé : vendredi 24 octobre 2003 22:19

[...]

> > 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))
> > +)
>
> Would it be useful for a function doing this to be put into spdep,
> including checking that things "add up"? Should the function write data
> out to a file - probably not, if you are using bugsR as the interface?

Something generic would be useful but not that simple if you want to take
care of:
- the different models we can use (a simple example is the case where we
have an X variable for ecological regression)
- the different ways to connect R and WinBUGS:
   - export all the data from R in a format WinBUGS can read and do all the
work in WinBUGS
   - driving completely the WinBUGS engine from R (the bugsR approach)
   - a semi-interactive way using some of the bugsR functions to write text
files with data and inits, launching WinBUGS script from R (with something
as 'system("C:/\"Program Files\"/WinBUGS14/WinBUGS14 /par script.txt")', do
what you want in WinBUGS: more iterations, MCMC diagnostics... and save what
you want, get back in R when closing WinBUGS, read the saved files you need
in R to map estimates... It's the way I use now.
>
> Would a similar function to output the polygon boundaries in a
> GeoBUGS-friendly format be helpful - should that rather be in maptools?

I don't use GeoBUGS mapping functions at all for the moment (I use
plotpolys()... and poly2nb()...) but, yes, it should be useful. As I
understand it, GeoBUGS read the S maps format: would converting polylist
from/to S maps be useful?

> This is a very fruitful thread - please keep up the flow of
> ideas, because
> the need for data exchange with WinBUGS is clear and if we can get it
> right, should be useful for quite a large (and growing) group of people.
> Could some of us try to do a very rough mini-HOWTO, possibly with the
> author of convert.r (cc to Yue Cui, thread "adjacency matrix" on r-help
> and r-sig-help)?

Good idea! I can try to write a rough HOW-I sketch if you want. I hope
Orlando has eventually been sucessful in his work and so his experience will
be useful.

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/20031126/88cc70f8/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/20031126/88cc70f8/attachment.gif>


More information about the R-sig-Geo mailing list