Learn R Programming

mizer (version 3.4.0)

getMeanWeight: Calculate the mean size of the community

Description

getMeanWeight() calculates the mean weight of the community. This is simply the total biomass of the community divided by the abundance in numbers. getMeanLength() calculates the mean length of the community, i.e. the total length of all individuals divided by their number, where the length of an individual of weight \(w\) of species \(i\) is obtained from the length-weight relationship \(w = a_i l^{b_i}\) with the species parameters a and b.

Usage

getMeanWeight(object, species = NULL, ...)

getMeanLength(object, species = NULL, ...)

Value

A vector containing the mean weight (in grams) or the mean length (in cm) of the community through time, or a single value if called with a MizerParams object.

Arguments

object

A MizerSim or MizerParams object

species

The species to be selected. Optional. By default all target species are selected. A vector of species names, or a numeric vector with the species indices, or a logical vector indicating for each species whether it is to be selected (TRUE) or not.

...

Arguments passed on to get_size_range_array

min_w

Smallest weight in size range. Defaults to smallest weight in the model.

max_w

Largest weight in size range. Defaults to largest weight in the model.

min_l

Smallest length in size range. If supplied, this takes precedence over min_w.

max_l

Largest length in size range. If supplied, this takes precedence over max_w.

Details

The length-weight parameters a and b are taken from the species parameter data frame, where they are given the defaults a = 0.01 and b = 3 when a model is created. getMeanLength() gives an error if a model is so old that it has no such columns.

You can specify minimum and maximum weight or length for the included size range. Lengths take precedence over weights (i.e. if both min_l and min_w are supplied, only min_l will be used). You can also specify the species to be used in the calculation.

You will usually want to give a minimum size. Over the full size range the community is dominated in numbers by the smallest individuals, so both means describe the larvae rather than the fish, and in the case of getMeanLength() they do so with a length-weight relationship that was fitted to observed fish and is being extrapolated far below the sizes it describes. A minimum size also makes the indicator comparable to one calculated from survey data, which sees only the sizes the gear catches.

See Also

Other functions for calculating indicators: getCommunitySlope(), getMeanMaxWeight(), getProportionOfLargeFish()

Examples

Run this code
mean_weight <- getMeanWeight(NS_sim)
years <- c("1967", "2010")
mean_weight[years]
getMeanWeight(NS_sim, species = c("Herring", "Sprat", "N.pout"))[years]
getMeanWeight(NS_sim, min_w = 10, max_w = 5000)[years]
getMeanWeight(NS_params)

mean_length <- getMeanLength(NS_sim)
mean_length[years]
# Only a couple of centimetres, because the larvae outnumber everything
# else. Give a minimum size to get an indicator about fish:
getMeanLength(NS_sim, min_l = 10)[years]
getMeanLength(NS_sim, min_w = 10, max_w = 5000)[years]
getMeanLength(NS_sim, species = c("Herring", "Sprat", "N.pout"),
              min_l = 10)[years]
getMeanLength(NS_sim@params, min_l = 10)

Run the code above in your browser using DataLab