This function adjusts various model parameters for the selected species so that the model in steady state reproduces the observed catch size distribution, the observed yield and the observed production, if available.
Arguments
- params
A MizerParams object
- species
The species for which to match the catch. Optional. By default all target species are selected. A vector of species names, or a numeric vector with the species indices, or a logical vector indicating for each species whether it is to be selected (TRUE) or not.
- catch
A data frame containing the observed binned catch data. It must contain the following columns:
species: The species for which the catch is recorded.gear: The gear used to collect the catch.length: The start of each bin.dl: The width of each bin.catch: The observed count for each bin.
- lambda
The slope of the community spectrum, used to set the upper bound on
z_ext. Default is 2.05.- z_ext_lim
Upper bound on the optimised
z_extvalue. The hard upper bound derived fromlambdaand growth rate is further capped at this value. Default is 5.- map
An optional named list that fixes specific parameters during optimisation. Use the user-facing parameter names (
"l50","l25","l50_right","l25_right","catchability","z_ext","m"). Each element should be afactorvector whereNAentries fix the corresponding parameter at its initial value; seeTMB::MakeADFun(). By defaultm(the metabolic-rate exponent) is fixed.
Value
A MizerParams object with the adjusted external mortality, gear selectivity, catchability and steady-state spectrum for the selected species.
Details
The function sets new values for the following parameters:
l50: The length at which the gear selectivity is 50%.l25: The length at which the gear selectivity is 25%.l50_right: The length at which the gear selectivity is 50% on the right side (only fordouble_sigmoid_lengthselectivity).l25_right: The length at which the gear selectivity is 25% on the right side (only fordouble_sigmoid_lengthselectivity).catchability: The catchability of the gear.z_ext: The coefficient of the power-law external mortalitymu(w) = z_ext * w^d, wheredis taken fromspecies_params$d.
The observed yield per gear is taken from the yield_observed column of
gear_params(params). The observed production is taken from the
production_observed column of species_params(params).
Only the parameters of the selected species are adjusted. The function then
recalculates the corresponding rate arrays in the params object. It sets the
initial size spectrum to the steady state size spectrum. The total biomass of
each species is then rescaled to match the observed biomass and the
reproduction level is set to zero via mizer::setBevertonHolt().
The function estimates these parameters by minimizing an objective function. The objective function is the negative log likelihood of the observed catch size distribution given the probabilities predicted by the model, multiplied by a catch distribution weight, plus the sum of squares difference between the log of the observed yield and the log of the predicted yield, multiplied by a yield weight, as well as the sum of squares difference between the log of the observed production and the log of the predicted production, multiplied by a production weight.
The catch distribution weight and the yield weight are species-gear-specific:
they are taken from the catch_dist_weight and yield_weight columns of
gear_params(params), each defaulting to 1 for every gear when the column is
absent. The production weight is species-specific: it is taken from the
production_weight column of species_params(params), defaulting to 1 when
that column is absent.
The function deals with missing data in the following way, for each species individually:
If the observed yield is not available for a gear (no positive
yield_observedingear_params), that gear's yield weight is set to 0 and only the catch size distribution and production are matched for it.If the observed production is not available (no
production_observedinspecies_params), the production weight is set to 0 and only the catch size distribution and yield are matched.If the observed catch size distribution is not available (empty
catch), or if a gear'scatch_dist_weightis zero, only the observed yield and the observed production are matched. The selectivity parameters of the affected gears are held fixed.If neither catch size data nor observed production are available, the function issues a warning and returns
paramsunchanged.
The catch predicted by the model is calculated by integrating the catchability and the gear selectivity over the size distribution of the species. The size distribution itself is shaped by the model through the interplay between growth and mortality. This is why the gear selectivity and catchability need to be adjusted together with the other parameters that shape the size distribution.
The objective function is coded in C++ and the TMB package is used to compile
the objective function and to create functions for automatically calculating
the gradients. These are then passed to the nlminb function to minimize the
objective function.
See also
Other match functions:
matchConsumption(),
matchDiet(),
matchExtMortOnce(),
matchGonadicProportionOnce(),
matchProduction(),
matchRespirationOnce()
Examples
params <- matchCatch(celtic_params, species = "Hake", catch = celtic_catch)
plot_catch(params, species = "Hake", catch = celtic_catch)
# The function leaves the biomass of the species unchanged
all.equal(getBiomass(params, use_cutoff = TRUE),
getBiomass(celtic_params, use_cutoff = TRUE),
tol = 1e-4)
#> [1] TRUE
# It also leaves the energy available to an individual for reproduction
# and growth unchanged
all.equal(getEReproAndGrowth(params),
getEReproAndGrowth(celtic_params))
#> [1] "Attributes: < Component “params”: Attributes: < Component “catchability”: Mean relative difference: 0.4664792 > >"
#> [2] "Attributes: < Component “params”: Attributes: < Component “ext_diffusion”: Mean relative difference: 0.7575277 > >"
#> [3] "Attributes: < Component “params”: Attributes: < Component “gear_params”: Component “l50”: Mean relative difference: 0.01827629 > >"
#> [4] "Attributes: < Component “params”: Attributes: < Component “gear_params”: Component “l25”: Mean relative difference: 0.01481484 > >"
#> [5] "Attributes: < Component “params”: Attributes: < Component “gear_params”: Component “catchability”: Mean relative difference: 0.4664792 > >"
#> [6] "Attributes: < Component “params”: Attributes: < Component “given_species_params”: Length mismatch: comparison on first 21 components > >"
#> [7] "Attributes: < Component “params”: Attributes: < Component “given_species_params”: Component “erepro”: Mean relative difference: 131.705 > >"
#> [8] "Attributes: < Component “params”: Attributes: < Component “given_species_params”: Component “R_max”: Mean absolute difference: Inf > >"
#> [9] "Attributes: < Component “params”: Attributes: < Component “given_species_params”: Component “D_ext”: Mean relative difference: 0.7575277 > >"
#> [10] "Attributes: < Component “params”: Attributes: < Component “initial_n”: Mean relative difference: 13.01327 > >"
#> [11] "Attributes: < Component “params”: Attributes: < Component “mu_b”: Mean relative difference: 1.303149 > >"
#> [12] "Attributes: < Component “params”: Attributes: < Component “selectivity”: Mean relative difference: 0.01597085 > >"
#> [13] "Attributes: < Component “params”: Attributes: < Component “species_params”: Component “erepro”: Mean relative difference: 131.705 > >"
#> [14] "Attributes: < Component “params”: Attributes: < Component “species_params”: Component “R_max”: Mean absolute difference: Inf > >"
#> [15] "Attributes: < Component “params”: Attributes: < Component “species_params”: Component “z_ext”: Mean relative difference: 1 > >"
#> [16] "Attributes: < Component “params”: Attributes: < Component “species_params”: Component “D_ext”: Mean relative difference: 0.7575277 > >"
#> [17] "Attributes: < Component “params”: Attributes: < Component “time_modified”: Mean absolute difference: 869680.7 > >"
#> [18] "Mean relative difference: 0.008655613"
# The initial size spectrum is set to the steady state size spectrum
params_steady <- steadySingleSpecies(params)
all.equal(initialN(params), initialN(params_steady))
#> [1] "Attributes: < Component “params”: Attributes: < Component “initial_n”: Mean relative difference: 0.0001951721 > >"
#> [2] "Attributes: < Component “params”: Attributes: < Component “time_modified”: Mean absolute difference: 0.6098933 > >"
#> [3] "Mean relative difference: 0.0001951721"