Add natural mortality to a g3 model

g3a_naturalmortality_exp(
        param_f = g3_parameterized('M', by_stock = by_stock, by_age = TRUE),
        by_stock = TRUE,
        action_step_size_f = ~cur_step_size)

g3a_naturalmortality(
        stock,
        mortality_f = g3a_naturalmortality_exp(),
        run_f = TRUE,
        run_at = g3_action_order$naturalmortality)

Arguments

param_f

A formula to substitute for \(m\).

action_step_size_f

How much model time passes in between runs of action? defaults to ~cur_step_size, i.e. every step. Use action_step_size_f = 1 if action only runs yearly.

by_stock

Change the default parameterisation (e.g. to be by 'species'), see g3_parameterized.

stock

g3_stock mortality applies to.

mortality_f

A mortality formula, as defined by g3a_naturalmortality_exp.

run_f

formula specifying a condition for running this action, default always runs.

run_at

Integer order that actions will be run within model, see g3_action_order.

Details

A model can have any number of g3a_naturalmortality actions, so long as the calling arguments are different. For instance, run_f = ~age == 5 and run_f = ~age == 7.

Value

g3a_naturalmortality_exp

A formula object with the following equation

$$ e^{-m \Delta t} $$

\(\Delta t\)

Length of current step as a proportion of the year, e.g. 0.25. See cur_step_size in g3a_time

g3a_naturalmortality

An action (i.e. list of formula objects) that will, for the given stock...

  1. Remove a proportion of each stock group as calculated by the mortality formula mortality_f

Examples

ling_imm <- g3_stock('ling_imm', seq(20, 156, 4)) %>% g3s_age(3, 10)

# Natural mortality for immature ling
naturalmortality_action <- g3a_naturalmortality(ling_imm)

# NB: M is used in both g3a_naturalmortality and g3a_renewal_initabund, to
# customise, you need to make sure the definitions are in sync, for example:

M <- g3_parameterized('M', by_stock = TRUE, by_age = FALSE)
actions <- list(
    g3a_naturalmortality(ling_imm,
        g3a_naturalmortality_exp(M)),
    g3a_initialconditions_normalparam(ling_imm,
        factor_f = g3a_renewal_initabund(M = M)),
    NULL)