The utility function
diet_obj_func computes the distance between an
observed fatty acid signature and a modeled signature computed as a mixture
of mean prey signatures.
A numeric vector of diet composition.
A numeric vector containing an observed fatty acid signature.
A numeric matrix of the mean fatty acid signature for each prey type in the prey library, in column-major format.
An integer indicator of the distance measure to compute. Default value 1.
The power parameter of the chi-square distance measure. Default value 1.
The distance between the observed and modeled signatures.
This is an internal utility function. Consequently, to increase execution
speed, no numeric error checking is performed within
Rather, error checking is presumed to have occurred at a higher level in the
obs_sig is presumed to be a fatty acid signature that has
been prepared for analysis, which is best accomplished by a call to the
prep_sig with the predator data frame. Similarly,
the contents of
mean_sig should be mean signatures computed from
signatures that were prepared for analysis by call to the function
diet is presumed to contain non-negative proportions that
sum to 1.0.
gamma must be compatible with the
Please refer to the vignette and documentation for the functions
dist_between_2_sigs for additional details.
diet_obj_func models a predator signature as a mixture of the mean
prey-type signatures, with the diet proportions as the mixture proportions,
returning the distance between the observed and modeled signatures. The
diet composition of a predator is estimated by minimizing this function with
respect to the
diet using the function Rsolnp::solnp.