<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<META NAME="Generator" CONTENT="MS Exchange Server version 6.5.7654.12">
<TITLE>Re: Converting nb list containing areas with no neighbours with nb2WB()</TITLE>
</HEAD>
<BODY>
<!-- Converted from text/plain format -->
<P><FONT SIZE=2>Hi everyone,<BR>
<BR>
Thank you in advance for your advice. I am trying to convert a nb object containing a single area with no neighbours into a spatial weights list for input into WinBUGS using nb2WB().<BR>
<BR>
When I tried to run the CAR models in WinBUGS using the spatial weights list via R2WinBUGS, I encountered a WinBUGS trap. The error message was "Index out of range".<BR>
<BR>
I checked the adjacency matrix of the spatial weights list output object, and a zero integer was placed at the position corresponding to the area with no neighbours.<BR>
<BR>
When I re-ran the analysis after I changed my neighbourhood structure such that all areas had neighbours, the WinBUGS simulation ran fine.<BR>
<BR>
Is there a way to format the spatial weights list object via nb2WB() in a way that allows WinBUGS to read cases with no neighbours?<BR>
<BR>
In WinBUGS, if we were to enter the adjacency matrix manually it will be:<BR>
<BR>
<BR>
#Here is where we tell BUGS how to set up the adjacency structure. For example, site 1 neighbors sites 19,9, and 5.<BR>
<BR>
adj = c(<BR>
19, 9, 5,<BR>
10, 7,<BR>
12,<BR>
28, 20, 18,<BR>
19, 12, 1,<BR>
#Site 6 has no neighbors<BR>
17, 16, 13, 10, 2,<BR>
and so on.<BR>
)<BR>
<BR>
<BR>
Here are my OS details:<BR>
R version 2.10.0 (2009-10-26)<BR>
i386-pc-mingw32<BR>
locale:<BR>
[1] LC_COLLATE=English_Singapore.1252 LC_CTYPE=English_Singapore.1252 LC_MONETARY=English_Singapore.1252<BR>
[4] LC_NUMERIC=C LC_TIME=English_Singapore.1252 <BR>
attached base packages:<BR>
[1] stats graphics grDevices utils datasets methods base <BR>
other attached packages:<BR>
[1] R2WinBUGS_2.1-16 spdep_0.4-52 nlme_3.1-96 coda_0.13-4 MASS_7.3-3 <BR>
[6] Matrix_0.999375-32 lattice_0.17-26 spam_0.15-5 boot_1.2-41 maptools_0.7-26 <BR>
[11] foreign_0.8-38 sp_0.9-47 deldir_0.0-10 <BR>
loaded via a namespace (and not attached):<BR>
[1] grid_2.10.0 tools_2.10.0<BR>
<BR>
Best,<BR>
Xingli Giam<BR>
<BR>
<BR>
<BR>
</FONT>
</P>
</BODY>
</HTML>