Decision Support Systems
Adjacency For WinBUGS Tool
The Adjacency For WinBUGS Tool is a customization of ArcMap. The tool iteratively processes each polygon within a selected layer and creates a text file of polygonal adjacency where each polygon is identified by a unique Adj_ID value. The output of this tool is used in WinBUGS (MRC Biostatistics Unit Cambridge) by the car.normal, car.l1, and mv.car conditional autoregressive distributions.
“We have been working with a class of models called hierarchical spatial count models (http://www.umesc.usgs.gov/terrestrial/migratory_birds/bird_conservation.html). These models are fitted with Markov chain Monte Carlo methods in WinBUGS. To accommodate the potential for spatial correlation between the responses, we employ a spatial conditional autoregressive component (spatial CAR). This spatial CAR requires an adjacency matrix, i.e., a matrix relating one areal unit to a collection of neighboring areal units. A requirement of this matrix is symmetry. GeoBUGS within the WinBUGS software can facilitate this adjacency matrix creation, but we find it much more convenient to conduct all of our mapping operations in ArcGIS. As such, a tool that facilitates the creation of the adjacency matrix for use in WinBUGS is most useful.”
Dr. Wayne Thogmartin
AdjacencyForWinBUGS.zip
To install:
- Save the file: AdjacencyForWinBUGS.zip to your local hard drive
- Extract contents
- Double click AdjacencyForWinBUGS.esriAddIn file
- Open ArcMap 10
- Click on the Customize menu and the Customize Mode… item
- On the Customize dialog click the Commands tab
- Scroll down and click on Fox Tools in the Categories list
- Drag the Adjacency For WinBUGS button to a toolbar on the ArcMap 10 interface
|
|
Figure 1. The Adjacency For WinBUGS dialog. |
|
To use:
- Click the AdjacencyForWinBUGS button to open the Adjacency For WinBUGS dialog (Figure 1).
- Choose an editable polygon shapefile.
- Click the Browse button and identify the output directory.
- Click OK button.
- Program execution:
- The folder specified by the user in the Output Directory textbox is created.
- The folder’s name will have the following structure: User identified directory + Layer Name + “_Adjacency_“ + Iterative Number.
- Characters within the new folder’s name that are problematic to ArcMap will be replaced with underscore characters.
- Problematic characters include ~`!”@#$%^&*()+=[]{}:;,.’<>?/\ and blank spaces.
- The field Adj_ID is deleted if it already exists in the specified polygon theme.
- The field Adj_ID is added to the selected polygon theme. Each polygon is then number sequentially as they occur in the polygon theme. Polygons are indentified by this value in the output files.
- Polygons are iteratively processed
- The program creates four comma delimited text files in the newly created folder, Raw.txt, Adj.txt, Num.txt, and SumNumNeigh.txt (Figure 2). The values within Raw.txt, Adj.txt, and Num.txt are synchronized with the order of input polygons (i.e. the first line of each file refers to the input polygon Adj_ID = 1, the second line refers to input polygon Adj_ID = 2, etc).
- Raw.txt: each line in the output file contains a list of numbers. The first number in the list is the Adj_ID of the input polygon; all subsequent numbers in the list are the Adj_ID values of polygons adjacent to the input polygon. Only the input polygon’s Adj_ID will be listed if it has no adjacent neighbors.
- Adj.txt: is identical to the Raw.txt file with one exception, the leading Adj_ID value of the input polygon is omitted. If the input polygon does not have any adjacent neighbors, then a blank line is entered.
- Num.txt: contains the number of neighbors for each input polygon.
- SumNumNeigh.txt: the sum of values contained in the Num.txt.
|
|
Figure 2. An example of a polygon input layer and its resulting output file. |
Impact of UMESC Science
Bayesian computation is becoming an increasingly important means of statistical analysis of data. These methods are well-suited to modeling complex data, including spatial data, and software such as WinBUGS and R exist to facilitate these calculations. Unfortunately, these complex spatial data require careful preparation for proper analysis. The Adjacency Tool facilitates this analysis by easily formatting spatial data in ArcGIS, the globally predominant geographic information system. Tools such as the Adjacency Tool help bridge the information gap between statistical software and geographic information systems.
Point of contact: Tim Fox
|