<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"><html>
<head>
<meta name="GENERATOR" content="IncrediMail 1.0">
<!--IncrdiXMLRemarkStart>
<IncrdiX-Info>
<X-FID>FLAVOR00-NONE-0000-0000-000000000000</X-FID>
<X-FVER></X-FVER>
<X-CNT>;</X-CNT>
</IncrdiX-Info>
<IncrdiXMLRemarkEnd-->
</head>
<BODY background="" bgColor=#ffffff style="BACKGROUND-POSITION: 0px 0px; FONT-FAMILY: Arial; FONT-SIZE: 12pt; MARGIN: 5px 10px 10px" scroll=yes ORGYPOS="0" X-FVER="3.0">
<TABLE id=INCREDIMAINTABLE border=0 cellSpacing=0 cellPadding=2 width="95%">
<TR>
<TD id=INCREDITEXTREGION width="100%" style="CURSOR: auto; FONT-FAMILY: Arial; FONT-SIZE: 12pt; PADDING-LEFT: 7px; PADDING-RIGHT: 7px"
>
<DIV>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).....</DIV>
<DIV>Tanxs all for the help and discussion so far.</DIV>
<DIV>Rgs,</DIV>
<DIV>Orlando. </DIV>
<DIV> </DIV>
<DIV id=IncrediOriginalMessage><I>-------Original Message-------</I></DIV>
<DIV> </DIV>
<DIV id=receivestrings>
<DIV dir=ltr style="FONT-SIZE: 11pt" <i><B>From:</B></I> <A
href="mailto:c.declercq@orsnpdc.org">c.declercq@orsnpdc.org</A></DIV>
<DIV dir=ltr style="FONT-SIZE: 11pt" <i><B>Date:</B></I> 23 October 2003
10:25:20</DIV>
<DIV dir=ltr style="FONT-SIZE: 11pt" <i><B>To:</B></I> <A
href="mailto:Roger.Bivand@nhh.no">Roger.Bivand@nhh.no</A></DIV>
<DIV dir=ltr style="FONT-SIZE: 11pt" <i><B>Cc:</B></I> <A
href="mailto:anselin@uiuc.edu">anselin@uiuc.edu</A>; <A
href="mailto:r-sig-geo@stat.math.ethz.ch">r-sig-geo@stat.math.ethz.ch</A>;
<A href="mailto:si-opz@dsv.su.se">si-opz@dsv.su.se</A></DIV>
<DIV dir=ltr style="FONT-SIZE: 11pt" <i><B>Subject:</B></I> RE:
[R-sig-Geo] RE: [R] adjacency matrix</DIV></DIV>
<DIV> </DIV>
<DIV>> ----- Original Message -----</DIV>
<DIV>> From: "Roger Bivand" <<A
href="mailto:Roger.Bivand@nhh.no">Roger.Bivand@nhh.no</A>></DIV>
<DIV>> To: "Luc Anselin" <<A
href="mailto:anselin@uiuc.edu">anselin@uiuc.edu</A>></DIV>
<DIV>> Cc: <<A
href="mailto:cdeclercq@nordnet.fr">cdeclercq@nordnet.fr</A>>; <<A
href="mailto:r-sig-geo@stat.math.ethz.ch">r-sig-geo@stat.math.ethz.ch</A>>;
"Orlando</DIV>
<DIV>> Zacarias" <<A
href="mailto:si-opz@dsv.su.se">si-opz@dsv.su.se</A>></DIV>
<DIV>> Sent: Wednesday, October 22, 2003 6:19 PM</DIV>
<DIV>> Subject: Re: [R-sig-Geo] RE: [R] adjacency matrix</DIV>
<DIV>></DIV>
<DIV>></DIV>
<DIV>> On Wed, 22 Oct 2003, Luc Anselin wrote:</DIV>
<DIV>></DIV>
<DIV>> > Another alternative would be to use the "Tools" in
GeoDa</DIV>
<DIV>> > (free from <A
href="http://sal.agecon.uiuc.edu/csiss/geoda.html">http://sal.agecon.uiuc.edu/csiss/geoda.html</A>
).</DIV>
<DIV>> > This creates contiguity and distance based sparse
weights</DIV>
<DIV>> > files (in ascii format) directly from point and polygon
shape</DIV>
<DIV>> > files. The spdep package contains functions to read
and</DIV>
<DIV>> > manipulate these weights files. I'm not familiar with
the</DIV>
<DIV>> > format used by WinBUGS, but I doubt it can be very
different.</DIV>
<DIV>> > L.</DIV>
<DIV>></DIV>
<DIV>> >From links from the web page I googled (convert.r AND cgm),
and from the</DIV>
<DIV>> GeoBUGS manual, their format can be generated, but looks a bit
naive as</DIV>
<DIV>> is. We could implement it, and/or talk to the GeoBUGS developers
about</DIV>
<DIV>> using GeoDa (and maybe R/spdep) as a convenient front end - then
they</DIV>
<DIV>> would avoid having to generate the weights internally. Since
they are</DIV>
<DIV>> Windows, and WinBUGS is closed source, GeoDa could be a
useful</DIV>
<DIV>> pre-processing tool (also for spdep weights).</DIV>
<DIV> </DIV>
<DIV>I did not know GeoDa so I will have a look at it.</DIV>
<DIV> </DIV>
<DIV>I'm now working on a project with mortality mapping using smoothing
with a</DIV>
<DIV>hierarchical Bayes model (the Besag, York and Mollié model) and I'm
actually</DIV>
<DIV>using R/maptools/spdep as a front end to WinBUGS1.4.</DIV>
<DIV> </DIV>
<DIV>I do all the data preparation for WinBUGS in R, I use the new
scripting</DIV>
<DIV>facility in WinBUGS1.4 and I get back the samples in R to plot maps
of the</DIV>
<DIV>estimates with plotpolys(). It works fine for me.</DIV>
<DIV> </DIV>
<DIV>It's easy to get the adjacency data as WinBUGS want them.</DIV>
<DIV>Something along the lines of (if 'cantons' is a 'polylist'
object):</DIV>
<DIV> </DIV>
<DIV>> cantons.nb<-poly2nb(cantons, bb=cantons.bb) # calculate the
neighbourhood</DIV>
<DIV>> data<-list(N = length(cantons),</DIV>
<DIV>+ O=lungcanc$o, E=lungcanc$e,</DIV>
<DIV>+ num=sapply(cantons.nb, length),</DIV>
<DIV>+ adj=unlist(cantons.nb),</DIV>
<DIV>+ sumNumNeigh=length(unlist(cantons.nb))</DIV>
<DIV>+)</DIV>
<DIV> </DIV>
<DIV>Some care is needed in the formating of numbers. I use some of the
functions</DIV>
<DIV>by Andrew Gelman at <A
href="http://www.stat.columbia.edu/~gelman/bugsR">http://www.stat.columbia.edu/~gelman/bugsR</A>
(a web</DIV>
<DIV>appendix to the book Bayesian Data Analysis, Second Edition, by
Andrew</DIV>
<DIV>Gelman, Donald B. Rubin, Hal S. Stern) to write the ascii files for
WInBUGS.</DIV>
<DIV> </DIV>
<DIV>Christophe</DIV>
<DIV>--</DIV>
<DIV>Christophe DECLERCQ, MD</DIV>
<DIV>Observatoire Régional de la Santé Nord-Pas-de-Calais</DIV>
<DIV>13, rue Faidherbe 59046 LILLE Cedex FRANCE</DIV>
<DIV>Phone +33 3 20 15 49 24</DIV>
<DIV>Fax +33 3 20 55 92 30</DIV>
<DIV>E-mail <A
href="mailto:c.declercq@orsnpdc.org">c.declercq@orsnpdc.org</A></DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV>.</DIV></TD>
</TR>
<TR>
<TD id=INCREDIFOOTER width="100%">
        <TABLE cellPadding=0 cellSpacing=0 width="100%">
        <TR>
        <TD width="100%"></TD>
        <TD align=middle id=INCREDISOUND vAlign=bottom></TD>
        <TD align=middle id=INCREDIANIM vAlign=bottom></TD>
        </TR>
        </TABLE>
</TD>
</TR>
</TABLE><SPAN
id=IncrediStamp><SPAN dir=ltr><FONT face="Arial, Helvetica, sans-serif"
size=2>____________________________________________________<BR><FONT
face="Comic Sans MS" size=2><A
href="http://www.incredimail.com/redir.asp?ad_id=309&lang=9"><IMG
align=baseline alt="" border=0 hspace=0
src="cid:4EA84CD3-D2B8-4198-9839-CD4CE0162AEE"></A> <I>IncrediMail</I> -
<B>Email has finally evolved</B> - </FONT><A
href="http://www.incredimail.com/redir.asp?ad_id=309&lang=9"><FONT
face="Times New Roman" size=3><B><U>Click
Here</U></B></FONT></A></SPAN></SPAN></FONT>
</BODY>
</html>