Repository navigation
[feat]: Adds index intervals, follows PR #465 - #468
Merged
Schiano-NOAA merged 10 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).
9 tasks done
Make default interval 0.95 per @iantaylor-NOAA
Contributor
Author
|
@sbreitbart-NOAA @Schiano-NOAA This is ready for review |
This was referenced Nov 8, 2026
Schiano-NOAA
left a comment
Collaborator
There was a problem hiding this comment.
This looks good. Just one question to address and I will merge.
Fixed and better documented 3 logic pathways
Contributor
Author
|
@Schiano-NOAA Thanks for the suggestions, all incorporated here: ac9b513 |
Collaborator
|
A1! Thanks so much |
Schiano-NOAA
added a commit
that referenced
this pull request
Nov 13, 2026
* [feat]: convert FIMS output to the standard format in `convert_output()` 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. * Update WORDLIST * [feat]: observation-error intervals and log scale in `plot_index()` 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). * [feat]: plot all indices relative to their means with `plot_index(relative = 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. * Update plot_index.R make sure this is consistent with other outstanding PR * Update plot_index.Rd redoc * Bring same files over to update per commit # 467 * update per changing defaults * Update R/plot_index.R Co-authored-by: Sam (Schiano) Bredeck <125507018+Schiano-NOAA@users.noreply.github.com> * devtools::doc --------- Co-authored-by: Sam (Schiano) Bredeck <125507018+Schiano-NOAA@users.noreply.github.com>
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?
Adding
intervalargument to plot_index#' plot_index(
#' dat = stockplotr::example_data,
#' interval = 0.95,
#' log = TRUE,
#' interactive = FALSE
#' )
Follows #465
How have you implemented the solution?
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.