This function calculates all (or a subset) of the Stability and Resistance indicators for \(j\) areas and \(i\) years. The user can choose whether the function returns the indicator dataframe to the global environment, exports the dataframe to a .csv file, or both. The user can also choose whether the function returns the raw indicator values, the standardized (z-score) values, or both.
allStability(X, land, maxlength.group, species.table, speciesinfo.table,
TL.grouping = 1, wind = 5, negative = FALSE, years, raw = TRUE,
std = TRUE, glob.env = TRUE, export.path = NULL,
export.id = NULL)
A dataframe of fishery independent data derived from research vessel
survey data or model output, with columns YEAR
, ID
,
SPECIES
, BIOMASS
, and ABUNDANCE
. YEAR
indicates the year the observation was recorded, ID
is an area code
indicating where the observation was recorded, SPECIES
is a numeric
code indicating the species sampled, and BIOMASS
/ABUNDANCE
is
the corresponding biomass/abundance (stratified and corrected for
catchability as required).
A dataframe of commercial landings data with columns YEAR
,
ID
, SPECIES
and CATCH
. YEAR
indicates the year
the landing was recorded, ID
is an area code indicating where the
landing was recorded, SPECIES
is a numeric code indicating the
species landed, and CATCH
is the corresponding landed weight.
A character string indicating the species group for
which to calculate the mean maximum length of fish in the community. Must be
set to "ALL"
or match a column name in species.table
. If
maxlength.group = NULL
, the mean maximum length will not be
calculated.
A table where the column names match the entries in
resource.groups
, ratio.groups
, and/or condition.groups
.
Column entries are the species codes indicating the species from X
(or X_length
) included in each group. species.table
may also
include columns for other species groups; these will be ignored.
A table with columns SPECIES
and the
corresponding TL
, MAXLENGTH
, MAXAGE
, and IVI
(trophic level, maximum recorded age, maximum recorded length, and intrinsic
vulnerability index). Entries in the SPECIES
column should be the
unique values of species codes in X
(or a subset thereof). If there
are different species codes in X
and land
, the Intrinsic
Vulnerability Index of the Landings indicator should be calculated
separately using the function IVILandings()
.
Size of the trophic level bin for which to aggregate
biomass when calculating Biomass per Trophic Level. For example, if
TL.grouping = 1
, trophic levels are binned from 1.00 - 1.99, 2.00 -
2.99, etc. If TL.grouping = 0.5, trophic levels are binned from 1.00 - 1.49,
1.50 - 1.99, 2.00 - 2.49, 2.50 - 2.99, etc. Default is TL.grouping =
1
so that biomass is aggregated over discrete trophic levels.
Window for the moving average used to calculate the Coefficient of
Variation of the Biomass. The first and last floor(wind/2)
values of
the indicator are assigned NA
to account for the moving average.
Default is wind = 5
years.
If negative = TRUE
, the Coefficient of Variation of the
Biomass will be multiplied by -1 so that the expected response is to
decrease with increasing fishing pressure. Default is negative =
FALSE
.
A vector of years for which to calculate indicators.
A logical value. If raw = TRUE
, the raw indicator values are
returned by the function. If raw = FALSE
, the raw indicator values are
not returned. Default is raw = TRUE
. Either raw
or std
must be TRUE
.
A logical value. If std = TRUE
, the standardized indicator
values for each area ID
are returned by the function. Indicators are
standardized using z-scores, i.e., by subtracting the mean and dividing by
the standard deviation (ignoring NA
values). If std = FALSE
,
the standardized indicator values are not returned. Default is std =
TRUE
. Either raw
or std
must be TRUE
.
Logical value indicating whether to return output to global
environment. Default is glob.env = TRUE
.
File path indicating where to save a .csv file of
calculated indicators (named stability_export.id.csv; see below). If
export.file = NULL
, the indicator dataframe will not be exported as a
.csv file. Default is export.path = NULL
.
Character string to modify the name of the .csv file (if
export.path is specified), for example an area name or date of analysis. The
exported .csv file is named stability_export.id.csv. Default is
export.id = NULL
.
Returns a dataframe with columns ID
, YEAR
, and
indicators corresponding to the arguments supplied to the function.
Standardized indicators are noted with _s
in the name.
This function calculates the Stability and Resistance indicators: Biomass per Trophic Level, Intrinsic Vulnerability Index, Coefficient of Variation of the Biomass, Mean Lifespan, and Mean Maximum Length (weighted by biomass and abundance). If data are not available to calculate one or more of these indicators, a subset will be returned. See the help file for the individual functions for information on how each indicator is calculated.
Notes on indicator calculations: In the individual functions, the user
generally has control over which metric (e.g., BIOMASS
or
ABUNDANCE
) is used to calculate the indicator. Here, BIOMASS
is used to calculate Coefficient of Variation of the Biomass, Mean Lifespan,
Biomass per Trophic Level, and Mean Maximum Length weighted by biomass.
ABUNDANCE
is used to calculate Mean Maximum Length weighted by
abundance. See individual functions for more flexibility.
Bundy A, Gomez C, Cook AM. 2017. Guidance framework for the selection and evaluation of ecological indicators. Can. Tech. Rep. Fish. Aquat. Sci. 3232: xii + 212 p.
Other stability and resistance indicators: CVBiomass
,
IVILandings
, biomassPerTL
,
meanMaxAge
, meanMaxLength
# NOT RUN {
# Compile data
data(X)
data(land)
data(species.info)
data(species.table)
# Calculate raw and standardized indicators
allStability(X = X, land = land, maxlength.group = "FINFISH",
species.table = species.table, speciesinfo.table = species.info,TL.grouping = 1,
wind = 5, negative = FALSE, years = c(2014:2019), raw = TRUE, std = TRUE)
# }
Run the code above in your browser using DataLab