plotYieldObservedVsModel()contributed by @SamikDatta., together with their plotly counterparts.
calibrateYield()to set the model scale to agree with total observed biomass or total observed yield. Uses the new
matchYields()will try to adjust the abundances of the species to produce the observed biomasses or yields. See blog post at https://bit.ly/2YqXESV .
params <- setReproduction(params, maturity = my_maturity)one can simply use
maturity(params) <- my_maturity. These are documented together with the setter functions. #213
setMetadata()to add information to a MizerParams object describing the model, for example a title, a description, the author or list of authors, a url and a doi. This will be particularly useful for sharing your models with others
saveParams()for saving a MizerParams object to a file and
readParams()for reading it back in. The resulting files can be shared with others who want to run your model.
getMetadata(). This helps you keep track of different versions of your model.
steady()now has a
preserveargument with possible values
reproduction_levelto specify which quantity to preserve. This means that one can continue to use
steady()also once one has started to tune the density dependence in reproduction. #208
gear_paramsare now set to “species, gear”, so that one can access individual entries with for example
gear_params(NS_params)["Cod, Otter", "catchability"]. #212
setExtMort()has been deprecated in favour of
ext_mortin order to avoid confusion with the species parameter
setLinetypes()now issue warnings when invalid values are given and ignores NAs.
commentarguments to the setter functions have been removed. #214
resetargument which, when set to
TRUEwill recalculate the rates from the species_, gear_ and resource_params even when custom values had been set. #214
speciesargument to various functions, which is checked with
valid_species_arg(), now does not throw an error even when there is no valid species included. Only a warning is issued. That means that for example
plotSpectra(NS_params, species = list(), total = TRUE)is now allowed.
getComponent()from the mizer extension mechanism now returns NULL when asked for a non-existent component instead of giving an error. This gives an easy way to check for the existence of a component.
interfor the North Sea model now has the alternative name
NS_interaction, with the old name deprecated.
addSpecies()are now by default given a reproduction level of 1/4 instead of 0, because at the low densities at which they are introduced there would otherwise not be enough density dependence to stabilise them.
max_lused in some summary functions and processed by
get_size_range_array()accept vector values setting different limits for different species.
resource_capacityas arguments, which makes it easier to use them in extension packages.
linetypein the species parameters now actually changes the linecolours and linetypes as intended.
getGrowthCurves()and plotted with
plotGrowthCurves()are now correct, and no longer extend above the asymptotic size.
species_panel = TRUEnow respects the
speciesargument to only show growth curves for selected species, it works with a MizerParams object as well as a MizerSim object, and it shows the panels in the correct order. #201
setBevertonHolt()function has been expanded with more arguments. It allows you to change the density dependence in reproduction without changing the steady state of your model.
getReproductionLevel()function tells you at what proportion of their maximum reproduction rate the species are operating in your model.
NS_simwhich holds a simulation of the North Sea model.
plotDataFrame()allows easier creation of plots.
setInitialValues()correctly preserves the gear names on the initial effort. Thanks to Axel Rossberg.
getFMort()correctly passes the
targument on to any custom fishing mortality function you may have written.
mizerPredMort()suggested by Axel Rossberg.
plotSpectra()now only shows those species in the legend that are actually contained in the plot.
initialNOther()also works with MizerSim object.
projectToSteady()is called with
effort, this effort is now also stored in the
summary()which is now using
sprintf()for better formatting and also gives the initial_effort.
project_simple()have been given convenient defaults.
newSingleSpeciesParams()for creating a single species in a power-law background.
animateSpectra()creating an animated plot of a simulation.
setComponent()can now take any form, they no longer have to be a named list.
return_datain the plot’s functions allows to return the data frame used for the ggplot instead of the plot.
getYield()now also works with density-dependent fishing mortality. Thanks to James Roger for discovering the problem.
gammaargument now is no longer ignored in
newTraitParams()but correctly overrides the
getFMort()again works correctly when called with a MizerSim object.
resource_semichemostat()no longer fail when at some sizes both the resource growth rate and the resource mortality rate are both zero.
newTraitParams()is now always an integer.
w_min_idxshould point to the start of the size bin containing the egg size
valid_species_arg()is called with
species = NULLand there are no background species then it returns
projectToSteady()to run the full dynamics to steady state.
distanceMaxRelRDI()to measure distance between two states.
compareParams()to compare two MizerParams objects.
constantEggRDI()to allow keeping egg densities fixed.
customFunction()to allow users to overwrite mizer functions.
plotGrowthCurvesas a panel of species with their respective Von Bertalanffy curves
plotFMortwill stop displaying mortality values past the species’ asymptotic size. The argument
all.sizesallows you to continue to show these values.
lifecyclepackage to indicate status of some functions and arguments as ‘experimental’ or ‘deprecated’.
speciesargument in mizer functions, via the new
min_w_ppis larger than
tpassed to dynamics functions has been corrected.
setReproduction()now correctly sets the the total proportion psi when the maturity proportion is changed.
project()has been simplified. They are now either set by the arguments
t_saveor by the dimension names of the
setBevertonHolt()and allow it to work on an arbitrary MizerParams object. The old name
setRmax()is still available as alias.
mizerFMort()now can also use the abundances and the rates
pred_mort. This is useful for example for implementing balanced harvesting.
gear_paramsis allowed to have zero rows.
validGearParams()the species name is used as gear name in case
validGearParams()ensures that all required arguments of the selectivity function are supplied and checks validity of species names.
steady()fails because RDI is zero it gives a meaningful error message.
newCommunityParams()now protects its zero investment in reproduction with a comment.
valid_species_arg()checks validity of species selection arguments.
upgradeParams()can now also upgrade old MizerParams objects that do not have a consistent
validParams()validates a MizerParams object and automatically upgrades it with
getRates()to calculates all rates and collects them in a list.
return_sim = TRUEnow creates the MizerSim object the same way as
project(), namely with the original values in the first time slot.
getRates()functions by removing the arguments that passed in other rates. Instead the required rates are now always calculated within these functions.
validGearParams()handle NAs more gracefully and check that there are no duplicates.
upgradeParams()works also on params objects that were created with a development version of mizer.
upgradeParams()does a better job at guessing the value for
steady()now work also when model has extra components.
plotFeedinglevel()when called with
include_critical = TRUE, see #162.
species_paramsis a tibble.
getDiet()also takes into account possible contributions by user-defined other components.
project()is called with
t_max < t_savethen
t_saveis automatically reduced so that the result at
t_maxwill get saved.
project_simple()that projects a given number of time steps. This might be useful to extension writers.
project()is passed on to the dynamics and rate functions.
steady()runs faster by using
Some inconsistencies in the choice of names for parameters was removed by renaming
This is a major new release with many new features, an internal refactoring of the code and a new extension mechanism.
Nevertheless this version of mizer is almost fully backwards compatible with version 1.0 with the exception of bug fixes and the following breaking changes:
print_itargument from plot functions.
plotFeedingLevel()now only plots the values within the size range of each species. If for some reason you want the old plots that show a feeding level also for sizes that the fish can never have, you need to supply an argument
all.sizes = TRUE.
sex_ratioargument has been removed from
set_scaling_model()function has been removed because such models can now be set up with
newTraitParams()with the options
perfect_scaling = TRUEand
egg_size_scaling = TRUE.
retuneAbundance()have been removed to the “mizerExperimental” package (https://sizespectrum.org/mizerExperimental/)
project()a progress bar is displayed by default. You can turn this off with the option `progress_bar = FALSE.
The new functions
replace the old functions
MizerParams(), which are now deprecated. The new functions choose better default values, in particular for metabolic rate and maximum intake rate.
After setting up a mizer model, it is possible to change specific model parameters with the new functions
The documentation for these functions serves to explain the details of the mizer model.
Along with these setter functions there are accessor functions for getting the parameter arrays:
The MizerParams object now also contains the initial values for the size spectra. This is particularly useful if the model has been tuned to produce the observed steady state. The new function
steady() finds a steady state for a model and sets it as the initial value. The initial values can be accessed and changed via functions
initialNResource(). The initial values can be set to the final values of a previous simulation with
The MizerParams object now has a slot
initial_effort that specifies the initial fishing effort to which the steady state has been calibrated.
Mizer now has an extension mechanism that allows other R packages to be written to generalise the mizer model. See
setComponent(). This mechanism is still experimental and may change as we gain experience in writing extensions for mizer.
plotlyBiomass()as the plotly version of
plotBiomass(), and so on.
plotGrowthCurves()plots growth curves and compares them to the von Bertalanffy growth curve.
plotDiet()plots the diet composition as a function of predator size.
highlightargument to all plot functions that display curves for multiple species. Displays highlighted species with wider lines.
plot()method for MizerParams object to plot the initial state.
plotFeedingLevel()allows to show also the critical feeding level.
plotSpectra()in analogy to the existing
ylimargument to limit the
wrange in the plot.
solidbut this can be changed via the
box_pred_kernel()implements a box-shaped kernel as an alternative to the default
power_law_pred_kernel()implements a power-law kernel with sigmoidal cutoffs at both ends. This is suitable for filter feeders.
setPredKernel()). Mizer automatically falls back on the old non-FFT code to handle this. (#41)
getPredKernel()returns the full 3-dimensional predation kernel array, even when this is not stored in MizerParams object.
upgradeSim()can upgrade objects from previous versions of mizer so they work with the new version.
getDiet()calculates the diet of predators. (#43)
SheperdRDD()for density-dependence in reproduction, as well as
double_sigmoid_length()allows modelling of escape of large individuals.
sigmoidal_weight()is weight-based trawl selectivity function. (Ken H Andersen)
getGrowthCurves()calculates the growth curves (size at age).
mizerRates()calculates all the rates needed in the model and collects them in a list.
times()to extract the times at which simulation results are saved in a MizerSim object.
finalNOther()as well as
idxFinalT()to access the values at the final time of a simulation.
getCriticalFeedingLevel()returns the critical feeding level for each species at each size.
melt()function from the reshape2 package which allows users to convert the arrays returned by mizer functions into data frames that can be used for example in ggplot2 and plotly.
validSpeciesParams()checks validity of species parameter data frame and sets defaults for missing but required parameters.
qas well as the feeding level
f0can now be set at the species level via columns in
fccan now be specified as a species parameter and will be used to calculate the metabolic rate parameter
ksif it is not supplied.
project()now shows a progress bar while a simulation is running. Can be turned off with
progress_bar = FALSEargument.
interaction_resourcecolumn in the species parameter data frame.
w_mat25column in the species parameter dataframe, which gives the size at which 25% of the individuals of a species are mature.
mcolumn in the species parameter data frame.
project()can now continue projection from last time step of a previous simulation if the first argument is a MizerSim object. The new
appendargument then controls whether the new results are appended to the old.
n_otherarguments from the initial values in the
newTraitParams()to produce a perfectly scale-invariant model.
newTraitParams()allows the inclusion of external mortality.
NS_paramswith the North Sea model MizerParams object.
getSSB(), the calculation of the spawning stock biomass is done correctly using the maturity ogive instead of the proportion of energy allocated to reproduction. (#47)
getPredRate()now set names on the returned arrays.
ylimargument is not handled correctly in plots.
display_frame()is now exported.
getGrowthCurves()also works when there is only a single species
project()is used correctly
get_initial_n()gets values for
qfrom params object
summary()of MizerParams object reflects the number of non-empty resource bins. (@patricksykes)
get_ks_default(), making it easier to change or extend these in the future.
set_species_param_default()makes it easier to set default values for species parameters.
@inheritfunctionality of roxygen2 to reduce duplication in roxygen documentation.
getPhiPrey()is replaced by
getEncounter()which now returns the full encounter rate, including the contribution from other components. Even in the absence of other components,
getEncounter()differs from the old
getPhiPrey()because it includes the search volume factor.
paramsto refer to an argument of class MizerParams,
simto refer to an argument of class MizerSim, and
objectto an argument that can be either.
setClass()to follow the new guidelines, replacing
progress_barbecause they control any type of progress bar.
tapply()where possible to improve readability.
anyNA()because they were not available in R 3.1
@activityslots into a single
@species_paramsinto its own slot.
@maturityto hold the maturity ogive.
@pred_kernelto hold predation kernel if it has variable predator/prey ratio.
@resource_dynamicsto allow user to specify alternative resource dynamics.
@gear_dynamicsto species to be targeted by multiple gears.
@ft_maskthat is used when calculating predation rates using the Fourier transform method.
@rates_funcsto allow mizer extensions to replace mizer rate functions with their own rate functions.
@srrwe now have the name of the function in
@rate_funcs$RDD, see #91.
@initial_n_otherto allow mizer extensions to add more ecosystem components.
set_scaling_model(), see section 12 in the vignette.
PlotYield()no longer fails when species names are numbers or when a species abundance is zero
totalparameter to several plot functions to add the curve for the total community (sum over all species and resource)
speciesparameter to all plot functions to allow for only a selection of species to be plotted
@initial_n_ppslots to MizerParams class.