Skip to contents

You will usually not need to call this function directly. Instead change the E_ext and n species parameters with given_species_params(params) <- and let mizer recalculate the external encounter rate for you. Call setExtEncounter() directly only if you want to impose a different functional form for the size dependence of the external encounter rate. See vignette("guide-change-parameters") for a full explanation of when to reach for which level of the model.

Usage

setExtEncounter(
  params,
  ext_encounter = NULL,
  reset = FALSE,
  ...,
  species = NULL
)

ext_encounter(params)

ext_encounter(params, species = NULL) <- value

Arguments

params

MizerParams

ext_encounter

Optional. An array (species x size) holding the external encounter rate. If not supplied, a default is calculated from the E_ext and n species parameters as described in the section "Setting external encounter rate".

reset

If set to TRUE, then the external encounter rate will be reset to the value calculated from the species parameters, even if it was previously overwritten with a custom value. If set to FALSE (default) then a recalculation takes place for species without a custom value.

...

Unused

species

Optional character vector of species to override or reset. Omit to override or reset the whole array. Values may be full arrays or arrays containing only the selected species. For a single species its values without the species dimension are also accepted: a vector, or a gear x size matrix for the selectivity. Other species keep their existing override status. See rate_overrides() to inspect overrides.

value

ext_encounter

Value

setExtEncounter(): A MizerParams object with updated external encounter rate.

ext_encounter(): An ArraySpeciesBySize object (species x size) with the external encounter rate.

Setting external encounter rate

The external encounter rate is the rate at which a predator encounters food that is not explicitly modelled. It is a rate with units mass/year.

The ext_encounter argument allows you to specify an external encounter rate that depends on species and body size. You can see an example of this in the Examples section of the help page for setExtEncounter().

If the ext_encounter argument is not supplied, then the external encounter rate is calculated as a power law: $$E_{ext.i}(w) = E_{ext.i}\, w^{n_i}.$$ The coefficient \(E_{ext.i}\) is taken from the E_ext column of the species parameter data frame, which defaults to 0. The exponent \(n_i\) is taken from the n column of the species parameter data frame.

With reset = FALSE, manually overridden species are preserved while the other species are recalculated. A message is issued if recalculation would change protected values. See rate_overrides() to inspect overrides.

Examples

params <- newMultispeciesParams(NS_species_params)
#> ℹ No `a` column so using a = 0.01 in w = a l^b, with w in g and l in cm.
#> ℹ No `b` column so using the isometric default b = 3 in w = a l^b.
#> ℹ No h provided for some species, so using age at maturity to calculate it.
#> ℹ Because you have n != p, the default value for `h` is not very good.
#> ℹ Because the age at maturity is not known, I need to fall back to using
#> von Bertalanffy parameters, where available.
#> ℹ Using z0 = z0pre * w_inf ^ z0exp for calculated z0 values.
#> ℹ Using f0, h, lambda, kappa and the predation kernel to calculate gamma.

#### Setting allometric encounter rate #######################

# Set coefficient for each species. Here we choose 0.1 for each species
encounter_pre <- rep(0.1, nrow(species_params(params)))

# Multiply by power of size with exponent, here chosen to be 3/4
# The outer() function makes it an array species x size
allo_encounter <- outer(encounter_pre, w(params)^(3/4))

# Change the external encounter rate in the params object
ext_encounter(params) <- allo_encounter