Calculates the total mortality rate \(\mu_i(w)\) (in units 1/year) on each species by size from predation mortality, background mortality and fishing mortality for a single time step.
Arguments
- object
A MizerParams or MizerSim object.
- ...
Additional arguments that depend on the class of
object.For a MizerParams object:
nA matrix of species abundances (species x size). Defaults to the initial abundances stored in
object.n_ppA vector of the resource abundance by size. Defaults to the initial resource abundance stored in
object.n_otherA named list of the abundances of other dynamical components. Defaults to the initial values stored in
object.effortA numeric vector of the effort by gear or a single numeric effort value which is used for all gears. Defaults to the initial effort stored in
object.tThe time for which to do the calculation. Defaults to 0.
For a MizerSim object:
time_rangeThe time range over which to return the rates. Either a vector of values, a vector of min and max time, or a single value. Defaults to the whole time range of the simulation.
dropIf
TRUEthen any dimension of length 1 is removed from the returned array.
Value
MizerParams: AnArraySpeciesBySizeobject (species x size) with the total mortality rates.MizerSim: AnArrayTimeBySpeciesBySizeobject (time step x species x size) with the total mortality rates at every time step. Ifdrop = TRUEthen dimensions of length 1 will be removed.
Details
If your model contains additional components that you added with
setComponent() and for which you specified a mort_fun function then
the mortality inflicted by these components will be included in the returned
value.
Your own mortality function
By default getMort() calls mizerMort(). However you can
replace this with your own alternative mortality function. If
your function is called "myMort" then you register it in a MizerParams
object params with
Your function will then be called instead of mizerMort(), with the
same arguments.
Examples
# \donttest{
params <- NS_params
# Project with constant fishing effort for all gears for 20 time steps
sim <- project(params, t_max = 20, effort = 0.5)
# Get the total mortality at a particular time step
mort <- getMort(params, n = N(sim)[15, , ], n_pp = NResource(sim)[15, ],
t = 15, effort = 0.5)
# Mortality rate at this time for Sprat of size 2g
mort["Sprat", "2"]
#> [1] 1.640475
# }
