These functions check the validity of a species parameter frame and, where
necessary, make corrections. validGivenSpeciesParams() only checks and
corrects the given species parameters but does not add default values for
species parameters that were not provided. validSpeciesParams() first calls
validGivenSpeciesParams() but then goes further by adding default values
for species parameters that were not provided.
Value
For validSpeciesParams(): A valid species parameter data frame with
additional parameters with default values.
For validGivenSpeciesParams(): A valid species parameter data frame
without additional parameters.
Details
validGivenSpeciesParams() checks the validity of the given species
parameters. It throws an error if
the
speciescolumn does not exist or contains duplicatesthe asymptotic size
w_infis not specified for all species (but see the backwards-compatibility note below)
If a weight-based parameter is missing but the corresponding length-based
parameter is given, as well as the a and b parameters for length-weight
conversion, then the weight-based parameters are added. If both length and
weight are given, then weight is used and an info_about_default condition
is signalled if the two are inconsistent.
The required maximum-size parameter is w_inf, the von Bertalanffy
asymptotic size of an average individual. For backwards compatibility, if no
w_inf column is given, its values are taken from the w_repro_max column
if that is present, or otherwise from the w_max column, and an
informational message is issued. (w_repro_max is preferred over w_max
because in earlier versions of mizer it was the size at which growth stopped
and is therefore the closest analogue to the asymptotic size.)
Some inconsistencies in the size parameters are resolved as follows:
Any
w_matthat is not smaller thanw_infis set tow_inf / 4.Any
w_mat25that is not smaller thanw_matis set to NA.Any
w_minthat is not smaller thanw_matis set to0.001orw_mat /10, whichever is smaller.Any
w_repro_maxthat is not larger thanw_matis set to4 * w_mat.
The row names of the returned data frame will be the species names.
If species_params was provided as a tibble it is converted back to an
ordinary data frame.
The function tests for some typical misspellings of parameter names, like wrong capitalisation or missing underscores and issues a warning if it detects such a name.
validSpeciesParams() first calls validGivenSpeciesParams() but then
goes further by adding default values for species parameters that were not
provided. The function sets default values if any of the following species
parameters are missing or NA:
w_maxis set to1.5 * w_inf(it is only a computational boundary)w_repro_maxis set tow_infw_matis set tow_inf/4w_minis set to0.001alphais set to0.6interaction_resourceis set to1nis set to3/4pis set tonz_extis set to0dis set ton - 1E_extis set to0D_extis set to0
Note that the species parameters returned by these functions are not
guaranteed to produce a viable model. More checks of the parameters are
performed by the individual rate-setting functions (see setParams() for the
list of these functions).
