Calculates one-step-ahead (OSA) residuals for the Dirichlet-multinomial tag
recapture likelihood using compResidual::resDirM().
Usage
plot_tags_residuals(
fit = NULL,
obj = NULL,
include_not_recaptured = FALSE,
seed = 123L,
data = NULL,
...
)Arguments
- fit
An
sbt_fitobject.- obj
Legacy RTMB objective used only with a legacy data-list input.
- include_not_recaptured
Logical. If true, retain the constrained not-recaptured category in the attached data. Its residual is
NAbecausecompResidual::resDirM()omits the final category, so it is excluded from both the plotted points and finite-residual summary.- seed
Integer seed for the randomized quantile residuals, or
NULLto use the current random-number stream. The default makes repeated diagnostics reproducible without changing the caller's random state.- data
Legacy named alias for a model data list; supply
objas well.- ...
Additional arguments passed to
compResidual::resDirM().
Value
A ggplot2 object. The residual data used by the function is
attached as the "residual_data" attribute; finite plotting data,
the SDNR/MAR summary, and the residual source are attached as
"plot_data", "residual_summary", and "residual_source".
Details
compResidual is an optional dependency because it is not needed
for model fitting or other standard diagnostics. This function stops with
an installation message when it is unavailable. The upstream package
requires an external OSA distribution header when installed from source;
the sbt README gives the reproducible installation command using
tools/prepare-comp-residual.sh.
See also
Other diagnostic plots:
plot_af(),
plot_biomass_spawning(),
plot_cpue(),
plot_gt(),
plot_hsps(),
plot_lf(),
plot_pops(),
plot_recruitment(),
plot_selectivity(),
plot_tags()
Examples
if (FALSE) { # \dontrun{
fit <- sbt_example_fit()
plot_tags_residuals(fit)
} # }
