Skip to contents

Creates a visualization of retrospective analysis results, displaying spawning biomass estimates from multiple retrospective peels. The plot includes point estimates with uncertainty intervals to help identify retrospective patterns or bias.

Usage

plot_retrospective(retro_fit, quantity = "spawning_biomass")

Arguments

retro_fit

A list returned by run_fims_retrospective() containing:

  • years_to_remove - Vector of years removed for each peel

  • estimates - Data frame with model estimates for each retrospective run

quantity

A character vector specifying which quantity to plot. Currently, the only option is the default, "spawning_biomass". The values must match entries in the label column of the estimates data frame.

Value

A ggplot object displaying retrospective patterns. The plot includes:

  • Line plots for each retrospective peel

  • Shaded confidence intervals (+/-1.96 SE)

  • Different colors and line types for each peel

  • Facets by quantity if multiple quantities are specified

  • NOAA-themed styling via stockplotr::theme_noaa()

The plot is also automatically saved as "retrospective.png".

Details

Plot Retrospective Analysis Results

The function generates line plots showing how estimates change when terminal years of data are removed. Each retrospective peel is displayed as a separate line with a unique color and line type. Confidence intervals are shown as shaded ribbons around each line, calculated as the estimate +/- 1.96 * standard error (assuming normality).

When multiple quantities are specified, the plot uses facets to display each quantity in a separate panel with independent y-axes. This is useful for comparing retrospective patterns across different model outputs.

The plot automatically saves to "retrospective.png" in the current working directory in addition to returning a ggplot object that can be further customized.

References

Mohn, R. 1999. The retrospective problem in sequential population analysis: An investigation using cod fishery and simulated data. ICES Journal of Marine Science 56: 473-488.

See also

Other diagnostic_functions: plot_likelihood(), run_fims_likelihood(), run_fims_retrospective()

Other plotting_functions: plot_likelihood()

Examples

if (FALSE) { # \dontrun{
library(FIMS)

# Use built-in dataset from FIMS
data("data1")
data_4_model <- FIMSFrame(data1)

# Create parameters object
parameters <- data_4_model |>
  create_default_configurations() |>
  create_default_parameters(data = data_4_model)

# Run base model
base_model <- parameters |>
  initialize_fims(data = data_4_model) |>
  fit_fims(optimize = TRUE)

# Run retrospective analysis
retro_fit <- run_fims_retrospective(
  years_to_remove = 0:5,
  data = data1,
  parameters = parameters,
  n_cores = 1
)

# Plot spawning biomass only
plot_retrospective(
  retro_fit = retro_fit,
  quantity = "spawning_biomass"
)
} # }