Repository navigation
[feat]: Add relative option to plot_index, follows #468 - #469
Merged
Schiano-NOAA merged 14 commits intoNov 13, 2026
Merged
Conversation
convert_output() passed FIMS output through unchanged, so `estimate` and `year` were empty and no stockplotr plot could use it. The new conout_fims() reshapes `FIMS::get_estimates()` output (or a FIMSFit object, or an .rds file with either): - Each data point (index, landings, age and length compositions) is split into "*_observed" and "*_predicted" rows, with the observation error and negative log-likelihood on the observed row, as for SS - `estimated` becomes `estimate`, and the new `start_year` argument converts FIMS year indices to years; `era` is "time", or "fore" after the last year of data. - fims_var_names.csv maps current FIMS labels (e.g., expected_recruitment, numbers_at_age, log_devs) to the standard labels. Also fixes: - convert_output() ignored a user-supplied `model` when `file` is an object. - plot_index() matched every label containing "index" (e.g., index_log_q in Rceattle output or index numbers at age in FIMS output); it now plots only index_observed and index_predicted. - plot_index() failed for a single index fleet, because the fleet facet was added back after process_data() dropped the column.
plot_index() adds `interval`, which draws intervals around the observed index from its observation error, and `log`, which plots the index on a log scale. Intervals assume lognormal errors, as in Stock Synthesis, FIMS, BAM, and Rceattle: uncertainty labeled "se", "sd", or "log_sd" is used as the log-scale standard error, and a CV is converted with sqrt(log(1 + CV^2)). Both default to the current behavior (no intervals, linear scale).
…ative = TRUE)` `relative = TRUE` divides each fleet's observed and predicted index (and intervals) by the mean of its observed index and plots all fleets on one panel, colored by fleet, so that trends can be compared among indices (r4ss SSplotIndices subplot 9). Facet variables with one value for each fleet (e.g., the month of each survey) do not split the panel. `relative = TRUE` divides each fleet's observed and predicted index (and intervals) by the mean of its observed index and plots all fleets on one panel, colored by fleet, so that trends can be compared among indices (r4ss SSplotIndices subplot 9). Facet variables with one value for each fleet (e.g., the month of each survey) do not split the panel.
make sure this is consistent with other outstanding PR
redoc
…ricward-noaa/stockplotr into more-fims-plots-index-relative
Contributor
Author
|
@sbreitbart-NOAA @Schiano-NOAA this is ready for review |
This was referenced Nov 7, 2026
Schiano-NOAA
self-requested a review
November 10, 2026 15:55
| #' Options: May include, but is not limited to: "fleet", "year", "area", NULL | ||
| #' @param unit_label String. Index of abundance/CPUE units | ||
| #' | ||
| #' Default: "" |
Collaborator
There was a problem hiding this comment.
I think the same adjustments apply here. I think it is recognizing this as a new change since I am assuming this branch was made from the last. Sorry for the duplicate work!
Schiano-NOAA
left a comment
Collaborator
There was a problem hiding this comment.
LGTM! Just needs the same change the other PR did with the units because they aren't set to "" by default but otherwise good.
Co-authored-by: Sam (Schiano) Bredeck <125507018+Schiano-NOAA@users.noreply.github.com>
Contributor
Author
|
@Schiano-NOAA Good catch, changed here |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What is the feature?
How have you implemented the solution?
#' @PARAM relative Logical. TRUE/FALSE; divide each fleet's observed and
#' predicted index (and intervals) by the mean of its observed index, and plot
#' all fleets on one panel, colored by fleet. Indices with conflicting trends
#' (data conflicts) are a common cause of poor fits and are easiest to see
#' this way (
r4ss::SSplotIndices()subplot 9). Anygroupother than#' "fleet" is added to
facet.Does the PR impact any other area of the project, maybe another repo?
PR contribution checklist
Thank you for contributing to stockplotr! Please check the boxes below to confirm this pull request (PR) is ready for review. Edit this PR description to add the release indicator and any explanations.