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 be predator mass and prey mass. Define the predator/prey mass ratio and its logarithm by
Suppose is the probability density of prey mass in stomachs of predators of mass . Since and , the density on the log-PPMR scale is
The subscript zero anticipates that this density gives equal weight to every prey individual. Similarly, because ,
Working with 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
,
fit_log_ppmr() gives row
weight
For predators of a fixed mass , . The factor disappears when the conditional density is normalized, giving
More generally, if a fit currently represents exponent , changing to gives
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 |
|---|---|
| Number distribution of identifiable prey in stomachs | |
| Diet-biomass distribution under the digestion assumption below | |
| Biomass distribution of identifiable prey in stomachs | |
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 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
The number of prey of mass
observed in stomachs is therefore proportional to their ingestion rate
times
.
Diet biomass is ingestion rate times
,
so it is proportional to observed stomach numbers times
.
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
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 .
Normal distribution
For a normal density with mean and standard deviation ,
The transformed mean is 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.146738Smoothly truncated exponential
The unnormalized density used by dtexp() is
Multiplication by changes only the exponential slope:
The cutoff locations
and steepnesses
are unchanged. The implemented density is numerically normalized over
the intended log-PPMR range
;
see ?dtexp for exact evaluation behavior.
Gaussian mixture
For a mixture
each transformed component has
and its unnormalized mixing weight is
The final 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-13Mixture 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").