calculateMetricsByCU: calculateMetricsByCU

View source: R/Module_calculateMetricsByCU.R

calculateMetricsByCUR Documentation

calculateMetricsByCU

Usage

calculateMetricsByCU(
  cu.file,
  cu.info,
  cyclic.cu.bm = NULL,
  retro.start.use = 1995,
  out.label = "MetricsOut",
  out.filepath = ""
)

Arguments

cu.file

a data frame with CU time series. REQUIRED variables are CU_ID (e.g., SEL-24-05), CU_Name (e.g., Meziadin) Species (e.g., Sockeye), Year, SpnForAbd_Wild (Spawner estimate used for abundance metrics), SpnForTrend_Wild (spawner estimate used for trend metrics) Abd_StartYr (first year to use for abundance metric), UseYear (T/F whether this year's estimate can be used for metric calculations). Note, for most CUs, SpnForAbd_Wild and SpnForTrend_Wild have the same values. However, for Fraser Sockeye CUs, effective female spawners are used for trend metrics and effective total spawners for abundance metrics). OPTIONAL variables that are not used for metric calculations but may be used in various diagnostics that provide context: SpnForAbd_Total, SpnForTrend_Total, Recruits_Wild, Recruits_Total..

cu.info

a data frame with specifications for each CU. Required variables are Species (e.g., Sockeye), Species_Short (e.g., Sk), CU_ID (e.g., SEL-24-05), CU_Name (e.g., Meziadin),DataQualkIdx (one of Abs_Abd or Rel_Idx), AbdMetric (T/F is relative abundance metric applicable for this CU?), AbsAbdMetric (T/F is absolute abundance metric applicable for this CU?), ShortTrendMetric (T/F for x generation slope metric), LongTrendMetric (T/F for long-term trend metric),PercentileMetric (T/F for percentile metric, which is not currently used in rapid status decision tree), Avg_Gen (integer with average generation time), Cyclic (T/F whether CU is cyclic), Cyc_Dom and Cyc_Dom_Year (index and base year for dominant cycle, see below), TrendNumGen (number of generations for slope metric), TrendExtraYears (any extra years for slope metric? For WSP =0, for some COSEWIC = 1), TrendLog (T/F for log-transform before slope calc. WSP: True), TrendSmooth (T/F for generation smoothing before slope calc. WSP: T for most sockeye, Coho, F for most Chinook), AvgType (type of average used for generational average. WSP: always 'geomean'), AvgSmooth (T/F for smoothing before average. WSP :almost always F), AvgRecentExcl (T/F for excluding the most recent generation from long-term average. WSP: always F) LongTrendMinYears (minimum number of years for long-term calculation. WSP: always 15), RelAbd_AvgData (EXPLAIN THIS ONE? STILL USED?), RelAbd_LBM and RelAbd_UBM (Lower and upper benchmark for Relative Abundance Metric. WSP: generally Sgen and 80

\item

retro.start.usefirst year for the retrospective metrics calculations (if data are available)

\item

out.labellabel to use in the filenames for the output

\item

out.filepathfolder for storing the output files

\item

cu.cyclic.bmif the data set includes highly cyclic Fraser sockeye CUs, an extra input file is needed. This is a data frame with the following required variables: CU_ID, CU_Name,Cycle,cyc,RelAbd_LBM,RelAbd_UBM. 'Cycle' is the base year (one of 1950-1953) and cyc is the corresponding cycle line index (1951=1,1952=2,1953=3,1950=4)

this function loops through a data set of CU spawner time series and applies the calcMetrics() function trend


Pacific-salmon-assess/WSP-Metrics-Pkg documentation built on July 16, 2025, 1:46 p.m.