Skip to contents

Store observation diagnostics in a returned copy of a fitted model for use with residuals() and vis_tam(). One-step-ahead residuals are available for all-lognormal fits. Standardized residuals are already in the fit.

Usage

add_residuals(
  fit,
  type = c("quantile", "osa"),
  ...,
  residual_seed = NULL,
  method = NULL
)

Arguments

fit

A fitted tam_fit.

type

"quantile" (default) or "osa".

...

For type = "osa", arguments to add_osa_residuals().

residual_seed

Optional nonnegative integer for the Gaussian draw and randomization of observed zeros. Defaults to the stored seed or 123456.

method

Residual method, as in residuals.tam_fit().

Value

A tam_fit with retained quantile_res or osa_res columns in $obs_pred. The supplied fit and the caller's random-number state are unchanged by the quantile calculation.