Skip to contents

Building model

Functions to prepare model parameters and control interaction states.

newAllometricParams()
Set up parameters for a model with allometric encounter and mortality rates
newVonBertalanffyParams()
Create model with von Bertalanffy growth rates in the steady state
isAllometric()
Test whether a model has allometric encounter and mortality rates
makeInteracting()
Enable predator–prey interactions using an interaction matrix
makeNoninteracting()
Make model non-interacting
setFeedingLevel()
Set constant feeding level for each species in a non-interacting model
setFeedingLevels()
Set feeding levels while maintaining constant growth and reproduction
bindParams() experimental
Combine several MizerParams objects

Calibrating model

Tools to match model output to empirical observations.

matchCatch()
Match the observed catch and yield
matchConsumption()
Match the model's total consumption to observed estimates
matchGonadicProportionOnce()
Match the gonadic proportion of a species to a given value.
matchDiet()
Match the diet matrix of the model to an observed diet matrix
alignResource()
Align resource abundance to fish abundance
setResourceInteraction()
Set resource interaction to absorb external encounter rate

Working with Ecopath

Functions for importing and validating data.

addEcopathParams()
Add Ecopath parameters to species parameters
addEcopathCatchTotal()
Sets up gear parameters from Ecopath catch data
reduceEcopathDiet()
Reduce Ecopath diet matrix to mizer species
validEcopathParams()
Validate Ecopath parameter data frame
validEcopathCatch()
Validate Ecopath Catch data frame
fillDefaultsFromFishBase()
Fill Species Traits Using FishBase

Shiny gadget

Interactive interface for tuning mizer model parameters.

tuneEcopath() experimental
Launch shiny gadget for matching mizer model to Ecopath data
tuneParams()
Launch shiny gadget for tuning parameters
tuneGrowth()
Tune Growth
tuningGadget()
Launch a customisable shiny gadget for tuning mizer parameters
abundanceTab() abundanceTabUI()
Abundance tab for tuning gadget
biomassTab() biomassTabUI()
Biomass tab for tuning gadget
catchTab() catchTabUI()
Catch tab for tuning gadget
deathTab() deathTabUI()
Death tab for tuning gadget
dietTab() dietTabUI()
Diet tab for tuning gadget
ecopathCatchTab() ecopathCatchTabUI()
Ecopath catch tab
ecopathDeathTab() ecopathDeathTabUI()
Ecopath death tab
ecopathDietTab() ecopathDietTabUI()
Ecopath diet tab
ecopathGrowthTab() ecopathGrowthTabUI()
Ecopath growth tab
ecopathReproTab() ecopathReproTabUI()
Ecopath reproduction tab
ecopathSpectraTab() ecopathSpectraTabUI()
Ecopath spectra tab
growthTab() growthTabUI()
Growth tab for tuning gadget inheritParams biomassTab
numberTab() numberTabUI()
Number tab for tuning gadget
ratesTab() ratesTabUI()
Rates tab for tuning gadget
reproTab() reproTabUI()
Reproduction tab for tuning gadget
resourceTab() resourceTabUI()
Resource tab for tuning gadget
simTabUI() simTab()
Simulation tab for tuning gadget
spectraTab() spectraTabUI()
tuneParams tab showing size spectra
stomachTab()
Stomach tab for tuning gadget
abundanceControl() abundanceControlUI()
Controlling egg abundance in the tuning gadget
ecopathDiffusionControl() ecopathDiffusionControlUI()
Ecopath-specific diffusion control
ecopathExponentControl() ecopathExponentControlUI()
Ecopath-specific allometric exponent control
ecopathFishingControl() ecopathFishingControlUI()
Ecopath-specific fishing control
ecopathGrowthControl() ecopathGrowthControlUI()
Ecopath-specific encounter control
ecopathOtherControl() ecopathOtherControlUI()
Ecopath-specific other parameter control
ecopathReproductionControl() ecopathReproductionControlUI()
Ecopath-specific reproduction control
fishingControl() fishingControlUI()
Controlling the fishing parameters in the tuning gadget
growthControl() growthControlUI()
Adjusting predation parameters for growth
interactionControl() interactionControlUI()
Controlling the interaction matrix in the tuning gadget
otherControl() otherControlUI()
Other parameters control for tuning gadget
predationControl() predationControlUI()
Controlling the predation parameters in the tuning gadget
reproductionControl() reproductionControlUI()
Controlling the reproduction parameters in the tuning gadget
resourceControl() resourceControlUI()
Controlling the resource parameters in the tuning gadget

