Learn R Programming

Mizer is an R package to run dynamic multi-species size-spectrum models of fish communities. The package has been developed to model marine ecosystems that are subject to fishing. However, it may also be appropriate for other aquatic ecosystems. By providing a framework for multi-species fisheries modelling as an R package, mizer enhances the accessibility, usability, and reproducibility of models, and thus aims to facilitate collaboration and innovation.

The package contains functions that allow you to set up an ecosystem model and then project it through time under different fishing strategies. Methods are included to explore the results, including plots and calculations of community indicators such as the slope of the size spectrum. Size-based models can be complicated, so mizer contains many default options that you can however change when needed.

Mizer has been supporting research in marine ecology and fisheries science since 2014 (see publications). Mizer is still under active development. Version 2 has increased the user-friendliness and the flexibility of the framework. Version 3 has introduced diffusion, arising from stochastic growth, and improved the numerics. Contributions from the user community are very welcome. There is a sister package called mizerExperimental where user contributions can be checked out and receive feedback from the community. A growing number of other extension packages add new biology such as temperature dependence, starvation mortality, seasonal dynamics, and more — see the list of extension packages. Example mizer models can be contributed to mizerExamples. Follow us on twitter and read our blog to stay up-to-date with new developments. Does your project or publication use mizer? If so, we would love to know.

Recent work on mizer was funded by the European Commission Horizon 2020 Research and Innovation Programme under Grant Agreement No 634495 for the project MINOUW and the Australian Research Council Discovery Project Rewiring Marine Food Webs.

Installation

The package is on CRAN and therefore available from R’s built-in package manager.

# Install latest released version from CRAN
install.packages("mizer")

# Alternatively, install the development version from GitHub
pak::pak("sizespectrum/mizer")

Example

The following code loads the mizer package, loads some information about species in the North Sea that comes as an example with the package, sets up the parameters for the mizer model, and runs a simulation for 10 years.

library(mizer)
params <- newMultispeciesParams(NS_species_params, NS_interaction)
sim <- project(params, t_max = 10, effort = 0)

The results of the simulation can then be analysed, for example via plots:

plot(sim)

See the accompanying Get started page for more details on how the package works, including detailed examples.

Dynamic multi-species size-spectrum model

Size-based multi-species models are important for fisheries science because they provide a more realistic and accurate representation of the dynamics of fish populations and the ecosystems in which they live. In contrast to traditional single-species models, which consider a single fish stock as an isolated unit, size-based multi-species models account for the fact that fish populations are part of a larger ecosystem and interact with other species through predation, competition, and other ecological processes.

One of the key advantages of size-based multi-species models is that they provide a more comprehensive understanding of the impacts of fishing on fish populations and ecosystems. By considering the size distribution of different fish species, these models can capture the effects of fishing on both target and non-target species, and on different life stages of a species. This is particularly important for species that are caught as bycatch or that are indirectly affected by fishing through changes in their food web.

Another advantage of size-based multi-species models is that they can be used to investigate the effects of environmental changes and other perturbations on fish populations and ecosystems. For example, these models can be used to explore the impacts of climate change on the distribution and abundance of fish populations, or the effects of habitat loss or pollution on fish communities. Because mizer is a mechanistic model, it can deduce the complex population-level changes that we are interested in from the simpler changes in the physiological rates and feeding interactions of individual fish species. You can find examples of this in the list of publications.

Overall, size-based multi-species models provide a more comprehensive and realistic framework for understanding the dynamics of fish populations and ecosystems, and for developing effective fisheries management strategies that account for the complex interactions among species and their environment.

A mizer model captures the interactions between species. The growth rates of fish are determined by the availability of prey and the death rates are influenced by the abundance of predators, as well as fishing. The model starts with the individual-level physiological rates for each species, as well as the predation preferences, and deduces the population-level dynamics from these. Thus quantities like fish diets and fisheries yields emerge dynamically and can be projected into the future.

