Repository navigation
More fims plots joint residuals (depends on #473 being merged first) - #481
ericward-noaa wants to merge 9 commits into
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.
these tests were failing, should pass now
Residuals of the fit to each index over time, with three-sigma control limits and a runs test for non-random residuals (as in ss3diags/JABBA). Works on convert_output() output for SS3, BAM, and FIMS.
Residuals of all index fits over time, with a loess smoother and a fit statistic, as in JABBA (jbplot_residuals(), jbplot_stdresiduals()) and ss3diags (SSplotJABBAres()). - scaled: log residuals with RMSE, or standardized residuals with SDNR and its critical value (Francis 2011) - overlay: all indices on one panel with yearly boxplots, or one panel per index - show_stat: show or hide the RMSE/SDNR label - Reuses index_residuals() and the caption helpers from plot_runs_test() - Tests on all four example datasets and FIMS
|
Ready for review @sbreitbart-NOAA @Schiano-NOAA |
|
Will review this tomorrow! |
|
@ericward-noaa, thanks for adding these diagnostics. All of these plots are improvements over anything r4ss has ever provided, especially the overlaid residuals which I think will be really useful. One suggestion: I don't know if this is specific to the code in this PR or throughout stockplotr, but I wonder if we would be better specifying a white background by default rather than transparent. For purposes of the dark mode in github the transparency doesn't work well as shown in the screenshot below, but I don't know if there are use cases where transparency would be beneficial.
|
|
@iantaylor-NOAA I don't think this is a thing set by |
…more-fims-plots-joint-residuals This is bringing the runs-test changes into the joint-residuals, and updating the key quantities for the joint-residuals plots




What is the feature?
plot_runs_test() does residual plots for each index. The joint residual plot from JABBA (jbplot_residuals(), jbplot_stdresiduals()) and ss3diags (SSplotJABBAres()) does both:
This PR adds plot_joint_residuals(), which works on any convert_output() output (SS3, BAM, FIMS) and on the package’s example data.
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.