
Package index
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
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.
-
species_params()`species_params<-`()given_species_params()`given_species_params<-`()calculated_species_params() - Species parameters
-
gear_params()`gear_params<-`() - Gear parameters
-
`initialN<-`()initialN() - Initial values for fish spectra
-
`initialNResource<-`()initialNResource() - Initial value for resource spectrum
-
initial_effort()`initial_effort<-`() - Initial fishing effort
-
addSpecies() - Add new species
-
removeSpecies() - Remove species
-
renameSpecies() - Rename species
-
renameGear() - Rename gears
-
expandSizeGrid() - Expand the size grid
-
markBackground() - Designate species as background species
-
removeBackgroundSpecies() - Remove all background species
-
use_predation_diffusion()`use_predation_diffusion<-`() - Get or set the use_predation_diffusion flag
-
second_order_w()`second_order_w<-`() - Get or set the second_order_w flags
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 solution of steady-state equation with current rates
-
matchGrowth()experimental - Adjust model to produce observed growth
-
plotBiomassObservedVsModel()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()experimental - Plotting observed vs. model yields
-
scaleModel()experimental - Change scale of the model
-
scaleRates()experimental - Rescale all rates in a mizer 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.
-
setBevertonHolt() - Set Beverton-Holt reproduction without changing the steady state
-
setResource()resource_rate()`resource_rate<-`()resource_capacity()`resource_capacity<-`()resource_level()`resource_level<-`()resource_dynamics()`resource_dynamics<-`() - Set resource dynamics
Sharing models
Save a model together with its metadata so it can be archived or shared with other users.
-
setMetadata()getMetadata()experimental - Set metadata for a model
-
saveParams()readParams()saveSim()readSim() - Save and restore mizer objects
Running simulations
Project a MizerParams object forward in time to produce a MizerSim object containing the full time series of size spectra.
-
project() - Project size spectrum forward in time
-
projectToSteady()experimental - Project to steady state
Accessing results
Extract the raw arrays stored in a MizerSim object, such as species and resource size spectra and fishing effort at each saved time step, or extract the ecosystem state as a MizerParams object.
-
getParams() - Extract the model state from a simulation
-
initialParams() - Extract the initial state from a simulation
-
finalParams() - Extract the final state from a simulation
-
N()NResource() - Time series of size spectra
-
finalN()finalNResource()idxFinalT() - Size spectra at end of simulation
-
getEffort() - Fishing effort used in simulation
-
getTimes() - Times for which simulation results are available
Analysing results
Calculate summary quantities from a MizerSim object, such as biomass, yield, growth, and feeding level, averaged or disaggregated over time, species, or size.
-
summary_functions - Description of summary functions
-
getBiomass() - Calculate the total biomass of each species within a size range at each time step.
-
getDiet() - Get diet of predator at size, resolved by prey species
-
getGrowthCurves() - Get growth curves giving weight as a function of age
-
getN() - Calculate the number of individuals within a size range
-
getSSB() - Calculate the SSB of species
-
getTrophicLevel()experimental - Get trophic level of individuals at size
-
getTrophicLevelBySpecies()experimental - Get mean trophic level of each 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
-
getFeedingLevel() - Get feeding level
-
getCriticalFeedingLevel() - Get critical feeding level
Calculating rates
Calculate instantaneous ecological rates from a MizerParams object, such as encounter rate, predation mortality, or somatic growth rate.
-
getRates() - Get all rates
-
getDiffusion() - Get diffusion rate from predation
-
getEGrowth() - Get energy rate available for growth
-
getERepro() - Get energy rate available for reproduction
-
getEReproAndGrowth() - Get energy rate available for reproduction and growth
-
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
-
getFlux() - Get flux into size bins
-
getMort() - Get total mortality rate
-
getPredMort() - Get total predation mortality rate
-
getPredRate() - Get predation rate
-
getRDD() - Get density dependent reproduction rate
-
getRDI() - Get density independent rate of egg production
-
getResourceMort() - Get predation mortality rate for resource
Calculating indicators
Calculate ecological indicators from a MizerSim object, such as mean weight, mean maximum weight, and the Large Fish Index.
-
indicator_functions - Description of indicator functions
-
getCommunitySlope() - Calculate the slope of the community abundance
-
getMeanMaxWeight() - Calculate the mean maximum weight of the community
-
getMeanWeight() - Calculate the mean weight of the community
-
getProportionOfLargeFish() - Calculate the proportion of large fish
Plotting results
Visualise size spectra, biomass and yield trajectories, growth curves, and comparisons of model output with observations.
-
plotting_functions - Description of the plotting functions
-
plotplot.ArraySpeciesBySizeplot.ArrayTimeBySpeciesplot.ArrayTimeBySpeciesBySize - Plot mizer arrays
-
plotHover() - Create a hover-enabled plotly plot from a mizer object
-
plot2() - Compare two mizer arrays in a single plot
-
plotRelative() - Plot relative difference between two mizer arrays
-
animate()animateSpectra() - Animate size-dependent quantities through time
-
plotSpectra() - Plot abundance and biomass spectra
-
plotSpectra2() - Compare abundance and biomass spectra from two objects
-
plotSpectraRelative() - Plot relative difference between abundance spectra
-
plotCDF() - Plot cumulative abundance or biomass distributions
-
plotCDF2() - Compare cumulative abundance or biomass distributions from two objects
-
plotBiomass() - Plot the biomass of species through time
-
plotPredMort() - Plot predation mortality rate of each species against size
-
plotFeedingLevel() - Plot the feeding level of species by size
-
plotYield() - Plot the total yield of species through time
-
plotYieldGear() - Plot the total yield of each species by gear through time
-
plotFMort() - Plot total fishing mortality of each species by size
-
plot(<MizerParams>) - Summary plot for
MizerParamsobjects -
plot(<MizerSim>) - Summary plot for
MizerSimobjects -
plotDiet()experimental - Plot diet, resolved by prey species, as function of predator at size.
-
plotGrowthCurves()experimental - Plot growth curves
-
addPlot()experimental - Add lines to an existing plot
-
plotBiomassObservedVsModel()experimental - Plotting observed vs. model biomass data
-
plotYieldObservedVsModel()experimental - Plotting observed vs. model yields
-
setColours()getColours()setLinetypes()getLinetypes()experimental - Set line colours and line types to be used in mizer plots
Setting custom rates
You can override the rates mizer calculates from the species parameters and gear parameters with your own rate arrays.
-
setParams() - Set or change any model parameters
-
setPredKernel()getPredKernel()pred_kernel()`pred_kernel<-`() - Set predation kernel
-
setSearchVolume()getSearchVolume()search_vol()`search_vol<-`() - Set search volume
-
setInteraction()interaction_matrix()`interaction_matrix<-`() - Set species interaction matrix
-
setMaxIntakeRate()getMaxIntakeRate()intake_max()`intake_max<-`() - Set maximum intake rate
-
setMetabolicRate()getMetabolicRate()metab()`metab<-`() - Set metabolic rate
-
setExtDiffusion()ext_diffusion()`ext_diffusion<-`() - Set external diffusion rate
-
setExtMort()getExtMort()ext_mort()`ext_mort<-`() - Set external mortality rate
-
setExtEncounter()getExtEncounter()ext_encounter()`ext_encounter<-`() - Set external encounter rate
-
setReproduction()getMaturityProportion()maturity()`maturity<-`()getReproductionProportion()repro_prop()`repro_prop<-`()psi() - Set reproduction parameters
-
setFishing()getCatchability()catchability()`catchability<-`()getSelectivity()selectivity()`selectivity<-`()getInitialEffort() - Set fishing parameters
Extending Mizer
See Extending mizer, Using mizer extension packages and Creating a mizer extension package for more details.
-
setRateFunction()getRateFunction()other_params()`other_params<-`() - Set own rate function to replace mizer rate function
-
setComponent()removeComponent()getComponent() - Add a dynamical ecosystem component
-
`initialNOther<-`()initialNOther() - Initial values for other ecosystem components
-
NOther()finalNOther() - Time series of other components
-
clearExtensionChain() - Clear the registered extension chain
-
coerceToExtensionClass() - Coerce a mizer object to its registered extension class
-
getRegisteredExtensions() - Get the registered mizer extension chain
-
registerExtension() - Register a single mizer extension for this R session
-
registerExtensions() - Register mizer extensions for this R session
-
customFunction()experimental - Replace a mizer function with a custom version
Predation kernels
Functions that determine the size preference of predators for prey, i.e. the probability of a predator of a given size eating prey of a given size.
-
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
Functions that determine the size-selectivity of fishing gears, i.e. the proportion of fish of a given size that are retained by a gear.
-
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
Functions governing the time evolution of the background resource spectrum, together with functions for getting and setting resource parameters.
-
resource_constant() - Keep resource abundance constant
-
resource_logistic()balance_resource_logistic() - Project resource using logistic model
-
resource_semichemostat()balance_resource_semichemostat() - Project resource using semichemostat model
-
resource_params()`resource_params<-`() - Resource parameters
Reproduction functions
Functions governing the density-dependent relationship between the energy invested in reproduction and the actual egg production rate.
-
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() - Get reproduction level
-
getRequiredRDD() - Determine reproduction rate needed for initial egg abundance
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()projectRates() - Get all rates needed to project standard mizer model
-
projectDiffusion()mizerDiffusion() - Calculate diffusion rate
-
projectEGrowth()mizerEGrowth() - Get energy rate available for growth needed to project standard mizer model
-
projectERepro()mizerERepro() - Get energy rate available for reproduction needed to project standard mizer model
-
projectEReproAndGrowth()mizerEReproAndGrowth() - Get energy rate available for reproduction and growth needed to project standard mizer model
-
projectEncounter()mizerEncounter() - Get encounter rate during projection
-
projectFMort()mizerFMort() - Get the total fishing mortality rate from all fishing gears
-
mizerFMortGear() - Get the fishing mortality needed to project standard mizer model
-
projectFeedingLevel()mizerFeedingLevel() - Get feeding level needed to project standard mizer model
-
projectMort()mizerMort() - Get total mortality rate needed to project standard mizer model
-
projectPredMort()mizerPredMort() - Get total predation mortality rate needed to project standard mizer model
-
projectPredRate()mizerPredRate() - Get predation rate needed to project standard mizer model
-
projectRDI()mizerRDI() - Get density-independent rate of reproduction needed to project standard mizer model
-
projectResourceMort()mizerResourceMort() - Get predation mortality rate for resource needed to project standard mizer model
-
projectRDD() - Get density-dependent reproduction rate during projection
Internal helper functions
Utility functions used internally by mizer that may also be useful for users building extensions or working with model objects directly.
-
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
-
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_size_range_array() - Get size range array
-
get_steady_state_n() - Calculate steady state abundance
-
get_time_elements() - Get array indices for a time range in a MizerSim object
-
l2w()w2l() - Length-weight conversion
-
needs_upgrading() - Determine whether a MizerParams or MizerSim object needs to be upgraded
-
project_n()project_n_no_diffusion() - Project values for first time step of Euler method
-
project_n_2() - Project values with a predictor-corrector method
-
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
-
set_species_param_default() - Set a species parameter to a default value
-
validEffortVector() - Make a valid effort vector
-
validGearParams() - Check validity of gear parameters and set defaults
-
validSpeciesParams()validGivenSpeciesParams() - Validate species parameter data frame
-
valid_gears_arg() - Helper function to assure validity of gears argument
-
valid_species_arg() - Helper function to assure validity of species argument
-
defaults_edition() - Default editions
Classes
The S4 and S3 classes used by mizer, together with functions for constructing, inspecting, comparing, and validating them.
-
mizermizer-package - mizer: Multi-species size-based modelling in R
-
MizerParams-class - A class to hold the parameters for a size based model.
-
summary(<MizerParams>) - Summarize MizerParams object
-
str(<MizerParams>) - Display structure of MizerParams object
-
compareParams() - Compare two MizerParams objects and print out differences
-
w()w_full()dw()dw_full() - Size bins
-
validParams() - Validate MizerParams object and upgrade if necessary
-
MizerSim-class - A class to hold the results of a simulation
-
summary(<MizerSim>) - Summarize MizerSim object
-
str(<MizerSim>) - Display structure of MizerSim object
-
getSimParams() - Extract the projection parameters used to produce a simulation
-
validSim() - Validate MizerSim object and upgrade if necessary
-
MizerSim() - Constructor for the
MizerSimclass -
printprint.ArraySpeciesBySizeprint.ArrayTimeBySpeciesprint.ArrayTimeBySpeciesBySizeprint.summary.ArraySpeciesBySizeprint.summary.ArrayTimeBySpeciesprint.summary.ArrayTimeBySpeciesBySize - Print mizer objects
-
summarysummary.ArraySpeciesBySizesummary.ArrayTimeBySpeciessummary.ArrayTimeBySpeciesBySize - Summarise mizer objects
-
strstr.ArraySpeciesBySizestr.ArrayTimeBySpeciesstr.ArrayTimeBySpeciesBySize - Display the structure of mizer objects
-
as.data.frameas.data.frame.ArraySpeciesBySizeas.data.frame.ArrayTimeBySpeciesas.data.frame.ArrayTimeBySpeciesBySize - Convert mizer arrays to data frames
-
ArraySpeciesBySize() - S3 class for species x size rate arrays
-
is.ArraySpeciesBySize() - Test if an object is a ArraySpeciesBySize
-
ArrayTimeBySpecies() - S3 class for time x species arrays
-
is.ArrayTimeBySpecies() - Test if an object is a ArrayTimeBySpecies
-
ArrayTimeBySpeciesBySize() - S3 class for time x species x size arrays
-
is.ArrayTimeBySpeciesBySize() - Test if an object is an ArrayTimeBySpeciesBySize
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
-
MizerParams()deprecated - Alias for
set_multispecies_model() -
calibrateYield()deprecated - Calibrate the model scale to match total observed yield
-
completeSpeciesParams()deprecated - Alias for
validSpeciesParams() -
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() -
interdeprecated - Alias for
NS_interaction -
matchYields()deprecated - Match yields to observations
-
plotM2()deprecated - Alias for
plotPredMort() -
setInitialValues()deprecated - Set initial values to values from a simulation
-
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