USGS - science for a changing world

Upper Midwest Environmental Sciences Center

Home/ Overview/ Science Programs/ Data Library/ Products and Publications/States/ Rivers/Teachers and Students/ Links/ Contact/ Search
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

FoxAdjForWinBUGS.dll

To install:

  1. You will need administrative privileges on your PC to register the DLL file (FoxAdjForWinBUGS.dll).
  2. Save the DLL file to your hard drive.
  3. Start ArcMap.
  4. Select then Tools menu.
  5. Select the Customize… menu item.
  6. Click the Add from file … button on bottom of the Customize dialog.
  7. Navigate to where you saved the DLL file, select the file, and click the Open button.
  8. Click the Commands tab of the Customize dialog.
  9. In the Categories listbox select Fox Tools item.
  10. Drag the AdjacencyForWinBUGS command to an ArcMap toolbar.
  11. Click the Close button on the Customize dialog.

 

 

Figure 1. The Adjacency For WinBUGS dialog.

Figure 1. The Adjacency For WinBUGS dialog.

To use:

  1. Click the AdjacencyForWinBUGS button to open the Adjacency For WinBUGS dialog (Figure 1).
  2. Choose an editable polygon shapefile.
  3. Click the Browse button and identify the output directory.
  4. Click OK button.
  5. Program execution:
    1. The folder specified by the user in the Output Directory textbox is created.
      1. The folder’s name will have the following structure:  User identified directory + Layer Name + _Adjacency_ + Iterative Number.
      2. Characters within the new folder’s name that are problematic to ArcMap will be replaced with underscore characters.
      3. Problematic characters include ~`!”@#$%^&*()+=[]{}:;,.’<>?/\ and blank spaces.
    2. The field Adj_ID is deleted if it already exists in the specified polygon theme.
    3. 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.
    4. Polygons are iteratively processed
    5. 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).
      1. 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.
      2. 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.
      3. Num.txt: contains the number of neighbors for each input polygon.
      4. 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.

Figure 2. An example of a polygon input layer and its resulting output file.


Locations of visitors to this page

Accessibility FOIA Privacy Policies and Notices

Take Pride in America logo USA.gov logo U.S. Department of the Interior | U.S. Geological Survey
URL: http://www.umesc.usgs.gov/managment/dss/adjacency_tool.html
Page Contact Information: Contacting the Upper Midwest Environmental Sciences Center
Page Last Modified: August 4, 2008