Because a mizer model tracks the size of individuals as they grow up over several orders of magnitude from their egg size to their maximum size, it correctly tracks the ontogenetic diet shifts. An individual typically moves through several trophic levels during its life time. This is often not correctly captured in other multi-species models.

A mizer model can be set up with only a small amount of information because it uses allometric scaling relations and size-based feeding rules to choose sensible defaults for unknown parameters.

Setting up a new multi-species mizer model is a two-step process, similar to what may be familiar from Ecopath with Ecosim: First one calibrates the model to describe a steady state that is in agreement with current observations (as in Ecopath), then one chooses the additional parameters that determine the dynamics away from the steady state (as in Ecosim). This model can then be used to investigate future effects of changes in fishing policy or of environmental stressors.

A strong theoretical basis

One big advantage of a mizer model is that it is based on a strong mathematical foundation. This allows a degree of a priori understanding of the behaviour of the model that is absent in many other multi-species models. This theoretical foundation is well presented in the book “Fish Ecology, Evolution, and Exploitation” by Ken Andersen.

It is interesting to think of the marine ecosystem as a transport system that moves biomass from the size of primary producers (mostly unicellular plankton) up to the sizes of fish that humans like to consume. Each fish that grows up from egg size to maturity by eating smaller individuals is like a car on this biomass highway. The yield of our fisheries depend on this traffic flowing smoothly and without traffic jams.

An analogy with road traffic may be helpful:

In road traffic, if traffic density gets too high in a section of the highway, drivers slow down, which leads to a pile-up producing even higher traffic density, leading to further slow-down in a potentially vicious cycle known as a traffic jam. Traffic management that ignores how the traffic density affects traffic speed fails. Luckily our mathematical understanding of transport equations has made practical contributions to managing traffic in ways that produce smoother traffic flow and hence higher throughput.

Mizer implements the transport equations for marine ecosystems. The potential for traffic jams is the same: if for example there is a high density of predators of a particular size, which all have preference for prey of a particular smaller size, then due to competition for that prey the growth of those predators slows down, leading to a pile-up which leads to further depletion of prey, leading to further slow-down, in a potentially vicious cycle.

Luckily, the natural ecosystem has evolved to facilitate very smooth traffic on this biomass highway, with resultant high productivity. This state is characterised by an approximate power-law shape of the biomass size spectrum. The purpose of mizer is to allow us to understand how various stressors, like fishing or climate change, affect the size spectrum and hence the flow of biomass and the productivity and resilience of the marine ecosystem. Mizer allows us to investigate how size-based fisheries management strategies can be used to keep the ecosystem close to its natural productive state.

Copy Link

Version

Install

install.packages('mizer')

Monthly Downloads

531

Version

3.2.0

License

GPL-3

Issues

Pull Requests

Stars

Forks

Maintainer

Gustav Delius

Last Published

July 19th, 2026

Functions in mizer (3.2.0)

ArrayResourceBySize

S3 class for resource size spectra
MizerSim-class

A class to hold the results of a simulation
ArrayTimeBySpeciesBySize

S3 class for time x species x size arrays
ArrayTimeByResourceBySize

S3 class for time x resource-size arrays
ArrayTimeBySpecies

S3 class for time x species arrays
MizerParams

Alias for set_multispecies_model()
MizerParams-class

A class to hold the parameters for a size based model.
BevertonHoltRDD

Beverton Holt function to calculate density-dependent reproduction rate
MizerSim

Constructor for the MizerSim class
ArraySpeciesBySize

S3 class for species x size rate arrays
SheperdRDD

Sheperd function to calculate density-dependent reproduction rate
NS_sim

Example MizerSim object for the North Sea example
NOther

Time series of other components
N

Time series of size spectra
RickerRDD

Ricker function to calculate density-dependent reproduction rate
addPlot

Add lines to an existing plot
NS_interaction

Example interaction matrix 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_params

Example MizerParams object for the North Sea example
addSpecies

Add new species
baseMizerClass

Strip extension classes from a mizer object
as.data.frame

Convert mizer arrays to data frames
age_mat

Calculate age at maturity
age_mat_vB

