Learn R Programming

secrdesign (version 2.9.2)

Internal: Internal Functions

Description

Functions that are called internally by secrdesign. These are exported and may be called separately for testing etc.

Usage

compactSample (traps, n)

GApenfn(traps, sigma)

'outputtype<-'(object, value)

Value

GApenfn -- a numeric vector with the number of trap pairs separated by 2.5-3.5 sigma and 3.5-4.5 sigma.

compactSample -- an object like traps, but with only n rows.

Arguments

traps

secr trapsobject

n

integer number in sample (\(0 < n \le ntraps)\)

sigma

numeric sparial scale parameter

object

object output from run.scenarios

value

replacement value for outputtype of object

Details

compactSample selects a detector at random and returns the a compact subset of surrounding detectors.

GApenfn is the default pen_fn used by GAoptim When called with a non-null penalty argument.

Values of outputtype map to class of the run.scenarios output as follows

Output typeClasssecrfit
c("fittedmodels", "secrdesign", "list")ipsecrfitc("fittedmodels", "secrdesign", "list")
predictedc("estimatetables", "secrdesign", "list")derived
c("estimatetables", "secrdesign", "list")regionNc("estimatetables", "secrdesign", "list")
coefc("estimatetables", "secrdesign", "list")user
c("estimatetables", "secrdesign", "list")secrsummaryc("summary", "secrdesign", "list")
capthistc("rawdata", "secrdesign", "list")selectedstatistics

Calling the replacement function automatically changes the class of the output object as appropriate. This determines how the output is handled by downstream functions such as summary. Using a custom extractfn or post-processing the output sometimes requires the outputtype to be set manually (see example in the Multi-model section of secrdesign-vignette.pdf).

References

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

See Also

GAoptim,

Examples

Run this code

CStraps <- compactSample(traps(captdata), n = 20)

plot(traps(captdata))
plot(CStraps, add = TRUE, detpar = list(fg = 'blue',pch = 16))

GApenfn(CStraps, sigma = 25)

Run the code above in your browser using DataLab