scrdesignGA | R Documentation |
Given any SCR-sensible objective function, scrdesignGA()
implements a genetic algorithm to solve this k-of-n design problem. In the context of SCR, and for a given objective function and landscape, the function finds the best subset of sampling locations (k) from all possible sampling locations (n) . The arguments of this function that are related to the biology of the species should be parameterized using the values that are expected, preferrably informed by previous research.
scrdesignGA(statespace = NULL, alltraps = NULL, fixedtraps = NULL,
ntraps = 9, beta0 = -0.2*5, sigma = 2, N = 100, crit = 1,
verbose = 1, ...)
statespace |
A discretized representation of the study area (state-space), defined as a convex hull around the trapping extent with an additional buffer of approximately |
alltraps |
A two-column dataframe, labelled X and Y accordingly, comprised of all possible trapping locations. These locations should be user-defined after accounting for logistic constraints, primarily accessibility. Design generation then relies on subsetting these locations. |
fixedtraps |
A two-column dataframe, labelled X and Y accordingly, comprised of any fixed sampling locations (e.g., an existing grid around which an optimal design is to be found). The algorithm will find |
ntraps |
The number of traps available for constructing the design. More traps will allow for a larger sample size, providing more data to an SCR model, resulting in improvement in terms of bias and precision of estimates. |
beta0 |
The probability of encounter of an individual across occassions at its activtiy center, specified here as the logaritm of baseline detection probability ( |
sigma |
The spatial scaling parameter in the half-normal encounter model, which relates the baseline encounter probability, |
N |
The number of individuals in the landscape, which is used to determine population density in the statespace. |
crit |
Integer. The design criteria used in the objective function for optimization. Available options are model-based criteria, which optimize:
Additionally, user-defined criteria can also be implement, see |
... |
Below are the descriptions used in the help file for |
popsize |
The size of the population; equivalently, the number of offspring produced each generation. |
keepbest |
The |
ngen |
The number of generations to run. |
cluster |
If non-null, the objective function evaluations for each generation are done in
parallel. |
verbose |
An integer controlling the display of progress during search. If |
A list of class "scrdesign" with the following elements:
des |
A list containing the resulting components of the design-finding process. For more information, see |
statespace |
A 3-column dataframe containing the coordinates (X and Y) and the expected per-pixel density of the discretized state-space. |
alltraps |
A 2-column dataframe containing the coordinates (X and Y) of all possible locations available for traps. |
optimaltraps |
Most importantly, the optimal design produced by the algorithm. A 2-column dataframe containing the selected coordinates (X and Y) of each trap. |
sigma |
The value of sigma, the spatial scaling parameter in the half-normal encounter model, originally specified by the user. |
beta0 |
The value of the encounter probability across sampling occasions, as originally specified by the user. |
For best designs, ngen
should be ~1500
+. Further, the kofnGA
package recommends popsize = 200
, and keepbest = 20
for best performance.
TBD
For more details on the particulars of the kofnGA
genetic algorithm, see the help file for: kofnGA::kofnGA()
. The help file for kofnGA
also provides information on specifying the parallel evaluation of that function, which can also be used here for scrdesignGA
.
#----Load the package----
library(oSCR)
#----Load data from Pakistan----
data(pakistan)
# This loads the statespace: pakSS
# and the possible trap locations: pakTT
#----Plot this data----
plot(pakSS, asp=1, pch=16, col="grey")
points(pakTT, pch=20, cex = 0.5)
#----Run the design-finding algo----
test_design <- scrdesignGA(
statespace = pakSS, alltraps = pakTT, # Study area components
ntraps = 25, # Number of available traps
beta0 = 0.2*5, sigma = 3, crit = 1, # Expected data
popsize = 50, keepbest= 5, ngen = 50 # GA settings
) # FOR BEST DESIGNS: ngen should be ~1500
#----Plot the results----
par(mfrow=c(1,3)) # Setup plotting area
plot(test_design, which=4) # which = 4 plots all three together
par(mfrow=c(1,1)) # Reset plotting area
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.