Calculate age at maturity from von Bertalanffy growth parameters
calibrateBiomass

Calibrate the model scale to match total observed biomass
calibrateNumber

Calibrate the model scale to match total observed number
bin_average_summary_weight

Bin-average a summary-integral weight when second-order is enabled
assertExtensionChain

Assert that an object's extension chain is compatible with the session
bin_midpoints

Geometric bin centres of the size grid
bin_average_weight

Trapezoidal bin-average of a per-bin weight
calc_selectivity

Calculate selectivity from gear parameters
adjustSizeGrid

Adjust the size grid
box_pred_kernel

Box predation kernel
convert_plot_size_axis

Convert plotting data from weight to length
clearExtensionChain

Clear the registered extension chain
coerceToExtensionClass

Coerce a mizer object to its registered extension class
completeSpeciesParams

Alias for validSpeciesParams()
constantEggRDI

Choose egg production to keep egg density constant
ensureExtensionNamespaces

Load (and optionally install) namespaces for all non-NA extensions
emptyParams

Create empty MizerParams object of the right size
different

Check whether two objects are different
compareExtensionChains

Compare two extension chains
default_pred_kernel_params

Set defaults for predation kernel parameters
defaults_edition

Default editions
customFunction

Replace a mizer function with a custom version
filter_plot_length_limits

Filter plotting data to the requested length limits
calibrateYield

Calibrate the model scale to match total observed yield
apply_wlim

Restrict plot data to a range of weights
extension_needs_upgrading

Whether any extension recorded on an object needs upgrading
animate

Animate size-dependent quantities through time
cdf_y_label

Y-axis label for a cumulative-distribution plot
compareParams

Compare two MizerParams objects and print out differences
distanceMaxRelRDI

Measure distance between current and previous state in terms of RDI
distanceSSLogN

Measure distance between current and previous state in terms of fish abundances
flux_from_rates

Assemble the flux matrix from growth, diffusion and recruitment rates
flux_units

Units string for the flux returned by getFlux()
expandSizeGrid

Expand the size grid
extensionRequirements

Extract the requirement view of an extension chain
constantRDD

Give constant reproduction rate
constant_other

Helper function to keep other components constant
defineExtensionClasses

Define S4 marker classes for a set of dispatch extensions
double_sigmoid_length

Length based double-sigmoid selectivity function
.checkRateFunctionOutput

Check that a rate function returns the correct output dimensions
gear_params

Gear parameters
extensionVersions

Extract the version stamps of an extension chain
extensionVersion

Get the recorded version stamp for one extension on an object
dispatchExtensions

Filter an extension vector to those that participate in S3/S4 dispatch
formatExtensionChain

Format an extension chain as a human-readable string
finalParams

Extract the final state from a simulation
getERepro

Get energy rate available for reproduction
finalN

Size spectra at end of simulation
getEReproAndGrowth

Get energy rate available for reproduction and growth
getDiet

Get diet of predator at size, resolved by prey species
getCriticalFeedingLevel

Get critical feeding level
getFMortGear

Get the fishing mortality by time, gear, species and size
getGrowthCurves

Get growth curves giving weight as a function of age
getInteraction

Deprecated function to get interaction matrix
getDiffusion

Get diffusion rate from predation
getCommunitySlope

Calculate the slope of the community abundance
getBiomass

Calculate the total biomass of each species within a size range at each time step.
defineOrCheckClass

Define an S4 class or verify it extends the expected parent
getESpawning

Alias for getERepro()
getEffort

Fishing effort used in simulation
getMort

Get total mortality rate
getPredMort

Get total predation mortality rate
getFluxGradient

Get flux gradient
getN

Calculate the number of individuals within a size range
getFlux

Get flux into size bins
getFeedingLevel

Get feeding level
getParams

Extract the model state from a simulation
getPhiPrey

Get available energy
getEGrowth

Get energy rate available for growth
getMeanWeight

Calculate the mean weight of the community
getEncounter

Get encounter rate
getMeanMaxWeight

