getM2 | R Documentation |
getPredMort()
An alias provided for backward compatibility with mizer version <= 1.0
getM2(object, n, n_pp, n_other, time_range, drop = TRUE, ...)
object |
A |
n |
A matrix of species abundances (species x size). |
n_pp |
A vector of the resource abundance by size |
n_other |
A list of abundances for other dynamical components of the ecosystem |
time_range |
A vector of times. Only the range of times is relevant, i.e., all times between the smallest and largest will be selected. The time_range can be character or numeric. |
drop |
If |
... |
Unused |
If a MizerParams
object is passed in, the function returns a two
dimensional array (prey species x prey size) based on the abundances also
passed in. If a MizerSim
object is passed in, the function returns a
three dimensional array (time step x prey species x prey size) with the
predation mortality calculated at every time step in the simulation.
Dimensions may be dropped if they have length 1 unless drop = FALSE
.
By default getPredMort()
calls mizerPredMort()
. However you can
replace this with your own alternative predation mortality function. If
your function is called "myPredMort"
then you register it in a MizerParams
object params
with
params <- setRateFunction(params, "PredMort", "myPredMort")
Your function will then be called instead of mizerPredMort()
, with the
same arguments.
Other rate functions:
getEGrowth()
,
getERepro()
,
getEReproAndGrowth()
,
getEncounter()
,
getFMort()
,
getFMortGear()
,
getFeedingLevel()
,
getMort()
,
getPredRate()
,
getRDD()
,
getRDI()
,
getRates()
,
getResourceMort()
params <- NS_params
# Predation mortality in initial state
M2 <- getPredMort(params)
str(M2)
# With constant fishing effort for all gears for 20 time steps
sim <- project(params, t_max = 20, effort = 0.5)
# Get predation mortality at one time step
M2 <- getPredMort(params, n = N(sim)[15, , ], n_pp = NResource(sim)[15, ])
# Get predation mortality at all saved time steps
M2 <- getPredMort(sim)
str(M2)
# Get predation mortality over the years 15 - 20
M2 <- getPredMort(sim, time_range = c(15, 20))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.