Calculating rates

Extract rates and other parameters from the model.

getConsumption()
Get consumption rate for each species
getUnassimilated()
Get unassimilated food
getProduction()
Get production rate as defined by Ecopath
getTotalProduction()
Get total production rate for each species
getSomaticProduction()
Get somatic production for each species
getGonadicProduction()
Get gonadic production for each species
getOffspringProduction()
Get rate at which offspring biomass is produced
getReproductiveLoss()
Get rate of biomass loss due to reproduction
getRespiration()
Get respiration rate as defined by Ecopath
getMetabolicRespiration()
Get metabolic respiration for each species
getEcotrophicEfficiency()
Get Ecotrophic Efficiency for each species
getM0B()
Get rate at which biomass is lost due to external mortality
getM2B()
Get rate at which biomass is lost due to predation mortality
getZB()
Get rate at which biomass is lost due to mortality
getDietMatrix()
Get diet matrix
getResourceEncounterRate()
Get resource encounter rate

Plotting

Basic visualisations

plotAgeLikelihood()
Plot the likelihood of the observed age at length data
plotConsumptionVsSpecies()
Plot the Consumption against species
plotDeathX() plotlyDeathX()
Plot the sources of external, predation and fishing mortality per species and size
plotProductionVsSpecies()
Plot the production against species
plot_catch()
Plot observed catches against modelled catches
plot_log_likelihood()
Plot Signed Negative Log-Likelihood Contributions with Mean K Lines Creates a heatmap of the signed contribution of each cell to the NLL, and overlays the mean observed and expected K values.

Helper functions

Internal tools to support calibration and simulation.

prepare_data()
Prepare a TMB Objective Function for Optimising Model Parameters
update_params()
Prepare a TMB Objective Function for Optimising Model Parameters
precompute_weights()
Precompute weights for integration of density over observed bins
valid_catch()
Validate and extract catch data for a single species
addCatch()
Sets up gear parameters from scaled catch data
age_mat_vB()
Calculate age at maturity from von Bertalanffy growth parameters
tuneParams_update_abundance()
Update the abundance of a species

Obsolete?

Functions retained for compatibility or reference but not in active use.

matchEcopath() isEcopathMatched() isConsumptionMatched() isCatchMatched()
Match the model to the Ecopath data
matchExtMortOnce()
Match the external mortality to that required by the ecopath production rate.
matchProduction() matchProductionOnce() isProductionMatched()
Match the model's production rate to empirical observations/estimates
matchRespirationOnce()
Match the respiration rate to that required by the ecopath production rate.

Data sets

Example input and output objects for illustrating functions.

biomass_discard_rates
Biomass discard rates
catch_distribution
Catch size distribution data
celtic_catch
Celtic Sea catch size distributions
celtic_params
Celtic Sea MizerParams object
cs_age_size
Celtic Sea age-at-size data
cs_calculated_histories
Celtic Sea calculated life history parameters
diet
Ecopath diet matrix (raw import)
diet_matrix_example
Example reduced diet matrix for mizer
diets
Celtic Sea Ecopath diet matrix
ecopath_diet_example
Ecopath diet matrix from Lauria et al. (2016)
fishing_deaths
Fishing deaths data frame
life_history_fishbase
Life history parameters from FishBase
ns_3_spp_model_final
North Sea 3-species model: final calibrated state
ns_3_spp_model_initial
North Sea 3-species model: initial state
ns_3_spp_model_trial
North Sea 3-species model: trial state
sp_params
Species parameters for North Sea 14-species model
species_params_example
Example species parameters from a few Celtic Sea species.
stomach_data_fit
Stomach content data fit
survey_length_distribution
Survey length distribution

Diffusion

Functions for solving diffusion equations in mizer models.

solve_double_sweep()
Helper function for double sweep method (Thomas algorithm)
project_diffusion()
Project forward in time with diffusion
solve_diffusion_pde()
Function to solve a reaction-diffusion-advection PDE

Age-at-length

Functions for working with age at size.

calculate_and_aggregate_likelihood()
Calculate and Aggregate Signed Log-Likelihood Contributions Loops through surveys, calculates signed NLL for each, and aggregates the results.
generate_model_predictions_for_date()
Generate age-at-length distribution for a specific survey date
getLogLik()
Get log likelihood of age observations
simulateCohort()
Simulate cohort evolution and calculate matrix G
preprocess_length_at_age()
Pre-process length-at-age data frame