Skip to contents

This article explains the weighting convention used by fit_log_ppmr() and transform_fit(). It is the conceptual reference for the shorter discussion in vignette("mizerStomach"). The following article, vignette("feeding_kernels"), applies the same convention to a mizer feeding kernel.

From prey mass to log PPMR

Let w′w' be predator mass and ww prey mass. Define the predator/prey mass ratio and its logarithm by

r=w′w,l=log(r)=log(w′w). r = \frac{w'}{w}, \qquad l = \log(r) = \log\left(\frac{w'}{w}\right).

Suppose fw(w∣w′)f_w(w\mid w') is the probability density of prey mass in stomachs of predators of mass w′w'. Since w=w′e−lw = w'e^{-l} and |dw/dl|=w|dw/dl| = w, the density on the log-PPMR scale is

f0(l∣w′)=wfw(w∣w′). f_0(l\mid w') = w f_w(w\mid w').

The subscript zero anticipates that this density gives equal weight to every prey individual. Similarly, because w=w′/rw=w'/r,

fr(r∣w′)=w′r2fw(w′r|w′). f_r(r\mid w') = \frac{w'}{r^2}f_w\left(\frac{w'}{r}\,\middle|\,w'\right).

Working with ll is convenient because multiplicative predator/prey ratios become additive differences and the package’s fitted families have simple weighting transformations on this scale.

A family of weighted densities

Rows in stomach datasets can represent more than one prey individual through n_prey. At weighting exponent qq, fit_log_ppmr() gives row ii weight

nprey,iwprey,iq. n_{prey,i}w_{prey,i}^{q}.

For predators of a fixed mass w′w', wq=(w′)qe−qlw^q=(w')^q e^{-ql}. The factor (w′)q(w')^q disappears when the conditional density is normalized, giving

fq(l∣w′)=e−qlf0(l∣w′)∫e−ql̃f0(l̃∣w′)dl̃. f_q(l\mid w') = \frac{e^{-ql}f_0(l\mid w')} {\int e^{-q\tilde l}f_0(\tilde l\mid w')d\tilde l}.

More generally, if a fit currently represents exponent q0q_0, changing to q1q_1 gives

fq1(l)∝e−(q1−q0)lfq0(l). f_{q_1}(l) \propto e^{-(q_1-q_0)l}f_{q_0}(l).

This is the exponential tilt implemented by transform_fit(). The function changes fitted parameters; it does not revisit the stomach observations.

Several exponents have useful interpretations:

Exponent Interpretation
q=0q=0 Number distribution of identifiable prey in stomachs
q=2/3q=2/3 Diet-biomass distribution under the digestion assumption below
q=1q=1 Biomass distribution of identifiable prey in stomachs
q=λ−4/3q=\lambda-4/3 Feeding-kernel representation used by set_kernel_params()

These are different summaries of the same stomach observations, not competing definitions of PPMR.

Why diet biomass corresponds to power = 2/3

Suppose prey mass is digested at a rate proportional to w2/3w^{2/3} because the rate is controlled by surface area. If prey remains identifiable until a fixed fraction of its mass has been digested, its identifiable residence time is proportional to

ww2/3=w1/3. \frac{w}{w^{2/3}} = w^{1/3}.

The number of prey of mass ww observed in stomachs is therefore proportional to their ingestion rate times w1/3w^{1/3}. Diet biomass is ingestion rate times ww, so it is proportional to observed stomach numbers times w2/3w^{2/3}. This motivates power = 2 / 3; it is an assumption about digestion, not a universal constant (Jobling 1981; Bromley 1994; Andersen 1999).

Pooling predator sizes

The cancellation of (w′)q(w')^q above occurs within a fixed predator mass. Transforming a pooled species-level fit assumes that the conditional log-PPMR distribution is adequately independent of predator size. If that assumption does not hold, directly fitting the pooled observations at a new power can differ from transforming an old fit. Use plot_ppmr_violins() to investigate the assumption and consider stratified fits when necessary.

Transforming fitted families

The normal, smoothly truncated-exponential, and Gaussian-mixture families are closed under exponential tilting. Let a=q1−q0a=q_1-q_0.

Normal distribution

For a normal density with mean μ\mu and standard deviation σ\sigma,

e−alexp[−(l−μ)22σ2]∝exp[−(l−(μ−aσ2))22σ2]. e^{-al}\exp\left[-\frac{(l-\mu)^2}{2\sigma^2}\right] \propto \exp\left[-\frac{(l-(\mu-a\sigma^2))^2}{2\sigma^2}\right].

The transformed mean is μ−aσ2\mu-a\sigma^2 and the standard deviation is unchanged.

fit_number <- fit_log_ppmr(
  barnes_data,
  "Albacore",
  distribution = "normal",
  power = 0
)
fit_biomass <- transform_fit(fit_number, power = 1)
fit_number[c("power", "mean", "sd")]
#>          power     mean       sd
#> Albacore     0 9.546003 1.146738
fit_biomass[c("power", "mean", "sd")]
#>          power     mean       sd
#> Albacore     1 8.230995 1.146738

Smoothly truncated exponential

The unnormalized density used by dtexp() is

f(l)∝eαl(1+eul(ll−l))(1+eur(l−lr)). f(l) \propto \frac{e^{\alpha l}} {(1+e^{u_l(l_l-l)})(1+e^{u_r(l-l_r)})}.

Multiplication by e−ale^{-al} changes only the exponential slope:

α̃=α−a. \tilde\alpha=\alpha-a.

The cutoff locations ll,lrl_l,l_r and steepnesses ul,uru_l,u_r are unchanged. The implemented density is numerically normalized over the intended log-PPMR range 0≤l≤300\le l\le30; see ?dtexp for exact evaluation behavior.

Gaussian mixture

For a mixture

f(l)=∑j=1kpj𝒩(l∣μj,σj), f(l)=\sum_{j=1}^k p_j \mathcal N(l\mid\mu_j,\sigma_j),

each transformed component has

μ̃j=μj−aσj2,σ̃j=σj, \tilde\mu_j=\mu_j-a\sigma_j^2, \qquad \tilde\sigma_j=\sigma_j,

and its unnormalized mixing weight is

p̃j*=pjexp(−aμj+a2σj22). \tilde p_j^* = p_j\exp\left(-a\mu_j+\frac{a^2\sigma_j^2}{2}\right).

The final p̃j\tilde p_j are obtained by dividing these weights by their sum. The following numerical check compares this parameter transformation with directly tilting a density on a fine grid.

mixture <- list(
  species = "example",
  distribution = "gauss_mix",
  power = 0,
  min_w_pred = 0,
  p = c(0.3, 0.7),
  mean = c(3, 7),
  sd = c(1, 1.5)
)

grid <- seq(-5, 18, length.out = 20001)
dx <- grid[2] - grid[1]
original <- get_density(grid, mixture)
numerical <- exp(-0.7 * grid) * original
numerical <- numerical / sum(numerical * dx)
analytical <- get_density(grid, transform_fit(mixture, power = 0.7))

max(abs(numerical - analytical))
#> [1] 1.453837e-13

Mixture fitting itself can still be sensitive to initialization and degenerate components. The transformation above is exact for the parameters supplied to it, but that does not guarantee that the original mixture was a good fit.

Practical use

Fit directly at the weighting most relevant to the analysis, then use transform_fit() to inspect the implications at other powers. A large diagnostic discrepancy after transformation indicates that the fitted family, the predator-size-independence assumption, or both may be inadequate.

For exact arguments and return structures, see ?fit_log_ppmr, ?transform_fit, and ?get_density. For the additional assumptions that turn a stomach distribution into a feeding kernel, continue with vignette("feeding_kernels").

References

Andersen, Niels G. 1999. “The Effects of Predator Size, Temperature, and Prey Characteristics on Gastric Evacuation in Whiting.” Journal of Fish Biology 54 (2): 287–301.
Bromley, PJ. 1994. “The Role of Gastric Evacuation Experiments in Quantifying the Feeding Rates of Predatory Fish.” Reviews in Fish Biology and Fisheries 4 (1): 36–66.
Jobling, Malcolm. 1981. “Mathematical Models of Gastric Emptying and the Estimation of Daily Rates of Food Consumption for Fish.” Journal of Fish Biology 19 (3): 245–57.