Volume 10, Issue 2
In and Out
Download This Issue
Staff and Contributors
Individual-Based Models of the Spread of Disease, Weeds, and Insects
Maps as Sparse Arrays
The state of these models at any time is represented as a map, which is a two-dimensional rectangular array of rectangular cells. Each cell contains information about the local environment and the population structure of the spreading organism. Usually the initial population of the organism in question is small but the area where spread may occur is large. Consequently it is desirable to represent the map as a sparse array. Data type definitions for a typical map follow.
The map includes a list of occupied cells, an array of indices that refer to the list of occupied cells, and a coordinate pair that specifies the physical size of the cells.
The size of the cell is defined by a pair of positive real numbers representing side lengths.
mapArray is a rectangular array of nonnegative integers. Their positions in mapArray correspond to the physical location of that cell on the map. The integers in mapArray are the positions of the respective cells in cellList, and 0s denote unoccupied cells.
cellList is simply a list of cells. Cells are added to the cell list only when those cells become occupied.
The cells contain the position of the cell in mapArray and information about the environment and population of the spreading organism. The example given here is for European House Borer, described in the Spread of Insects section. When cells are occupied, habitat information is generated based on a corresponding habitat map.
The position of a cell in mapArray is defined by a pair of positive integers using the data type mapCoordinatePair which has special cases including outOfBounds. The functions row and column are selectors of both the mapCoordinatePair and realCoordinatePair data types.
The data type cohortList contains collections of the data type cohort.
Upvalues for cohortList and cohort have been defined with respect to the operation Plus.
The cohort data type contains information on the time of infestation, number of habitats infested, total number of larvae present, and the number of adults that have been produced.
In each time-step individuals will spread from each of the occupied cells. This type of data structure makes it easy to process only the occupied cells, ignoring the empty cells.
Spread Along a Path
Movement of individual organisms occurs along a path and the distance travelled is chosen from a probability distribution. We often find it useful to use a half-Cauchy distribution for this purpose. The Cauchy distribution has a history of use in this role [1, 2, 3] and is defined in the standard package Statistics`ContinuousDistributions`.
Spread distance for each organism that is moving is generated using the following function where medianDistance is the median spread distance.
The Cauchy distribution is a fat-tailed bell-shaped distribution.
For the Cauchy distribution the probability that a spreading organism will come to rest per unit of distance, decreases with distance. For the following example where the median spread distance is 5 units, more than 6% of the organisms travel a distance greater than 50 units and more than % a distance greater than units.
This contrasts markedly with spread generated by an exponential distribution, where the probability that a spreading organism will come to rest per unit of distance is constant.
For a straight radial path the following function produces the new location as a realCoordinatePair from the starting location, radial distance travelled, and angle of travel. This function is a straightforward conversion from polar to rectangular coordinates.
The angle is in degrees.
Structure of a Model
Models are typically structured as loops that cycle once per movement event. The loops execute procedures which operate on the map to spread organisms, advance the life cycle of organisms, or alter the environment. The example given here is for European House Borer which migrates once per generation of the insect.
populationMap is the map; spreadParam, maxFlights, habitatDetectabilityParameter, effectiveEggsPerAdult, and optimumMigrationSurvival are predefined parameters that affect the rate of buildup of populations and movement of individuals.
The functions spreadAdults and layEggs are both loops that operate on each occupied cell of the map.
spreadAdults has the attribute HoldFirst and modifies the map directly.
The function occupiedCellsOf is a selector of the map data type that returns the total number of occupied cells, aCell is a selector of the map data type that returns the cell in the cellList of the map corresponding to the index i, and mapCoordinatePairOf is a selector of the cell data type that returns the mapCoordinatePair of the cell. The function adultEmergence calculates the number of adult beetles that will emerge from the cell and updates the number of larvae living in the cell and the amount of remaining food resources in the cell. adultEmergence returns an instance of the data type adultEmergenceData which contains the updated cell and the number of mobile adults and has selectors cellOf and mobileAdultsOf.
The function changeACell is an operator on the map data type that replaces the cell at position i in the cellList of the map. The function spreadAnAdult is evaluated for each mobile adult. It makes use of the function flightPath described in the Spread of Insects section and returns the mapCoordinatePair of the endpoint of the migration path. If the insect dies, nowhere is returned. New cells are added to the map during this process. The function inBounds returns True for any mapCoordinatePair that is not nowhere or outOfBounds. The function addAdults adds 1 to the newMobileAdults of the cell destination of the map.
The function layEggs calculates the number of remaining unoccupied habitats in each cell. The number of newly infested habitats is the least of the number of remaining uninfested habitats and the number of mobile adults that have landed in the cell.
The function cellSizeOf is a selector of the map data type. The function areaOf is a selector of the realCoordinatePair data type that returns the product of the coordinates. The functions newMobileAdultsOf, habitatProfileOf, and cohortListOf are selectors of the cell data type. The function habitatDensity is a selector of the habitatProfile data type, and the function totalInfestedHabitats is a selector of the cohortList data type that returns the sum of habitatsInfested from the cohorts.
Output Using ListDensityPlot
The following is an example that illustrates the use of ListDensityPlot to produce plots of population density of an organism with an overlay of boundary lines imported from a Geographic Information System (GIS). The population density data represents a 300 by 350 grid of 50m square cells. The raw GIS Data was imported from an ASCII file using the function Import["FILENAME.ASC", "Table"].
This function puts the data into a form recognisable by Mathematica as sets of coordinates.
The function metresToGrid converts the coordinates from metres to grid intervals shifted to the appropriate location on the figure.
This function produces a list of graphics primitives suitable for use as an Epilog in ListDensityPlot.
This function produces a not very realistic table of population densities.
The function colourFn is the ColorFunction that will be used in ListDensityPlot.
The option AspectRatio is set to the ratio of the number of rows of the grid to the number of columns of the grid. The options PlotRange->All and ColorFunctionScaling->False are necessary so the data is not clipped or scaled.
About Mathematica | Download Mathematica Player
© Wolfram Media, Inc. All rights reserved.