
Extract a single data stream from a FIMSFit augmented tibble
Source:R/augment-fims.R
get_fit_stream.RdConvenience filter to pull out one specific data stream (e.g. the landings for a given module) so you can pass it directly to any yardstick metric or plot it.
Arguments
- x
A
FIMSFitobject or an already-augmented tibble fromaugment.FIMSFit().- stream_label
Character scalar. The value of the
labelcolumn to retain, e.g.,"landings_expected","index_expected","agecomp_expected", or"lengthcomp_expected". IfNULL(default), no filtering on label is done.- module_id
Integer scalar. The
module_idof the fleet or survey to retain (e.g.,1for the first fishing fleet,2for the first survey indata_big). IfNULL(default), all modules are included.- ...
Forwarded to
augment.FIMSFit()whenxis aFIMSFit.
Value
A tibble::tibble() subset of the augmented data.
Details
In the FIMS output the fleet column is NA for derived-quantity rows
(which is where all observed/expected pairs live). Use module_id instead
to distinguish fleets and surveys — this matches the convention used in the
FIMS vignettes, where module_id == 1 is the first fishing fleet and
module_id == 2 is the first survey. To discover which module_id values
are present in your fit, inspect augment(fit) directly.
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)
# Landings for the fishing fleet (module_id 1) — compute RMSE
get_fit_stream(fit, stream_label = "landings_expected", module_id = 1) |>
yardstick::rmse(truth = .truth, estimate = .pred)
# Survey index stream (module_id 2 in the data_big example)
get_fit_stream(fit, stream_label = "index_expected", module_id = 2)
# All streams for fleet 1 (landings + age comp + length comp)
get_fit_stream(fit, module_id = 1)
} # }