config object from the input parameters, and ensure that the inputs
meet the requirements for the model. The returned object is a complete
description of a model run scenario.
1 2 3 4 5 6 7 8
config( initial_population, transitions, parameters, predictors, steps, max_delay = 365L )
Named numeric vector indicating starting population for each life stage. Life stages not specified are assumed to be 0.
Numeric vector of length one indicating the duration to run the model over in days.
Numeric vector of length one. Determines the maximum number of days that a delayed transition can last.
The delay column affects how a transition row is used in the model. In all
cases, a transition row is evaluated with any parameters and predictors,
resulting in a transition value,
t. If there is another row with the same
"from", but either "m" or "per_capita_m" for the "to" stage, this row
will be evaluated as well, resulting in a mortality transition value,
Only delay transitions support "per_capita_m".
In non-delay transitions (where
delay == FALSE), ticks can either advance
to the "to" stage, die, or remain in the "from" stage. In this case,
is interpreted as the probability that a tick in the "from" stage will
advance to the "to" stage at the next time step. The survival rate, or the
probability that a tick will remain in the same "from" life stage, is
1 - (t + m).
In delay transitions (where
delay == TRUE), ticks can either advance to the
"to" stage, or die - there is no survival. In this case,
t is used to
determine the number of days until ticks in the "from" stage will emerge as
ticks in the "to" stage.
t will be vectorized over each day from the
current time step to
max_delay days ahead. The duration of the transition
(in days) will be the index
i of the first element in
t where the
cumulative sum of
t[1:i] is greater than or equal to 1.
Delay transitions support two modes of mortality, "m" and "per_capita_m".
For transitions to "m", the mortality value
m is interpreted as a daily
probability of mortality for each day in the delay transition. This differs
from transitions to "per_capita_m", where
m is the total probability of
mortality over the entire duration of the delay transition.'
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
# We rebuild an example config from its constituent parts. This is successful as # expected, because we're just making a config that's identical to an example. do.call(config, config_ex_1) # If we modify the config to something unsuitable, the function will complain. # For example, if we modify the egg to larvae transition to use a different # function that requires an additional parameter. ## Not run: # We define a super simple function that takes two parameters. prod_fun <- function(x, y, a, b) a * b my_config <- config_ex_1 my_config$transitions[1, 3] <- 'prod_fun' # this will throw an error, because a parameter is missing do.call(config, my_config) # config() will report that parameter "b" is missing for the exponential function. # Adding the parameter should fix the config my_config$parameters[9,] <- list(from = '__e', to = '__l', param_name = 'b', param_value = 1) # Now, this should run without issues do.call(config, my_config) ## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.