A Technical Description of the WebSim 1.0 Trapping Web Simulation Software

Paul M. Lukacs

Colorado Cooperative Fish and Wildlife Research Unit
Department of Fishery and Wildlife Biology
Colorado State University
Fort Collins, CO 80523


INTRODUCTION


WebSim version 1.0 is a software package that simulates the processes of animals moving about an area and being trapped in a trapping web design. WebSim tracks each animal, creates a file of the captures, calls the DISTANCE analysis engine (Thomas et al. 1998) which calculates density, and summarizes the results of all of the simulations. Two languages compose WebSim, the simulation engine in C++ and the interface in Visual Basic. The WebSim package consists of several files which work together to produce the simulation: WebSim_front.exe (Windows 9x inteface), WebSim.exe (simulation engine), intermed.exe (intermediate communications), awk.exe (file processing), and D35engine.exe (DISTANCE analysis engine, designed and distributed separately). A description of each of those files will follow except for D35engine.exe for which technical information is available from www.ruwpa.st-and.ac.uk/distance.

SIMULATION ENGINE WEBSIM.EXE


The WebSim.exe simulation engine is the brains and muscle behind the WebSim simulation package. The simulation engine keeps track of each animal, all of the traps, and the land area that the animals move around. The simulation engine also computes AICc, delta AICc, model averaged estimates of density and the corresponding variances. The simulation engine is written in C++ and compiled with the Microsoft Visual C++ 6.0 compiler. The Windows interface calls the simulation engine and passes it the user input, or the user may access the simulation engine directly at the command line.

Habitat

The land is set up as a raster grid of 251,001 cells arranged in a 501 by 501 cell square. The program uses an odd number of cells on each side of the square to ensure an exact center square of the grid exists. A preprocessor constant defines the grid size and center, therefore variations in the grid size can be easily accommodated. Each cell can be available for animal to move into (value = 1) or unavailable (value = 0). When the 2-dimensional array of the grid cells is initialized in memory upon execution of the simulation engine, the value of all cells defaults to 0. The user then defines the proportion of the cells given a value of 1. The simulation engine then randomly assigns a value of 1 to a user defined proportion of cells.

The user inputs a scale parameter for the land area. Each cell equals 1*(scale parameter) units on a side. The simulation engine carries the scale parameter through all calculations of distance. The predefined units equal meters for linear measures and hectares for area (DISTANCE requires units to be defined). So long as the user remains consistent the units are irrelevant. The linear measure may be thought of as 1 unit; area, 10,000 square units.

Animals

The simulation engine allows the user to define how many animals compose the simulation population. Any number of animals may be used, memory allowing, if model Mtbh (Otis et al. 1978) is not used. If Mtbh is used,1,000 animals per web is the maximum population size. The animals are stored as a singly linked list of structures. The simulation engine dynamically allocates memory for each animal after the user enters the number of animals to prevent a waste of memory. The program stores a location, capture history, and probability of capture for each time step within the structure of each animal. In the capture history, a capture is indicated by the number of the trap in which the animal was caught and a zero indicates no capture. Even though the habitat is designed as a raster grid, the animals are stored in vector format.

Animals may be distributed in three patterns: uniform random, clustered random, or uniform home range. Under a uniform random distribution, the simulation engine draws random x and y coordinates for each animal independently from a uniform distribution. The clustered random distribution function selects a random location and a random cluster size based on a mean cluster size selected by the user. Both location and cluster size are pulled from a Poisson distribution. The simulation engine evenly spaces animals throughout the grid for a uniform home range distribution.

Two types of movement patterns are available in WebSim, random walk and within home range walk. For the random walk movement, a random distance and direction are pulled from a uniform or exponential distribution. The user enters the maximum distance per movement. Within home range movement are constrained to being within a user defined radius from the center of each animals home range. The center of the home range is arbitrarily defined to be the initial location of the animal. A central tendency is forced on the movement of the animal. A higher probability exists of the animal moving a short distance than a long distance. If an animal encounters the edge of the grid, it is automatically forced to not cross the edge. If the animal encounters unavailable habitat, it moves to the nearest available habitat.

Traps

The user may define up to 200 traps to be set per web. Two input methods exist for designing a web: 1) the user could enter the number of lines, number of traps per line, and the number of traps at the web center or 2) the user could enter the the total number of traps, the number of lines, and the number of traps at the center. The maximum number of traps is defined as a preprocessor constant for ease of accommodating more traps. Each trap is stored as an element of a 2-dimensional array with its x,y coordinates (again in vector), distance to the web center, and status (1=occupied, 0=vacant). By default the web is placed in the center of the raster grid.

