From stomach distributions to mizer feeding kernels
Source:vignettes/feeding_kernels.Rmd
feeding_kernels.RmdA stomach-content distribution is a realized outcome: it depends on predator preference, available prey, ingestion, digestion, and sampling. A mizer feeding kernel (Scott, Blanchard, and Andersen 2014) represents only the prey-size dependence of encounter and selection. Connecting the two therefore requires assumptions.
This article derives the transformation used by
set_kernel_params() and shows how it is applied. The
weighting notation is introduced in
vignette("density_functions"); distribution selection and
diagnostics are discussed in
vignette("PPMR_distributions").
Assumptions
The package uses the following approximation:
- The log predator/prey mass-ratio distribution is adequately independent of predator mass over the fitted range.
- Stomach contents are in a statistical steady state: prey of each size enter stomachs through ingestion at the same average rate at which they cease to be identifiable through digestion.
- The mass digestion rate scales as prey mass to the power (Jobling 1981; Bromley 1994; Andersen 1999).
- The prey community experienced by the predator has number density proportional to .
- Other effects on detectability and stomach residence time do not introduce an additional systematic prey-size dependence.
These assumptions are a modeling choice, not information recovered from the stomach data. The resulting kernel should be interpreted and tested with that uncertainty in mind.
Ingestion
Let be predator mass, prey mass, and . Write the rate density at which a predator ingests prey of mass as
Here is the feeding-kernel shape, is the number density of available prey, and contains factors that depend on predator mass but not prey mass. In a multispecies model, can include species interaction strengths:
The historical prey field experienced by sampled predators is rarely known. The package approximates it by a power-law resource spectrum,
For a mizer model,
is read from mizer::resource_params(params)$lambda; it is
not fixed at two by the package.
Digestion and stomach residence
If prey mass is digested at a rate proportional to and prey remains identifiable until a fixed fraction has been digested, identifiable residence time scales as . The corresponding disappearance rate is
Let be the stomach prey-number density. The steady-state balance assumption is
Substitution gives
and hence, up to factors independent of prey mass,
Express the result on the log-PPMR scale
Let
be the number-weighted probability density of identifiable stomach prey.
The change of variables derived in
vignette("density_functions") gives
Therefore
In the package’s weighting notation, the kernel shape is the stomach distribution represented at
This is exactly the target power used internally by
set_kernel_params(). A fit can have been estimated at any
recorded power; transform_fit() moves it from
that power to
before model parameters are set.
Consequences for fitted families
Suppose a fit was estimated at exponent and let .
For a normal distribution,
mizer represents this as a "lognormal" kernel with
beta = exp(mu_kernel) and
sigma = sigma_kernel.
For a smoothly truncated exponential,
while the two cutoff locations and steepnesses are unchanged. mizer
represents this as a "power_law" kernel using its five
kernel_* columns.
For a Gaussian mixture, the component means and proportions are
transformed as described in vignette("density_functions").
mizer represents the result as a "gaussian_mixture" kernel,
storing the transformed component vectors in the list-columns
kernel_p, kernel_mean, and
kernel_sd.
Worked mizer example
We fit the Atlantic cod diet distribution at
power = 2/3. The North Sea example model calls this species
"Cod", so the fit must be renamed before it is
transferred.
cod_fit <- fit_log_ppmr(
barnes_data,
species = "Atlantic cod",
distribution = "normal",
power = 2 / 3
)
cod_fit
#> mean sd species distribution power min_w_pred
#> Atlantic cod 3.443057 1.276434 Atlantic cod normal 0.6666667 0The model’s resource exponent determines the exact kernel weighting:
params <- mizer::NS_params
kernel_power <- mizer::resource_params(params)$lambda - 4 / 3
kernel_power
#> [1] 0.8
transform_fit(cod_fit, power = kernel_power)
#> mean sd species distribution power min_w_pred
#> Atlantic cod 3.225819 1.276434 Atlantic cod normal 0.8 0set_kernel_params() performs that transformation itself.
Only species present in the supplied fit are changed, and the returned
object must be assigned.
model_cod_fit <- cod_fit
model_cod_fit$species <- "Cod"
rownames(model_cod_fit) <- "Cod"
params <- set_kernel_params(params, model_cod_fit)
subset(
mizer::species_params(params),
species == "Cod",
select = c(species, pred_kernel_type, beta, sigma)
)
#> An object of class "species_params" containing parameters for 1 species:
#> species pred_kernel_type beta sigma
#> Cod lognormal 25.17419 1.276434Extract and inspect existing kernels
extract_fit() reverses the parameter mapping and returns
distributions at power = 0. This allows existing model
kernels to be inspected with plot_log_ppmr_fit(), evaluated
with get_density(), or transformed to another
weighting.
model_fits <- extract_fit(params)
model_fits["Cod", c("species", "distribution", "power", "mean", "sd")]
#> species distribution power mean sd
#> Cod Cod normal 0 4.529247 1.276434
cod_diet_again <- transform_fit(
model_fits["Cod", , drop = FALSE],
power = 2 / 3
)
cod_diet_again[c("power", "mean", "sd")]
#> power mean sd
#> Cod 0.6666667 3.443057 1.276434extract_fit() accepts species_dict when
model and stomach-data names need to be reconciled in the opposite
direction.
cod_from_model <- extract_fit(
params,
species_dict = c(Cod = "Atlantic cod")
)
cod_from_model["Atlantic cod", c("species", "distribution", "power")]
#> species distribution power
#> Atlantic cod Atlantic cod normal 0Interpretation and sensitivity
The fitted kernel is conditional on the assumed prey spectrum and digestion scaling. In particular:
- changing changes the exponential tilt and therefore the kernel mean or slope;
- size-dependent prey availability can be mistaken for predator preference;
- digestion and identification rates may not follow one allometry for all prey types;
- pooled stomach observations can mix different prey fields and predator behaviors; and
- a good fit to stomach densities does not validate the resulting population dynamics.
Treat the transferred parameters as empirically informed starting
values. Evaluate them with the other evidence available for the predator
and with mizer model diagnostics or calibration. Exact parameter
mappings and error conditions are documented in
?set_kernel_params and ?extract_fit.