GAoptim {secrdesign}R Documentation

SECR detector placement by maximisation of a simple criterion

Description

Implements the approach of Durbach et al. (2021) for optimization of detector placement using a genetic algorithm to maximize the lesser of E(n) and E(r), where n is the number of distinct individuals and r is the total number of recaptures. This criterion predicts the relative standard error of the density estimate (Efford and Boulanger 2019).

Users may choose the criterion to be maximised. The number of individuals detected at two or more detectors is an alternative of particular interest (Dupont et al. 2021).

Usage


GAoptim(mask, alltraps, ntraps, detectpar, noccasions, 
    detectfn = c("HHN", "HHR", "HEX", "HAN", "HCG"), D = NULL, 
    criterion = 4, penalty = NULL, seed = NULL, ...)
    

Arguments

mask

mask object

alltraps

traps object with all possible trap locations

ntraps

number of required trap locations

detectpar

list values of detection parameters lambd0, sigma etc.

detectfn

integer code or character string for shape of detection function - see detectfn

noccasions

integer number of sampling occasions

D

numeric density animals per hectare (0.01 km^2)

criterion

integer code for criterion to maximise, or function (see Details)

penalty

list defining penalty for layout in relation to reference grid (optional)

seed

set a random seed for reproducibility of GA

...

other arguments passed to kofnGA

Details

detectpar is a named list with values of the detection parameters for the chosen detectfn. Usually this will be just lambda0 (baseline hazard of detection) and sigma (spatial scale of detection).

The genetic algorithm is provided by function kofnGA from package kofnGA (Wolters 2015). The first three arguments of kofnGA (i.e., n, k, OF) are set by GAoptim. Others may be adjusted by the user via the ... argument. Specifically,

Argument Default Description
ngen 500 number of generations to run
popsize 200 size of the population; equivalently, the number of offspring produced each generation
mutprob 0.01 mutation rate
verbose 0 integer controlling the display of progress during search. If a positive value, then the iteration number and best objective function value are displayed at the console every 'verbose' generations. Otherwise nothing is displayed. The default gives no display.
cluster NULL number of parallel cores or a prebuilt parallel cluster

The default for ngen may (or may not) be larger than is needed for routine use. Durbach et al. (2021) used ngen = 50, popsize = 1000 and mutprob = 0.01.

Density D may be a scalar or a vector of length equal to the number of mask cells. No value need be specified if the sole aim is to optimize trap placement, but D is required for predictions of E(n) and E(r).

Pathological detector layouts (sensu Efford and Boulanger 2019) may be avoided by adding a penalty to the objective. No penalty is applied by default. To apply a penalty, penalty should be a list with named components pen_wt>0 and pen_gridsigma). If a penalty is applied, the default compares the number of trap pairs with close spacing (2.5-3.5 sigma, 3.5-4.5 sigma) to the number in a compact sample from a regular grid with spacing sigma * pen_gridsigma (see internal functions GApenfn and compactSample and the vignette). An alternative penalty function may be supplied as component ‘pen_fn’ of penalty.

The default criterion is the minimum of E(n) and E(r) as used by Durbach et al. (2021). The full list of builtin possibilities is:

Code Description Note
1 E(n) number of distinct individuals
2 E(r) number of recaptures
3 E(m) number of movement recaptures
4 min(E(n), E(r)) minimum E(n), E(r)
5 E(n2) expected number of animals detected at 2 or more sites (cf Qpm Dupont et al. 2021)
6 E(n) + E(n2) (1) + (5) (cf Qpb Dupont et al. 2021)

Criteria 1–4 are computed with function Enrm (see also Efford and Boulanger 2019). Criteria 5–6 are computed with function En2. Any penalty is applied only when criterion = 4.

The criterion may also be a function that returns a single numeric value to be maximised. Arguments of the function should match those of En2, although ... may suffice for some or all (see Examples).

Value

An object of class "GAoptim" that is a list with components

mask

saved input

alltraps

saved input

detectpar

saved input

noccasions

saved input

detectfn

saved input

D

saved input

penalty

saved input

criterion

saved input

des

kofnGA() output object

optimaltraps

traps object with optimized layout

optimalenrms

E(n), E(r), E(m) evaluated with optimized layout

Warnings

Spatial representativeness is not considered, so designs ‘optimised’ with GAoptim are not robust to unmodelled variation in density or detection parameters.

Author(s)

Ian Durbach and Murray Efford.

References

Dupont, G., Royle, J. A., Nawaz, M. A. and Sutherland, C. (2021) Optimal sampling design for spatial capture–recapture. Ecology 102 e03262.

Durbach, I., Borchers, D., Sutherland, C. and Sharma, K. (2021) Fast, flexible alternatives to regular grid designs for spatial capture–recapture. Methods in Ecology and Evolution 12, 298–310. DOI 10.1111/2041-210X.13517

Efford, M. G., and Boulanger, J. (2019) Fast evaluation of study designs for spatially explicit capture–recapture. Methods in Ecology and Evolution, 10, 1529–1535. DOI: 10.1111/2041-210X.13239

Wolters, M. A. (2015) A genetic algorithm for selection of fixed-size subsets with application to design problems. Journal of Statistical Software, Code Snippets, 68, 1–18. DOI 10.18637/jss.v068.c01

See Also

Enrm, En2, minnrRSE, GApenfn, compactSample

Examples




# an artificial example
msk <- make.mask(type = 'rectangular', spacing = 10, nx = 30, ny = 20, buffer = 0)
alltrps <- make.grid(nx = 29, ny = 19, origin = c(10,10), spacing = 10)
set.seed(123)

# 50 generations for demonstration, use more in practice
opt <- GAoptim(msk, alltrps, ntraps = 20, detectpar = list(lambda0 = 0.5, sigma = 20), 
    detectfn = 'HHN', D = 10, noccasions = 5, ngen = 50, verbose = 1)

plot(msk)
plot(opt$optimaltraps, add = TRUE)
minnrRSE(opt, distribution = 'binomial')

# Using a criterion function
# En2 is unsuitable as a criterion function as it returns 2 values
# This function selects the second as the (unique) criterion
fn <- function(...) En2(...)[2]
opt2 <- GAoptim(msk, alltrps, ntraps = 20, detectpar = list(lambda0 = 0.5, sigma = 20), 
    detectfn = 'HHN', D = 10, noccasions = 5, ngen = 50, verbose = 1, criterion = fn)
    



[Package secrdesign version 2.9.1 Index]