Calculate the mean maximum weight of the community
getRequiredRDD

Determine reproduction rate needed for initial egg abundance
getFMort

Get the total fishing mortality rate from all fishing gears by time, species and size.
getRDD

Get density dependent reproduction rate
getProportionOfLargeFish

Calculate the proportion of large fish
getM2

Alias for getPredMort()
getM2Background

Alias for getResourceMort()
get_ArraySpeciesBySize_w

Get the size grid for an ArraySpeciesBySize object
getPredRate

Get predation rate
getRDI

Get density independent rate of egg production
getSSB

Calculate the SSB of species
getSimParams

Extract the projection parameters used to produce a simulation
getTimes

Times for which simulation results are available
getResourceMort

Get predation mortality rate for resource
get_ArrayTimeBySpeciesBySize_w

Get the size grid for an ArrayTimeBySpeciesBySize object
getResourceDynamics

Deprecated functions for getting resource parameters
getReproductionLevel

Get reproduction level
getZ

Alias for getMort()
get_gamma_default

Get default value for gamma
get_f0_default

Get default value for f0
get_ArrayResourceBySize_w

Get the size grid for an ArrayResourceBySize object
getRegisteredExtensions

Get the registered mizer extension chain
get_size_range_array

Get size range array
getRates

Get all rates
get_h_default

Get default value for h
get_species_size_rate_from_sim

Apply a species-by-size rate function over saved simulation times
getTrophicLevelBySpecies

Get mean trophic level of each species
getTrophicLevel

Get trophic level of individuals at size
get_sim_rate_slice

Extract one saved simulation state for a rate calculation
get_initial_n

Calculate initial population abundances
getYield

Calculate the rate at which biomass of each species is fished
get_ks_default

Get default value for ks
getYieldGear

Calculate the rate at which biomass of each species is fished by each gear
get_species_time_rate_from_sim

Apply a species rate function over saved simulation times
initialNOther<-

Initial values for other ecosystem components
indicator_functions

Description of indicator functions
get_time_elements

Get array indices for a time range in a MizerSim object
log_breaks

Helper function to produce nice breaks on logarithmic axes
lognormal_pred_kernel

Lognormal predation kernel
initialNResource<-

Initial value for resource spectrum
initialParams

Extract the initial state from a simulation
markBackground

Designate species as background species
mizerEReproAndGrowth

Get energy rate available for reproduction and growth needed to project standard mizer model
make_mizer_plot

Tag a ggplot object as a mizer plot
get_sim_rate_time_elements

Get selected saved time steps for a simulation rate
isSuffixChain

Test whether one extension chain is a suffix of another
get_steady_state_n

Calculate steady state abundance
matchYields

Match yields to observations
matchNumbers

Match numbers to observations
matchGrowth

Adjust model to produce observed growth
matchBiomasses

Match biomasses to observations
isVersionRequirement

Test whether a requirement string is a dotted version number
mizerRDI

Get density-independent rate of reproduction needed to project standard mizer model
mizerRates

Get all rates needed to project standard mizer model
makeExtensions

Build a versioned extension list from requirements and versions
mizerPredRate

Get predation rate needed to project standard mizer model
initial_effort

Initial fishing effort
inter

Alias for NS_interaction
mizerERepro

Get energy rate available for reproduction needed to project standard mizer model
mizerFMortGear

Get the fishing mortality needed to project standard mizer model
mizerEncounter

Get encounter rate during projection
mizerFMort

Get the total fishing mortality rate from all fishing gears
mizer-package

mizer: Multi-species size-based modelling in R
mizerDiffusion

Calculate diffusion rate
initialN<-

Initial values for fish spectra
knife_edge

Weight based knife-edge selectivity function
l2w

Length-weight conversion
mizerEGrowth

Get energy rate available for growth needed to project standard mizer model
make_linesize

Construct a named vector of line widths for a plot
get_phi

Get values from feeding kernel function
mizerPredMort

Get total predation mortality rate needed to project standard mizer model
mizer_needs_upgrading

