getM2: getM2 method for the size based model

getM2R Documentation

getM2 method for the size based model

Description

Calculates the total predation mortality \mu_{p,i}(w_p) on each prey species by prey size. This method is used by the project_therMizer method for performing simulations.

getM2 method for therMizerParams object with pred_rate argument.

getM2 method for therMizerSim object.

Usage

getM2(object, n, n_pp, ocean_temp, phi_prey, feeding_level, pred_rate, ...)


  ## S4 method for signature 
## 'therMizerParams,matrix,numeric,numeric,matrix,matrix,array'
getM2(object,
  n, n_pp, ocean_temp, phi_prey, feeding_level, pred_rate)


  ## S4 method for signature 
## 'therMizerSim,missing,missing,missing,missing,missing,missing'
getM2(object,
  ocean_temp, time_range = dimnames(object@ocean_temp)$time, drop = TRUE,
  ...)

Arguments

object

A therMizerParams or therMizerSim object.

n

A matrix of species abundance (species x size). Only used if object argument is of type therMizerParams.

n_pp

A vector of the background abundance by size. Only used if object argument is of type therMizerParams.

ocean_temp

A numeric vector of the ocean temperature by realm or a single numeric ocean_temp value which is used for all realms.

pred_rate

An array of predation rates of dimension no. sp x no. community size bins x no. of size bins in whole spectra (i.e. community + background, the w_full slot). The array is optional. If it is not provided it is calculated by the getPredRate() method.

...

Other arguments (currently unused).

time_range

Subset the returned fishing mortalities by time. The time range is either a vector of values, a vector of min and max time, or a single value. Default is the whole time range. Only used if the object argument is of type therMizerSim.

drop

Only used when object is of type therMizerSim. Should dimensions of length 1 in the output be dropped, simplifying the output. Defaults to TRUE

Value

If a therMizerParams object is passed in, the method returns a two dimensional array (prey species x prey size) based on the abundances also passed in. If a therMizerSim object is passed in, the method 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.

See Also

getPredRate and project_therMizer.

Examples

## Not run: 
data(NS_species_params_gears)
data(inter)
params <- therMizerParams(NS_species_params_gears, inter)
# With constant fishing effort for all gears for 20 time steps
sim <- project_therMizer(params, t_max = 20, effort = 0.5)
# Get M2 at one time step
n <- sim@n[21,,]
n_pp <- sim@n_pp[21,]
getM2(params,n,n_pp)
# Get M2 at all saved time steps
getM2(sim)
# Get M2 over the time 15 - 20
getM2(sim, time_range = c(15,20))

## End(Not run)

pwoodworth-jefcoats/Size-Based-Modeling documentation built on Sept. 15, 2023, 8:13 a.m.