Learn R Programming

mizer (version 1.0.1)

getCommunitySlope: Calculate the slope of the community abundance

Description

Calculates the slope of the community abundance through time by performing a linear regression on the logged total numerical abundance at weight and logged weights (natural logs, not log to base 10, are used). You can specify minimum and maximum weight or length range for the species. 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.

Usage

getCommunitySlope(object, ...)

# S4 method for MizerSim getCommunitySlope(object, species = 1:nrow(object@params@species_params), biomass = TRUE, ...)

Arguments

object

An object of class MizerSim.

...

Optional parameters include

  • min_w Minimum weight of species to be used in the calculation.

  • max_w Maximum weight of species to be used in the calculation.

  • min_l Minimum length of species to be used in the calculation.

  • max_l Maximum length of species to be used in the calculation.

species

Numeric or character vector of species to include in the calculation.

biomass

Boolean. If TRUE (default), the abundance is based on biomass, if FALSE the abundance is based on numbers.

Value

A data frame with slope, intercept and R2 values.

Examples

Run this code
# NOT RUN {
data(NS_species_params_gears)
data(inter)
params <- MizerParams(NS_species_params_gears, inter)
sim <- project(params, effort=1, t_max=40, dt = 1, t_save = 1)
# Slope based on biomass, using all species and sizes
slope_biomass <- getCommunitySlope(sim)
# Slope based on numbers, using all species and sizes
slope_numbers <- getCommunitySlope(sim, biomass=FALSE)
# Slope based on biomass, using all species and sizes between 10g and 1000g
slope_biomass <- getCommunitySlope(sim, min_w = 10, max_w = 1000)
# Slope based on biomass, using only demersal species and sizes between 10g and 1000g
dem_species <- c("Dab","Whiting","Sole","Gurnard","Plaice","Haddock", "Cod","Saithe")
slope_biomass <- getCommunitySlope(sim, species = dem_species, min_w = 10, max_w = 1000)
# }

Run the code above in your browser using DataLab