
Last chance! 50% off unlimited learning
Sale ends in
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.
getCommunitySlope(sim, species = NULL, biomass = TRUE, ...)
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.
Boolean. If TRUE (default), the abundance is based on biomass, if FALSE the abundance is based on numbers.
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
.
A data.frame with four columns: time step, slope, intercept and the coefficient of determination R^2.
Other functions for calculating indicators:
getMeanMaxWeight()
,
getMeanWeight()
,
getProportionOfLargeFish()
# NOT RUN {
# Slope based on biomass, using all species and sizes
slope_biomass <- getCommunitySlope(NS_sim)
slope_biomass[1, ] # in 1976
slope_biomass[idxFinalT(NS_sim), ] # in 2010
# Slope based on numbers, using all species and sizes
slope_numbers <- getCommunitySlope(NS_sim, biomass = FALSE)
slope_numbers[1, ] # in 1976
# Slope based on biomass, using all species and sizes between 10g and 1000g
slope_biomass <- getCommunitySlope(NS_sim, min_w = 10, max_w = 1000)
slope_biomass[1, ] # in 1976
# 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(NS_sim, species = dem_species,
min_w = 10, max_w = 1000)
slope_biomass[1, ] # in 1976
# }
Run the code above in your browser using DataLab