Skip to contents

Returns a tidy tibble of observed-vs-expected pairs drawn from the output of get_estimates(). Only rows that have both an observed value and a model-expected value are included (i.e. data-likelihood rows), so parameter rows without data observations are automatically dropped.

Usage

# S3 method for class 'FIMSFit'
augment(x, include_weights = TRUE, ...)

Arguments

x

A FIMSFit object returned from fit_fims().

include_weights

Logical (default TRUE). When TRUE and uncertainty is available, a .weight column is added equal to 1 / uncertainty^2 (inverse-variance weights). Rows where uncertainty is NA or zero receive NA weights, which yardstick silently drops when calling weighted metrics.

...

Unused; present for S3 method compatibility.

Value

A tibble::tibble() with at least the columns .truth, .pred, and optional .weight, plus grouping-metadata columns.

Details

The returned tibble follows the conventions expected by every yardstick::metric_set() metric function:

ColumnRole
.truthObserved data value (maps from observed)
.predModel-expected value (maps from expected)
.weightInverse-variance weight from uncertainty (optional)
labelParameter / quantity label, e.g. "landings_expected"
fleetFleet identifier (integer)
module_idUnique module identifier
distributionLikelihood distribution used for this data stream
year_iYear index (present when available in the estimates)
age_iAge index (present when available in the estimates)

Examples

if (FALSE) { # \dontrun{
data("data_big")
data_4_model <- FIMSFrame(data_big)

fit <- create_default_parameters(
  configurations = create_default_configurations(data = data_4_model),
  data = data_4_model
) |>
  initialize_fims(data = data_4_model) |>
  fit_fims(optimize = TRUE)

# Tidy tibble of observed vs. expected, ready for any yardstick metric
augment(fit)
} # }