Learn R Programming

⚠️There's a newer version (2.5.3) of this package.Take me there.

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.

The package contains functions to allow users 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 calculation of community indicators such as the slope of the size spectrum. Size-based models can be complicated so mizer contains many default options that can be easily changed by the user.

Mizer has been supporting research in marine ecology and fisheries science since 2014 (see publications). Mizer is still under active development. Version 2.0 has increased the user-friendliness and the flexibility of the framework. 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. 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 (http://minouw-project.eu/) 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
remotes::install_github("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 models

A mizer model captures the interactions between multiple 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.

Modelling environmental change

A mizer model is a good tool for studying the effect of environmental changes, like climate change, because it is a mechanistic model that can deduce the complex population-level changes that one is interested in from the simpler changes in the physiological rates and feeding interactions of individual fish species.

Smooth traffic on the biomass highway

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 the 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 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.

A model one can understand

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 model. This theoretical foundation is well presented in the book “Fish Ecology, Evolution, and Exploitation” by Ken Andersen.

Copy Link

Version

Install

install.packages('mizer')

Monthly Downloads

389

Version

2.3.0

License

GPL-3

Issues

Pull Requests

Stars

Forks

Maintainer

Gustav Delius

Last Published

September 11th, 2021

Functions in mizer (2.3.0)

MizerParams

Alias for set_multispecies_model()
NS_sim

Example MizerSim object for the North Sea example
distanceMaxRelRDI

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

Add new species
animateSpectra

Animation of the abundance spectra
MizerSim

Constructor for the MizerSim class
N

Time series of size spectra
RickerRDD

Ricker function to calculate density-dependent reproduction rate
calibrateYield

Calibrate the model scale to match total observed yield
NS_interaction

Example interaction matrix for the North Sea example
NOther

Time series of other components
compareParams

Compare two MizerParams objects and print out differences
default_pred_kernel_params

Set defaults for predation kernel parameters
getCommunitySlope

Calculate the slope of the community abundance
different

Check whether two objects are different
SheperdRDD

Sheperd function to calculate density-dependent reproduction rate
getComponent

Get information about other ecosystem components
NS_species_params_gears

Example species parameter set based on the North Sea with different gears
getERepro

Get energy rate available for reproduction
NS_species_params

Example species parameter set based on the North Sea
getEGrowth

Get energy rate available for 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
MizerParams-class

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

Box predation kernel
calibrateBiomass

Calibrate the model scale to match total observed biomass
BevertonHoltRDD

Beverton Holt function to calculate density-dependent reproduction rate
getGrowthCurves

Get growth curves giving weight as a function of age
double_sigmoid_length

Length based double-sigmoid selectivity function
finalNOther

Values of other ecosystem components at end of simulation
getFeedingLevel

Get feeding level
finalN

Size spectra at end of simulation
emptyParams

Create empty MizerParams object of the right size
getEffort

Fishing effort used in simulation
constantRDD

Give constant reproduction rate
constantEggRDI

Choose egg production to keep egg density constant
getM2

Alias for getPredMort()
getProportionOfLargeFish

Calculate the proportion of large fish
getBiomass

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

Gear parameters
constant_other

Helper function to keep other components constant
getPredMort

Get total predation mortality rate
customFunction

Replace a mizer function with a custom version
getPredRate

Get predation rate
get_initial_n

Calculate initial population abundances for the community populations
getParams

Extract the parameter object underlying a simulation
getPhiPrey

Get available energy
get_ks_default

Get default value for ks
matchBiomasses

Match biomasses to observations
matchYields

Match yields to observations
get_f0_default

Get default value for f0
getZ

Alias for getMort()
initialNResource<-

Initial value for resource spectrum
getRDD

Get density dependent reproduction rate
getRDI

Get density independent rate of egg production
getEncounter

Get encounter rate
get_phi

Get values from feeding kernel function
getRates

Get all rates
getM2Background

Alias for getResourceMort()
getMort

Get total mortality rate
mizer-package

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

Determine reproduction rate needed for initial egg abundance
mizerEncounter

Get encounter rate needed to project standard mizer model
getN

Calculate the number of individuals within a size range
getYield

Calculate the yearly yield for each species
mizerERepro

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

Initial fishing effort
getCriticalFeedingLevel

Get critical feeding level
distanceSSLogN

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

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

Calculate the mean maximum weight of the community
getEReproAndGrowth

Get energy rate available for reproduction and growth
getESpawning

Alias for getERepro()
getYieldGear

Calculate the yearly yield per gear and species
idxFinalT

Time index at end of simulation
mizerFMort

Get the total fishing mortality rate from all fishing gears
mizerEGrowth

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

Get predation rate needed to project standard mizer model
initialN<-

Initial values for fish spectra
indicator_functions

Description of indicator functions
mizerRDI

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

Plot the abundance spectra
plotYieldObservedVsModel

Plotting observed vs. model yields
plotPredMort

Plot predation mortality rate of each species against size
mizerFMortGear

Get the fishing mortality needed to project standard mizer model
initialNOther<-

Initial values for other ecosystem components
mizerFeedingLevel

Get feeding level needed to project standard mizer model
getMeanWeight

Calculate the mean weight of the community
getTimes

Times for which simulation results are available
getSSB

Calculate the SSB of species
mizerEReproAndGrowth

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

Give density-independent reproduction rate
plotBiomass

Plot the biomass of species through time
getReproductionLevel

Get reproduction level
get_size_range_array

Get size range array
plotFMort

Plot total fishing mortality of each species by size
plotDiet

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

Get_time_elements
plotYieldGear

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

Set external mortality rate
plotYield

Plot the total yield of species through time
getResourceMort

Get predation mortality rate for resource
get_gamma_default

Get default value for gamma
setComponent

Add a dynamical ecosystem component
get_h_default

Get default value for h
newSingleSpeciesParams

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

Set up parameters for a trait-based multispecies model
plotBiomassObservedVsModel

Plotting observed vs. model biomass data
saveParams

Save a MizerParams object to file, and restore it
plotting_functions

Description of the plotting functions
plotDataFrame

Make a plot from a data frame
plot,MizerSim,missing-method

Summary plot for MizerSim objects
resource_constant

Keep resource abundance constant
renameSpecies

Rename species
plotM2

Alias for plotPredMort()
setFishing

Set fishing parameters
power_law_pred_kernel

Power-law predation kernel
set_multispecies_model

Deprecated obsolete function for setting up multispecies parameters
setReproduction

Set reproduction parameters
setRateFunction

Set own rate function to replace mizer rate function
scaleModel

Change scale of the model
inter

Alias for NS_interaction
summary,MizerSim-method

Summarize MizerSim object
valid_species_arg

Helper function to assure validity of species argument
setInitialValues

Set initial values to final values of a simulation
summary_functions

Description of summary functions
w

Size bins
project

Project size spectrum forward in time
setInteraction

Set species interaction matrix
validParams

Validate MizerParams object and upgrade if necessary
set_species_param_default

Set a species parameter to a default value
setMaxIntakeRate

Set maximum intake rate
knife_edge

Weight based knife-edge selectivity function
mizerMort

Get total mortality rate needed to project standard mizer model
setSearchVolume

Set search volume
newMultispeciesParams

Set up parameters for a general multispecies model
project_simple

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

Lognormal predation kernel
projectToSteady

Project to steady state
newCommunityParams

Set up parameters for a community-type model
log_breaks

Helper function to produce nice breaks on logarithmic axes
mizerPredMort

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

Weight based sigmoidal selectivity function
setColours

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

Set Beverton-Holt density dependence
setParams

Set or change any model parameters
steady

Set initial values to a steady state for the model
set_community_model

Deprecated function for setting up parameters for a community-type model
summary,MizerParams-method

Summarize MizerParams object
validSpeciesParams

Validate species parameter data frame
set_trait_model

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

Upgrade MizerSim object from earlier mizer versions
validGearParams

Check validity of gear parameters and set defaults
setPredKernel

Set predation kernel
sigmoid_length

Length based sigmoid selectivity function
mizerResourceMort

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

Get all rates needed to project standard mizer model
species_params

Species parameters
truncated_lognormal_pred_kernel

Truncated lognormal predation kernel
plotFeedingLevel

Plot the feeding level of species by size
upgradeParams

Upgrade MizerParams object from earlier mizer versions
plotGrowthCurves

Plot growth curves giving weight as a function of age
reexports

Objects exported from other packages
resource_params

Resource parameters
setMetabolicRate

Set metabolic rate
removeSpecies

Remove species
resource_semichemostat

Project resource using semichemostat model
setMetadata

Set metadata for a model
setRmax

Alias for setBevertonHolt()
setResource

Set up resource
MizerSim-class

A class to hold the results of a simulation
NS_params

Example MizerParams object for the North Sea example