Skip to contents

Creating a new model

Mizer allows the easy set-up of four different types of models, of increasing level of complexity. See https://sizespectrum.org/mizer/articles/mizer.html#size-spectrum-models for a description of these model types.

newSingleSpeciesParams() experimental
Set up parameters for a single species in a power-law background
newCommunityParams()
Set up parameters for a community-type model
newTraitParams()
Set up parameters for a trait-based multispecies model
newMultispeciesParams()
Set up parameters for a general multispecies model
mizer mizer-package
mizer: Multi-species size-based modelling in R
defaults_edition()
Default editions

Changing model parameters

After you have created a model, you will want to make changes to it while tuning the model and for investigating the impact of changes in parameters.

Steady state tuning

The first task after creating a multi-species model is to tune the model parameters so that in its steady state the model reproduces average observed growth rates, abundances and fisheries yields.

steady()
Set initial values to a steady state for the model
steadySingleSpecies() experimental
Set initial abundances to single-species steady state abundances
matchGrowth()
Adjust model to produce observed growth
plotBiomassObservedVsModel() plotlyBiomassObservedVsModel() experimental
Plotting observed vs. model biomass data
calibrateBiomass() experimental
Calibrate the model scale to match total observed biomass
calibrateNumber() experimental
Calibrate the model scale to match total observed number
matchBiomasses() experimental
Match biomasses to observations
matchNumbers() experimental
Match numbers to observations
plotYieldObservedVsModel() plotlyYieldObservedVsModel() experimental
Plotting observed vs. model yields
calibrateYield() experimental
Calibrate the model scale to match total observed yield
matchYields() experimental
Match yields to observations
scaleModel() experimental
Change scale of the model

Dynamics tuning

After tuning the steady state, you need to tune the sensitivity of the dynamics to perturbations away from the steady state. The following functions allow you to change the model without destroying the steady state.

Sharing models

setMetadata() getMetadata() experimental
Set metadata for a model
saveParams() readParams() experimental
Save a MizerParams object to file, and restore it

Running simulations

project()
Project size spectrum forward in time
projectToSteady() experimental
Project to steady state
setInitialValues()
Set initial values to values from a simulation

Accessing results

N() NResource()
Time series of size spectra
finalN() finalNResource()
Size spectra at end of simulation
idxFinalT()
Time index at end of simulation
getEffort()
Fishing effort used in simulation
getTimes()
Times for which simulation results are available

Analysing results

summary_functions
Description of summary functions
getDiet()
Get diet of predator at size, resolved by prey species
getBiomass()
Calculate the total biomass of each species within a size range at each time step.
getN()
Calculate the number of individuals within a size range
getSSB()
Calculate the SSB of species
getYield()
Calculate the rate at which biomass of each species is fished
getYieldGear()
Calculate the rate at which biomass of each species is fished by each gear
getGrowthCurves()
Get growth curves giving weight as a function of age

Calculating indicators

indicator_functions
Description of indicator functions
getProportionOfLargeFish()
Calculate the proportion of large fish
getCommunitySlope()
Calculate the slope of the community abundance
getMeanWeight()
Calculate the mean weight of the community
getMeanMaxWeight()
Calculate the mean maximum weight of the community

Plotting results

plotting_functions
Description of the plotting functions
animateSpectra() experimental
Animation of the abundance spectra
plotBiomass() plotlyBiomass()
Plot the biomass of species through time
plotBiomassObservedVsModel() plotlyBiomassObservedVsModel() experimental
Plotting observed vs. model biomass data
plotDiet() experimental
Plot diet, resolved by prey species, as function of predator at size.
plotFMort() plotlyFMort()
Plot total fishing mortality of each species by size
plotFeedingLevel() plotlyFeedingLevel()
Plot the feeding level of species by size
plotGrowthCurves() plotlyGrowthCurves()
Plot growth curves
plot(<MizerSim>,<missing>) plot(<MizerParams>,<missing>)
Summary plot for MizerSim objects
plotPredMort() plotlyPredMort()
Plot predation mortality rate of each species against size
plotSpectra() plotlySpectra()
Plot the abundance spectra
plotYield() plotlyYield()
Plot the total yield of species through time
plotYieldGear() plotlyYieldGear()
Plot the total yield of each species by gear through time
plotYieldObservedVsModel() plotlyYieldObservedVsModel() experimental
Plotting observed vs. model yields
setColours() getColours() setLinetypes() getLinetypes() experimental
Set line colours and line types to be used in mizer plots

Manipulating species list

addSpecies() experimental
Add new species
removeSpecies() experimental
Remove species
renameSpecies() experimental
Rename species

Setting custom rates

You can override the rates mizer calculates from the species parameters and gear parameters with your own rate arrays.

Calculating rates

getRates()
Get all rates
getEncounter()
Get encounter rate
getEGrowth()
Get energy rate available for growth
getERepro()
Get energy rate available for reproduction
getEReproAndGrowth()
Get energy rate available for reproduction and growth
getFMort()
Get the total fishing mortality rate from all fishing gears by time, species and size.
getFMortGear()
Get the fishing mortality by time, gear, species and size
getFeedingLevel()
Get feeding level
getCriticalFeedingLevel()
Get critical feeding level
getMort()
Get total mortality rate
getResourceMort()
Get predation mortality rate for resource
getPredMort()
Get total predation mortality rate
getPredRate()
Get predation rate
getRDD()
Get density dependent reproduction rate
getRDI()
Get density independent rate of egg production

Extending Mizer

setRateFunction() getRateFunction() other_params() `other_params<-`()
Set own rate function to replace mizer rate function
setComponent() removeComponent()
Add a dynamical ecosystem component
getComponent()
Get information about other ecosystem components
`initialNOther<-`() initialNOther()
Initial values for other ecosystem components
NOther()
Time series of other components
finalNOther()
Values of other ecosystem components at end of simulation
customFunction() experimental
Replace a mizer function with a custom version

