Skip to contents

A tidy data frame of the observed and predicted survey and fishery indices from a fitted model, with standard errors, confidence intervals, a log-scale residual and the catchability blocks. Population-specific indices are included when their Use*_pop flags hold any ones.

Usage

get_idx_fits(data, rep, year_labs)

Arguments

data

Input data used in the RTMB model, holding ObsSrvIdx, ObsSrvIdx_SE, ObsFishIdx, ObsFishIdx_SE, Wt_SrvIdx, Wt_FishIdx, srv_q_blocks, fish_q_blocks, UseFishIdx and UseSrvIdx, plus the _pop counterparts for the population-specific indices.

rep

RTMB report holding PredSrvIdx and PredFishIdx, both [n_pop × n_regions × n_years × n_seas × n_fleets]. The pooled indices are summed across populations; the population-specific ones read each slice directly. SrvIdx_SD and FishIdx_SD, with their _pop counterparts, give the total index standard deviation the intervals use.

year_labs

Year labels for the year dim of the index arrays.

Value

A data frame with Region, Year, Seas, Fleet, Type ("Survey", "Fishery", "Pop Survey" or "Pop Fishery"), the observed value obs and predicted value, the weight-adjusted total standard deviation se, the 95% lognormal interval lci and uci, the q_block, the log-scale resid, and Category, which combines the type, population, fleet, season and q block.

Details

The resid column is the plain log-scale residual \(\log(\text{obs}) - \log(\text{predicted})\), not a one-step-ahead residual. For decorrelated OSA index residuals, with the QQ plots and SDNR from plot_resids, use get_osa with index_source. The fit plot built from this output is get_idx_fits_plot.

Examples

if (FALSE) { # \dontrun{
idx_fits <- get_idx_fits(
  data = data,
  rep = rep,
  year_labs = seq(1960, 2024, 1)
)
} # }