Whether the core mizer slots of an object need upgrading
noRDD

Give density-independent reproduction rate
mizer_rates_subset

Calculate a selected subset of the rates
mizerResourceMort

Get predation mortality rate for resource needed to project standard mizer model
mizer_tooltip_vars

Determine the tooltip variables for a mizer plot
mizerMort

Get total mortality rate needed to project standard mizer model
newTraitParams

Set up parameters for a trait-based multispecies model
newCommunityParams

Set up parameters for a community-type model
newSingleSpeciesParams

Set up parameters for a single species in a power-law background
mizerFeedingLevel

Get feeding level needed to project standard mizer model
newMultispeciesParams

Set up parameters for a general multispecies model
objectExtensions

Get the extension chain stored in a mizer object
plot2

Compare two mizer arrays in a single plot
needed_rates

Determine which rates must be calculated to obtain a set of target rates
needs_upgrading

Determine whether a MizerParams or MizerSim object needs to be upgraded
plotBiomass

Plot the biomass of species through time
parseTimePlotLog

Parse the log argument for time-series plots
parsePlotLog

Parse the log-axis arguments of a mizer plot function
plot.ArrayResourceBySize

Plot method for ArrayResourceBySize objects
plot.ArraySpeciesBySize

Plot method for ArraySpeciesBySize objects
plot.ArrayTimeBySpecies

Plot method for ArrayTimeBySpecies objects
plot.ArrayTimeByResourceBySize

Plot method for ArrayTimeByResourceBySize objects
plotBiomassObservedVsModel

Plotting observed vs. model biomass data
plotCDF

Plot cumulative abundance or biomass distributions
plot.ArrayTimeBySpeciesBySize

Plot method for ArrayTimeBySpeciesBySize objects
plot

Plot mizer arrays
plotFMort

Plot total fishing mortality of each species by size
plotFeedingLevel

Plot the feeding level of species by size
plotGrowthCurves

Plot growth curves
plotDataFrame

Make a plot from a data frame
plotHover.ArraySpeciesBySize

Create a hover-enabled plotly plot from a mizer object
plotDiet

Plot diet, resolved by prey species, as function of predator at size.
plotCDF2

Compare cumulative abundance or biomass distributions from two objects
plotComparisonDataFrame

Make a plot comparing two data frames
plotMizerSim

Summary plot for MizerSim objects
plotRelative

Plot relative difference between two mizer arrays
plotPredMort

Plot predation mortality rate of each species against size
plotM2

Alias for plotPredMort()
plotMizerParams

Summary plot for MizerParams objects
plotRelativeDataFrame

Make a plot of the relative difference between two data frames
plot_size_axis

Validate the size-axis argument
plot_feeding_level

Build the feeding-level plot
plot_size_tooltip

Assemble the tooltip variables for a size-axis plot
plot_growth_curves

Build the growth-curves plot
plot_size_x_var

Name of the x-variable for a given size axis
plotSpectra

Plot abundance and biomass spectra
plotSpectra2

Compare abundance and biomass spectra from two objects
power_law_pred_kernel

Power-law predation kernel
projectRDD

Get density-dependent reproduction rate during projection
print

Print mizer objects
plot_cdf

Build the cumulative-distribution plot
plot_size_xlim

Choose the x-axis limits for a given size axis
plot_spectra

Build the size-spectrum plot
plot_size_xlab

Axis label for a given size axis
plot_diet

Build the diet-composition plot
plotSpectraRelative

Plot relative difference between abundance spectra
project

Project size spectrum forward in time
providesDispatchMethods

Does an installed extension register dispatch methods for its own class?
prepare_spectra_cdf_data

Integrate spectra data into a cumulative distribution
project_n_tr_bdf2

Project values with the TR-BDF2 method
project_simple

Project abundances by a given number of time steps into the future
reexports

Objects exported from other packages
registerExtensions

Register mizer extensions for this R session
plotting_functions

Description of the plotting functions
power_law_bin_average

Bin average of a power law over geometric bins
plotYield