Predation kernels

box_pred_kernel()
Box predation kernel
lognormal_pred_kernel()
Lognormal predation kernel
power_law_pred_kernel()
Power-law predation kernel
truncated_lognormal_pred_kernel()
Truncated lognormal predation kernel

Fishing selectivity functions

double_sigmoid_length()
Length based double-sigmoid selectivity function
knife_edge()
Weight based knife-edge selectivity function
sigmoid_length()
Length based sigmoid selectivity function
sigmoid_weight()
Weight based sigmoidal selectivity function

Resource dynamics

Reproduction functions

BevertonHoltRDD()
Beverton Holt function to calculate density-dependent reproduction rate
RickerRDD() experimental
Ricker function to calculate density-dependent reproduction rate
SheperdRDD() experimental
Sheperd function to calculate density-dependent reproduction rate
constantEggRDI() experimental
Choose egg production to keep egg density constant
constantRDD() experimental
Give constant reproduction rate
noRDD()
Give density-independent reproduction rate
getReproductionLevel() experimental
Get reproduction level

Internal rate functions

These functions are used by project() to calculate instantaneous rates at each time step. You should use the get…() functions instead of the mizer…() functions.

mizerRates()
Get all rates needed to project standard mizer model
mizerEGrowth()
Get energy rate available for growth needed to project standard mizer model
mizerERepro()
Get energy rate available for reproduction needed to project standard mizer model
mizerEReproAndGrowth()
Get energy rate available for reproduction and growth needed to project standard mizer model
mizerEncounter()
Get encounter rate needed to project standard mizer model
mizerFMort()
Get the total fishing mortality rate from all fishing gears
mizerFMortGear()
Get the fishing mortality needed to project standard mizer model
mizerFeedingLevel()
Get feeding level needed to project standard mizer model
mizerMort()
Get total mortality rate needed to project standard mizer model
mizerPredMort()
Get total predation mortality rate needed to project standard mizer model
mizerPredRate()
Get predation rate needed to project standard mizer model
mizerRDI()
Get density-independent rate of reproduction needed to project standard mizer model
mizerResourceMort()
Get predation mortality rate for resource needed to project standard mizer model

Internal helper functions

age_mat()
Calculate age at maturity
age_mat_vB()
Calculate age at maturity from von Bertalanffy growth parameters
calc_selectivity()
Calculate selectivity from gear parameters
completeSpeciesParams()
Complete species parameter data frame with default values
constant_other()
Helper function to keep other components constant
default_pred_kernel_params()
Set defaults for predation kernel parameters
different()
Check whether two objects are different
distanceMaxRelRDI() experimental
Measure distance between current and previous state in terms of RDI
distanceSSLogN() experimental
Measure distance between current and previous state in terms of fish abundances
emptyParams()
Create empty MizerParams object of the right size
get_f0_default()
Get default value for f0
get_gamma_default()
Get default value for gamma
get_initial_n()
Calculate initial population abundances
get_ks_default()
Get default value for ks
get_phi()
Get values from feeding kernel function
get_required_reproduction()
Determine reproduction rate needed for initial egg abundance
get_size_range_array()
Get size range array
get_time_elements()
Get_time_elements
initial_effort() `initial_effort<-`() validEffortVector()
Initial fishing effort
l2w() w2l()
Length-weight conversion
needs_upgrading()
Determine whether a MizerParams or MizerSim object needs to be upgraded
project_simple()
Project abundances by a given number of time steps into the future
set_species_param_default()
Set a species parameter to a default value
validGearParams()
Check validity of gear parameters and set defaults
validSpeciesParams()
Validate species parameter data frame
valid_species_arg()
Helper function to assure validity of species argument

Classes

MizerParams-class
A class to hold the parameters for a size based model.
summary(<MizerParams>)
Summarize MizerParams object
compareParams() experimental
Compare two MizerParams objects and print out differences
w() w_full() dw() dw_full()
Size bins
validParams()
Validate MizerParams object and upgrade if necessary using upgradeParams().
upgradeParams()
Upgrade MizerParams object from earlier mizer versions
MizerSim-class
A class to hold the results of a simulation
summary(<MizerSim>)
Summarize MizerSim object
upgradeSim()
Upgrade MizerSim object from earlier mizer versions
MizerSim()
Constructor for the MizerSim class
getParams()
Extract the parameter object underlying a simulation

Example parameter sets

More example parameter sets are available via https://sizespectrum.org/mizerExamples

NS_params
Example MizerParams object for the North Sea example
NS_species_params
Example species parameter set based on the North Sea
NS_species_params_gears
Example species parameter set based on the North Sea with different gears
NS_interaction
Example interaction matrix for the North Sea example
NS_sim
Example MizerSim object for the North Sea example

Deprecated

These functions are available for backwards compatibility with earlier versions of mizer

MizerParams() deprecated
Alias for set_multispecies_model()
getESpawning() deprecated
Alias for getERepro()
getM2() deprecated
Alias for getPredMort()
getM2Background() deprecated
Alias for getResourceMort()
getPhiPrey() deprecated
Get available energy
getZ() deprecated
Alias for getMort()
inter deprecated
Alias for NS_interaction
plotM2() deprecated
Alias for plotPredMort()
setRmax() deprecated
Alias for setBevertonHolt()
set_community_model() deprecated
Deprecated function for setting up parameters for a community-type model
set_multispecies_model() deprecated
Deprecated obsolete function for setting up multispecies parameters
set_trait_model() deprecated
Deprecated function for setting up parameters for a trait-based model