Return keyed catch and survey rows for plotting or further checks. This is a convenience extractor: standardized residuals are the existing fitted-state residuals, affected by shrinkage, not independent prediction errors.
Arguments
- object
A fitted
tam_fit.- type
"standardized"(default),"log"(log observation minus log prediction),"response"(observation minus prediction), or"osa".- method
OSA algorithm, as in
add_osa_residuals(). Only used withtype = "osa". Explicitly supplying it requests a fresh calculation.- ...
Computation controls passed to
RTMB::oneStepPredict(), such astrace = FALSEorparallel = FALSE.subsetandconditionalindex included observations in likelihood order; unrequested rows retain missing residuals. Explicit controls request a fresh calculation; other residual types reject them.
Value
A data frame with year, age, type (catch/index), survey, observations,
predictions, residuals, and available unit/fleet columns. OSA output also
identifies osa_method. The residual_type attribute names the requested
scale, and osa retains available method/settings/coverage metadata.
Details
type = "osa" reuses cached OSA columns when no computation controls
or method are supplied. Otherwise both catch and index residuals are calculated
together, using one algorithm at fitted parameter values. It can be expensive,
but does not rerun fit_tam() or re-estimate fixed parameters. Temporary
objectives protect the fitted object's state. Other residual types remain
simple extractors. Excluded observations, including zeros, retain rows with
missing residuals. The supplied fit is not modified or implicitly cached.
To retain results for later extraction and dashboard use, assign
fit_osa <- add_osa_residuals(fit, method = "oneStepGeneric", trace = FALSE).