getPredMort: Get total predation mortality rate

View source: R/rate_functions.R

getPredMortR Documentation

Get total predation mortality rate

Description

Calculates the total predation mortality rate \mu_{p,i}(w_p) (in units of 1/year) on each prey species by prey size:

\mu_{p.i}(w_p) = \sum_j {\tt pred\_rate}_j(w_p)\, \theta_{ji}.

The predation rate pred_rate is returned by getPredRate().

Usage

getPredMort(object, n, n_pp, n_other, time_range, drop = TRUE, ...)

Arguments

object

A MizerParams object or a MizerSim object

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 TRUE then any dimension of length 1 will be removed from the returned array.

...

Unused

Value

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.

Your own predation mortality function

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.

See Also

Other rate functions: getEGrowth(), getERepro(), getEReproAndGrowth(), getEncounter(), getFMort(), getFMortGear(), getFeedingLevel(), getMort(), getPredRate(), getRDD(), getRDI(), getRates(), getResourceMort()

Examples


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))


mizer documentation built on Oct. 17, 2024, 9:07 a.m.