R/wrapper_functions.R
newTraitParams.Rd
This functions creates a MizerParams
object so that trait-based
models can be easily set up and run. A trait-based size spectrum model is
a simplification of the general size-based model used in
mizer
. The species-specific parameters are the same for all species,
except for
the asymptotic size, which is considered the most important trait
characterizing a species. Other parameters are related to the asymptotic
size. For example, the size at maturity is given by w_inf * eta
,
where eta
is
the same for all species. For the trait-based model the number of species is
not important. For applications of the trait-based model see Andersen &
Pedersen (2010). See the mizer
vignette for more details and examples
of the trait-based model.
newTraitParams( no_sp = 11, min_w_inf = 10, max_w_inf = 10^3, min_w = 10^(-4), max_w = max_w_inf, eta = 10^(-0.6), min_w_mat = min_w_inf * eta, no_w = log10(max_w_inf/min_w) * 50 + 1, min_w_pp = NA, w_pp_cutoff = min_w_inf, n = 2/3, p = n, lambda = 2.05, r_pp = 0.1, kappa = 0.005, alpha = 0.4, ks = 4, h = 30, beta = 100, sigma = 1.3, f0 = 0.6, gamma = NA, bmort_prop = 0, starv_coef = 10, rfac = 4, knife_edge_size = 1000, gear_names = "knife_edge_gear", egg_size_scaling = FALSE, perfect_scaling = FALSE, ... )
no_sp | The number of species in the model. The default value is 11. |
---|---|
min_w_inf | The asymptotic size of the smallest species in the community. Default value is 10. This will be rounded to lie on a grid point. |
max_w_inf | The asymptotic size of the largest species in the community. Default value is 1000. This will be rounded to lie on a grid point. |
min_w | The size of the the egg of the smallest species. Default value is 10^(-4). This also defines the start of the community size spectrum. |
max_w | The largest size in the model. By default this is set to
the largest asymptotic size |
eta | Ratio between maturity size and asymptotic size of a species.
Ignored if |
min_w_mat | The maturity size of the smallest species. Default value is
|
no_w | The number of size bins in the community spectrum. These bins will be equally spaced on a logarithmic scale. Default value is such that there are 50 bins for each factor of 10 in weight. |
min_w_pp | The smallest size of the plankton spectrum. By default this is set to the smallest value at which any of the consumers can feed. |
w_pp_cutoff | The largest size of the plankton spectrum. Default
value is max_w_inf unless |
n | Scaling exponent of the maximum intake rate. Default value is 2/3. |
p | Scaling exponent of the standard metabolic rate. By default this is
equal to the exponent |
lambda | Exponent of the abundance power law. |
r_pp | Growth rate parameter for the plankton spectrum. Default value is 0.1. |
kappa | Coefficient in abundance power law. Default value is 0.005. |
alpha | The assimilation efficiency of the community. The default value is 0.4. |
ks | Standard metabolism coefficient. Default value is 4. |
h | Maximum food intake rate. Default value is 30. |
beta | Preferred predator prey mass ratio. Default value is 100. |
sigma | Width of prey size preference. Default value is 1.3. |
f0 | Expected average feeding level. Used to set |
gamma | Volumetric search rate. If not provided, default is determined
by |
bmort_prop | The proportion of the total mortality that comes from background mortality, i.e., from sources other than predation or fishing. A number in the interval [0, 1). Default 0. |
starv_coef | Proportionality constant for starvation mortality. When starv_coef is equal to 10 the instantaneous starvation mortality (1/year) is 1 when energy deficit is 10 is no starvation mortality |
rfac | The factor such that |
knife_edge_size | The minimum size at which the gear or gears select fish. A vector with the length equal to the number of gears. |
gear_names | The names of the fishing gears. A character vector, the same length as the number of gears. Default is "knife_edge_gear". |
egg_size_scaling | Boolean. Default FALSE. If TRUE, the egg size is a
constant fraction of the maximum size of each species. This fraction is
|
perfect_scaling | Boolean. Default FALSE. If TRUE then parameters are set so that the community abundance, growth before reproduction and death are perfect power laws. |
... | Other arguments to pass to the |
An object of type MizerParams
The function has many arguments, all of which have default values. Of particular interest to the user are the number of species in the model and the minimum and maximum asymptotic sizes.
The characteristic weights of the smallest species are defined by
min_w
(egg size), min_w_mat
(maturity size) and
min_w_inf
(asymptotic size). The asymptotic sizes of
the no_sp
species
are logarithmically evenly spaced, ranging from min_w_inf
to
max_w_inf
.
Similarly the maturity sizes of the species are logarithmically evenly
spaced, so that the ratio eta
between maturity size and asymptotic
size is the same for all species. If egg_size_scaling = TRUE
then also
the ratio between asymptotic size and egg size is the same for all species.
Otherwise all species have the same egg size.
In addition to setting up the parameters, this function also sets up an initial condition that is close to steady state.
Although the trait based model's steady state is often
stable without imposing a stock recruitment relationship, the function can
set a Beverton-Holt type stock recruitment relationship that imposes a
maximal reproduction rate that is a multiple of the recruitment rate at
steady state. That multiple is set by the argument rfac
.
The search rate coefficient gamma
is calculated using the expected
feeding level, f0
.
The option of including fishing is given, but the steady state may lose its
natural stability if too much fishing is included. In such a case the user
may wish to include stabilising effects (like rfac
) to ensure the
steady state is stable. Fishing selectivity is modelled as a knife-edge
function with one parameter, knife_edge_size
, which is the size at
which species are selected. Each species can either be fished by the same
gear (knife_edge_size
has a length of 1) or by a different gear (the
length of knife_edge_size
has the same length as the number of species
and the order of selectivity size is that of the asymptotic size).
The resulting MizerParams
object can be projected forward using
project()
like any other MizerParams
object. When projecting
the model it may be necessary to reduce dt
below 0.1 to avoid any
instabilities with the solver. You can check this by plotting the biomass or
abundance through time after the projection.
Other functions for setting up models:
newCommunityParams()
,
newMultispeciesParams()
,
newSheldonParams()
if (FALSE) { params <- newTraitParams() sim <- project(params, t_max = 5, effort = 0) plotSpectra(sim) }