Converts each species' feeding-kernel parameters in a mizer model to a fit data frame compatible with the other mizerStomach functions.
Value
A validated fit data frame with one row per model species,
power = 0, min_w_pred = 0, and the family-specific parameters populated
from params. Parameter columns that do not apply to a row contain NA.
Details
A mizer kernel is expressed at the prey-mass weighting exponent
\(q_m = \lambda - 4/3\), where lambda is read from
mizer::resource_params()$lambda. This function first reads the
parameters at
\(q_m\) and then calls transform_fit() to return number-weighted fits
(power = 0). This makes extract_fit() the inverse of
set_kernel_params(), apart from ordinary floating-point error.
Kernel types are mapped as follows:
pred_kernel_type = "lognormal"becomesdistribution = "normal"; its parameters are read frombetaandsigma.pred_kernel_type = "power_law"becomesdistribution = "trunc_exp"; its parameters are read fromkernel_exp,kernel_l_l,kernel_u_l,kernel_l_r, andkernel_u_r.pred_kernel_type = "gaussian_mixture"becomesdistribution = "gauss_mix"; its component vectors are read from the list-columnskernel_p,kernel_mean, andkernel_sd.
Other kernel types cause an error. If the model contains a mixture of kernel
families, mean, sd, and p are returned as list-columns so that
vector-valued Gaussian-mixture parameters and scalar normal parameters can
coexist in the same data frame.
See also
set_kernel_params() for the reverse conversion and
transform_fit() for the weighting transformation. The derivation and a
worked round trip are in
vignette("feeding_kernels", package = "mizerStomach").