Learn R Programming

secrdesign (version 2.9.2)

make.scenarios: Construct Scenario Data Frame

Description

This function prepares a dataframe in which each row specifies a simulation scenario. The dataframe is used as input to run.scenarios.

Usage

make.scenarios(trapsindex = 1, noccasions = 3,  nrepeats = 1, D, g0, sigma, lambda0,
detectfn = 0, recapfactor = 1, popindex = 1, detindex = 1, fitindex = 1, groups,
crosstraps = TRUE)

Value

Dataframe with one row per scenario (or sub-scenario) and the columns

scenario

a number identifying the scenario

group

(optional)

trapsindex

noccasions

nrepeats

D

g0

or lambda0

sigma

detectfn

see detectfn; always numeric

recapfactor

popindex

detindex

fitindex

An attribute `inputs' is saved for possible use in make.array.

Arguments

trapsindex

integer vector determining the traps object to use

noccasions

integer vector for the number of sampling occasions

nrepeats

integer vector of multipliers for D (see Details)

D

numeric vector of values for the density parameter (animals / hectare)

g0

numeric vector of values for the g0 parameter

sigma

numeric vector of values for the sigma parameter (m)

lambda0

numeric vector of values for the lambda0 parameter

detectfn

vector of valid detection function codes (numeric or character)

recapfactor

numeric vector of values for recapfactor (sim.capthist)

popindex

integer vector determining which population model is used

detindex

integer vector determining which detection options are used

fitindex

integer vector determining which model is fitted

groups

character vector of group labels (optional)

crosstraps

logical; if TRUE the output includes all combinations of trapsindex, noccasions and nrepeats

Details

The index in trapsindex is used in run.scenarios to select particular detector arrays from the list of arrays provided as an argument to that function.

The function generates all combinations of the given parameter values using expand.grid. By default, it also generates all combinations of the parameters with trapsindex and the number of sampling occasions. If crosstraps is FALSE then trapsindex, noccasions, and nrepeats are merely used to fill in these columns in the output dataframe.

The argument lambda0 replaces g0 for the hazard detection functions 14--18 (detectfn).

Designs may use multiple detector arrays with the same internal geometry (e.g., number and spacing of traps). The number of such arrays is varied with the nrepeats argument. For example, you may compare designs with many small arrays or a few large ones. In practice, run.scenarios simulates a single layout with density D * nrepeats. This shortcut is not appropriate when animals compete for traps (detector = `single').

fitindex allows a choice of different models when the argument fit.args of run.scenarios is a compound list.

If groups is provided each scenario is replicated to the length of groups and a column `group' is added.

See Also

run.scenarios, scenarioSummary, sim.capthist

Examples

Run this code

make.scenarios(trapsindex = 1, nrepeats = 1, D = c(5,10), sigma = 25,
g0 = 0.2)

Run the code above in your browser using DataLab