If the user does not want an evenly spaced web design, then the coordinates of each trap may be entered individually along with a center point. The simulation engine then calculates the distance from the user defined center to each trap.

Model Mtbh

Animals may be trapped with capture probability varying by time, behavioral response and individual heterogeneity. The model used to generate the varying capture probabilities comes from Burnham (1981). Random values for each factor are pulled from a Beta distribution defined by the alpha and beta parameters entered by the user. The total of all of the effects is run through a logit transformation to insure the capture probability falls within the interval (0-1). This allows the prbability of an animal being trapped given that it is within a defined radius of a trap to vary. If Mtbh is not selected, animals are trapped with probability 1 when they are within a user defined catch radius of a trap. With Mtbh, a capture probability is calculated for each animal.

Running a Simulation

The simulation itself is a set of loops run a user defined number of times. The user enters a number of replicates, webs, trapping occasions, and time steps. For each replicate and web the following actions occur. At the beginning of each trapping occasion, all traps are reset to being available, i.e. all animals are released and traps are open. Then at each time step, the animals move and each are tested for being trapped. Once an animal is trapped, it no longer moves. The user user may select whether traps remain available to other animals until the next trapping occasion or whether the trap holds only one animal. At the end of each simulation, the engine creates a file of the captures and distances. The D35engine is called and density is calculated and stored in an output file.

Model Averaging

The simulation engine calculates model averaged estimates of density based on one of two predefined sets of models: 1)the hazard-rate + simple polynomials, half-normal + Hermite polynomials, and the Fourier series, or 2) half-normal + Hermite polynomials, and the Fourier series(Buckland et al. 1993). For each model the delta AICc value is calculated based on the AIC value, sample size, and number of parameters output in DISTANCE. From the delta AICc values, the simulation engine calculates an Akaike weight for each model. Finally the maximum likelihood estimates of density from is model is multiplied by its Akaike weight and the resulting values are summed to produce a model averaged estimate of density (Burnham and Anderson 1998). An unconditional variance is calculated following Burnham and Anderson (1998). Upper and lower confidence interval bounds are calculated just as the density estimate. The author is working on code to calculate profile likelihood intervals.

WEBSIM_FRONT.EXE WINDOWS 9x INTERFACE

The WebSim_front interface allows the user to enter parameters and view results within a Windows environment. The interface will run in either Windows 95 or 98. For ease of programming a Windows interface, Microsoft Visual Basic 6.0 has been used. Unfortunately, Visual Basic contains many proprietary ocx and dll files, therefore users may have to add or upgrade a few files within their operating system to run the interface.

The interface helps the user interact with the simulation engine in a more user friendly manor. The interface checks for out of range input values. It displays summary statistics of the simulation results and graphs results.

AWK.EXE

Much of the file processing in WebSim has been simplified through the use of awk. Awk is a UNIX utility which has been ported to DOS and may be freely distributed. The simulation engine writes all of the necessary awk code during the simulation run. Several files of code are created, but may be deleted after the run if the user does not want them.

INTERMED.EXE and INTERMED2.EXE

Intermed.exe performs only one function. It communicates between WebSim.exe and WebSim_front.exe. No calculations or file processing occur in intermed.exe. Intermed2.exe formats data for graphing. In the near future I hope to replace both of these executables with a single dynamic link library.


LITERATURE CITED

Buckland, S. T., D. R. Anderson, K. P. Burnham, and J. L. Laake. 1993. Distance sampling: estimating abundance of biological populations. Chapman-Hall, New York.

Burnham, K. P. 1981. Memoradum. A unified, conceptual version of the eight models in Otis et al.

Burnham, K. P. and D. R. Anderson. 1998. Model selection and inference an information theoretic approach. Springer-Verlag, New York.

Otis, D. L., K. P. Burnham, G. C. White, and D. R. Anderson. 1978. Statistical inference from capture data on closed animal populations. Wildlife Monographs 62:1-135.

Thomas, L., J. L. Laake, J. F. Derry, S. T. Buckland, D. L. Borchers, D. R. Anderson, K. P. Burnham, S. Strindberg, S. L. Hedley, M. L. Burt, F. Marques, J. H. Pollard, and R. M. Fewster. 1998. Distance 3.5. Research Unit for Wildlife Population Assessment, University of St. Andrews, UK.