Skip to contents

Calculates one-step-ahead residuals for the length-composition likelihoods using RTMB::oneStepPredict().

Usage

plot_lf_residuals(
  fit = NULL,
  obj = NULL,
  fishery = c("LL1", "LL2", "LL3", "LL4", "CPUE"),
  seed = 123L,
  data = NULL,
  ...
)

Arguments

fit

An sbt_fit object.

obj

Legacy RTMB objective used only with a legacy data-list input.

fishery

Fishery or fisheries to plot. Can be numeric indices or names. Use "CPUE" or 7 for the CPUE length compositions.

seed

Random seed used by randomized discrete residuals. Use NULL to leave the RNG state unchanged.

data

Legacy named alias for a model data list; supply obj as well.

...

Additional arguments passed to RTMB::oneStepPredict().

Value

A ggplot2 object with residual data, row diagnostics, non-finite residuals, observation names, and residual sources attached as attributes.

Details

The current preflight check requires both lf_pred and cpue_lf_pred in the model report even when the requested fishery uses only one of those prediction sources.