Learn R Programming

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

mizer

Mizer is an R package to run 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 ecosystems.

The package contains routines and 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. It is still under active development. The new 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.

Does your project or publication use mizer? If so, we would love to know. You can also join our Google Discussion group here: https://groups.google.com/forum/#!forum/size-spectrum-models

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 release version from CRAN
install.packages("mizer")

# Alternatively, install development version from GitHub
devtools::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, inter)
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.

Copy Link

Version

Install

install.packages('mizer')

Monthly Downloads

397

Version

2.0.0

License

GPL-3

Issues

Pull Requests

Stars

Forks

Maintainer

Gustav Delius

Last Published

April 4th, 2020

Functions in mizer (2.0.0)

MizerSim

Constructor for the MizerSim class
MizerParams

Alias for set_multispecies_model
NS_params

Example MizerParams object for the North Sea example
NOther

Time series of other components
BevertonHoltRDD

Beverton Holt function to calculate density-dependent reproduction rate
MizerSim-class

A class to hold the results of a simulation
N

Time series of size spectra
NS_species_params

Example species parameter set based on the North Sea
MizerParams-class

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

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

Size spectra at end of simulation
effort

Fishing effort used in simulation
emptyParams

Create empty MizerParams object of the right size
default_pred_kernel_params

Set defaults for predation kernel parameters
RickerRDD

Ricker function to calculate density-dependent reproduction rate
getBiomass

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

Get energy rate available for growth
getERepro

Get energy rate available for reproduction
finalNOther

Values of other ecosystem components at end of simulation
box_pred_kernel

Box predation kernel
getBiomassFrame

Get data frame of biomass of species through time, ready for ggplot2
SheperdRDD

Sheperd function to calculate density-dependent reproduction rate
getCommunitySlope

Calculate the slope of the community abundance
double_sigmoid_length

Length based double-sigmoid selectivity function
constantRDD

Give constant reproduction rate
getCriticalFeedingLevel

Get critical feeding level
getEncounter

Get encounter rate
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
getN

Calculate the number of individuals within a size range
getPhiPrey

Get available energy
getProportionOfLargeFish

Calculate the proportion of large fish
getPredRate

Get predation rate
getM2Background

Alias for getResourceMort
getDiet

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

Calculate the total yield of each species
getMeanMaxWeight

Calculate the mean maximum weight of the community
getEReproAndGrowth

Get energy rate available for reproduction and growth
getESpawning

Alias for getERepro
getGrowthCurves

Get growth curves giving weight as a function of age
getComponent

Get information about other ecosystem components
get_required_reproduction

Determine reproduction rate needed for initial egg abundance
getRDD

Get density dependent reproduction rate
getYieldGear

Calculate the total yield per gear and species
getM2

Alias for getPredMort
getRDI

Get density independent rate of egg production
get_h_default

Get default value for h
idxFinalT

Time index at end of simulation
get_initial_n

Calculate initial population abundances for the community populations
inter

Example interaction matrix for the North Sea example
getResourceMort

Get predation mortality rate for resource
mizerMort

Get total mortality rate needed to project standard mizer model
get_time_elements

Get_time_elements
knife_edge

Weight based knife-edge selectivity function
get_size_range_array

Get size range array
initialNOther<-

Initial values for other ecosystem components
mizer

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

Calculate the SSB of species
mizerPredMort

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

Get predation rate needed to project standard mizer model
params

Extract the parameter object underlying a simulation
mizerEGrowth

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

Get default value for ks
get_phi

Get values from feeding kernel function
getMeanWeight

Calculate the mean weight of the community
indicator_functions

Description of indicator functions
initialN<-

Initial values for fish spectra
getMort

Get total mortality rate
plotFMort

Plot total fishing mortality of each species by size
plotDiet

Plot diet
resource_constant

Keep resource abundance constant
plotBiomass

Plot the biomass of species through time
getPredKernel

Get predation kernel
mizerRDI

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

Get total predation mortality rate
mizerFMortGear

Get the fishing mortality by time, gear, species and size needed to project standard mizer model
mizerEncounter

Get encounter rate needed to project standard mizer model
initialNResource<-

Initial value for resource spectrum
plotM2

Alias for plotPredMort
project

Project size spectrum forward in time
newCommunityParams

Set up parameters for a community-type model
mizerFeedingLevel

Get feeding level needed to project standard mizer model
newMultispeciesParams

Set up parameters for a general multispecies model
plot,MizerSim,missing-method

Summary plot for MizerSim objects
reexports

Objects exported from other packages
getZ

Alias for getMort
resource_semichemostat

Project resource using semichemostat model
setPredKernel

Set predation kernel
lognormal_pred_kernel

Lognormal predation kernel
mizerFMort

Get the total fishing mortality rate from all fishing gears by time, species and size needed to project standard mizer model
species_params

Species parameters
setMaxIntakeRate

Set maximum intake rate
log_breaks

Helper function to produce nice breaks on logarithmic axes
newTraitParams

Set up parameters for a trait-based model
steady

Set initial values to a steady state for the model
sigmoid_weight

Weight based sigmoidal selectivity function
noRDD

Give density-independent reproduction rate
get_gamma_default

Get default value for gamma
plotPredMort

Plot predation mortality rate of each species against size
plotSpectra

Plot the abundance spectra
retune_erepro

Retune reproduction efficiency to maintain initial egg abundances
mizerERepro

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

Set metabolic rate
mizerEReproAndGrowth

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

Description of the plotting functions
plotYieldGear

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

Plot the total yield of species through time
setColours

Set line colours to be used in mizer plots
mizerRates

Get all rates needed to project standard mizer model
setComponent

Add a dynamical ecosystem component
mizerResourceMort

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

Plot the feeding level of species by size
plotGrowthCurves

Plot growth curves giving weight as a function of age
setResource

Set up resource
setLinetypes

Set linetypes to be used in mizer plots
setExtMort

Set external mortality rate
setInteraction

Set species interaction matrix
setFishing

Set fishing parameters
set_trait_model

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

Times for which simulation results are available
truncated_lognormal_pred_kernel

Truncated lognormal predation kernel
sigmoid_length

Length based sigmoid selectivity function
summary_functions

Description of summary functions
setRmax

Set maximum reproduction rate
setRateFunction

Set own rate function to replace mizer rate function
power_law_pred_kernel

Power-law predation kernel
setSearchVolume

Set search volume
setReproduction

Set reproduction parameters
validGearParams

Check validity of gear parameters and set defaults for missing but required parameters or transfer them from species_params if available
setInitialValues

Set initial values to final values of a simulation
test_dyn

Dummy function used during testing only
validSpeciesParams

Check validity of species parameters and set defaults for missing but required 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
summary,MizerParams-method

Summarize MizerParams object
summary,MizerSim-method

Summarize MizerSim object
validate_effort_vector

Check that an effort vector is specified correctly
w

Size bins
upgradeParams

Upgrade MizerParams object from earlier mizer versions
set_species_param_default

Set a species parameter to a default value
upgradeSim

Upgrade MizerSim object from earlier mizer versions