Plot the total yield of species through time
plotYieldGear

Plot the total yield of each species by gear through time
plotYieldObservedVsModel

Plotting observed vs. model yields
relative_difference

Symmetric relative difference between two values
recordExtension

Record an extension and its version stamp on a mizer object
resource_params

Resource parameters
resource_logistic

Project resource using logistic model
registerExtension

Register a single mizer extension for this R session
setBevertonHolt

Set Beverton-Holt reproduction without changing the steady state
second_order_w

Get or set the second_order_w flags
renameGear

Rename gears
renameSpecies

Rename species
setComponent

Add a dynamical ecosystem component
setColours

Set line colours and line types to be used in mizer plots
removeBackgroundSpecies

Remove all background species
setExtEncounter

Set external encounter rate
removeSpecies

Remove species
setExtDiffusion

Set external diffusion rate
projectToSteady

Project to steady state
resource_constant

Keep resource abundance constant
resolve_second_order_w

Resolve a second_order_w value against the default scheme
project_n

Project values for first time step of Euler method
project_n_2

Project values with a predictor-corrector method
resource_semichemostat

Project resource using semichemostat model
resource_power_law

Construct the background resource power-law spectrum
scaleModel

Change scale of the model
scaleRates

Rescale all rates in a mizer model
runExtensionUpgrades

Run the registered extension upgrade methods on an object
saveParams

Save and restore mizer objects
setPredKernel

Set predation kernel
setMetadata

Set metadata for a model
setInitialValues

Set initial values to values from a simulation
setMetabolicRate

Set metabolic rate
setMaxIntakeRate

Set maximum intake rate
setInteraction

Set species interaction matrix
setRateFunction

Set own rate function to replace mizer rate function
setParams

Set or change any model parameters
setFishing

Set fishing parameters
setExtMort

Set external mortality rate
setSearchVolume

Set search volume
setRmax

Alias for setBevertonHolt()
sigmoid_length

Length based sigmoid selectivity function
set_species_param_default

Set a species parameter to a default value
setResource

Set resource dynamics
sigmoid_weight

Weight based sigmoidal selectivity function
set_trait_model

Deprecated function for setting up parameters for a trait-based model
setReproduction

Set reproduction parameters
set_community_model

Deprecated function for setting up parameters for a community-type model
set_multispecies_model

Deprecated obsolete function for setting up multispecies parameters
simExtensionClass

Derive the MizerSim marker class name for a given extension
steady

Set initial values to a steady state for the model
sim_species_rate

Build a MizerSim rate getter that resolves the rate functions once
species_params

Species parameters
summary

Summarise mizer objects
str

Display the structure of mizer objects
steadySingleSpecies

Set initial abundances to solution of steady-state equation with current rates
upgradeSim

Back-compatible wrapper for the MizerSim upgrade
use_predation_diffusion

Get or set the use_predation_diffusion flag
usesExtensionDispatch

Test whether a mizer object uses extension S4 dispatch
spectra_y_label

Y-axis label for a size-spectrum plot
spectra_bin_width

Look up the size-bin widths for spectra data
upgradeParams

Back-compatible wrapper for the core MizerParams upgrade
validGearParams

Check validity of gear parameters and set defaults
validEffortVector

Make a valid effort vector
valid_species_arg

Helper function to assure validity of species argument
validateExtensionsVector

Validate and normalise an extensions named character vector
validSpeciesParams

Validate species parameter data frame
valid_gears_arg

Helper function to assure validity of gears argument
sim_size_rate

Build a MizerSim rate getter that resolves the rate functions once
upgrade.MizerSim

Upgrade a MizerSim object from earlier versions
validate_second_order_w

Apply a second_order_w value to the current slot list
upgrade.MizerParams

Upgrade the core slots of a MizerParams object
summary_functions

Description of summary functions
truncated_lognormal_pred_kernel

Truncated lognormal predation kernel
validParams

Validate MizerParams object and upgrade if necessary
validSim

Validate MizerSim object and upgrade if necessary
w

Size bins