Skip to contents

The troll residual plot uses likelihood-scale standardized lognormal residuals rather than RTMB one-step-ahead (OSA) residuals. In the troll likelihood, troll_q is profiled from the troll observations inside get_troll_like(), so RTMB::oneStepPredict() is numerically unstable or returns degenerate residuals for troll_log_obs. The residual plotted is (log(obs) - log(pred)) / sqrt(troll_sd^2 + troll_tau^2).

Usage

plot_troll_residuals(fit = NULL, obj = NULL, data = NULL)

Arguments

fit

An sbt_fit object.

obj

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

data

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

Value

A ggplot2 object. The residual data and diagnostic summary are attached as "residual_data" and "residual_summary" attributes.