Run a retrospective analysis
View source ↗On this page
At the end of this page you have, for each model, Mohn's rho for biomass, spawning stock biomass, recruitment and abundance, a plot of the refitted series and the numerical checks of every refit. You need the input bundle x and the ALSCL fit b from Understand your first fit.
A retrospective analysis removes the last time step from the three tables, refits the model, removes one more, refits again, and so on; each refit is a peel. Comparing the peels with the full fit shows how much the recent estimates change when later observations are added; revisions in the same direction across peels indicate a retrospective pattern whose causes warrant investigation.
1. Run the analysis
ra <- retro_acl(x, nyear = 3, silent = TRUE)
rb <- retro_alscl(x, nyear = 3, silent = TRUE)
retro_acl() uses the ACL model and retro_alscl() the ALSCL model. Each call fits the model to the full tables, then runs nyear peels. Peel 1 drops the last time step and refits, peel 2 drops the last two, and so on. nyear is the number of peels. Each peel removes peel_step further time steps (default 1), so one peel of quarterly data removes one quarter; step 5 shows annual peels of a quarterly model.
Every fit uses the settings stored in the bundle, as run_acl(x) does, with the bundle's explicit nstarts starts or one start when it stores none; arguments in the call override them for every fit. ncores runs the full fit and the peels on worker processes; a fitting ncores stored in the bundle is ignored, and the starts inside one fit run one after another. With silent = FALSE the console prints one line per fit.
Two errors stop the call before any fit. The time columns of the survey index table must carry increasing numeric labels (Prepare your survey data), and every peel must keep at least two time steps, so nyear * peel_step is at most the number of time steps minus two. A peel that fails inside the optimizer is recorded in the next step's tables while the analysis continues. When the full fit and every peel stop with an error, the call stops and gives the message of the fits.
2. Read the returned tables
rb$fit_diagnostics
rb$rho_by_peel
rb$rho_text
rb$raw_rho_text
rb$errors
The result is a list of tables, and ra has the same elements as rb:
| Element | One row per | Contents |
|---|---|---|
fit_diagnostics |
fit | Peel (0 is the full fit), RetrospectiveYear (last time step kept), elapsed, the numerical checks with their summary numerical_ok and failed items issues, the message of a fit that stopped in error, and the warnings raised by the fit in warnings |
rho_by_peel |
peel and quantity | RawRho, the relative difference between the peel's terminal estimate and the full fit's estimate for that time step; Rho, the same when both fits passed the numerical checks and the reference is finite and nonzero, otherwise NA; Valid |
rho_text |
quantity | Mohn's rho, the mean of Rho over the peels, with Valid, ValidPeels and RequestedPeels; Year is only a label position |
raw_rho_text |
quantity | the mean of RawRho without the checks, for diagnosis only; NA when any comparison is missing |
errors |
failed fit | Peel, RetrospectiveYear and the message; zero rows when every fit ran |
The quantities are total biomass B, recruitment Rec, spawning stock biomass SSB and abundance N; the full series are in rb$results. rho_text$Rho is NA, with a warning, when the full fit or any peel failed the numerical checks or a terminal comparison is missing, so the reported mean uses only comparisons for which both fits passed the numerical checks. Find the failed fit in fit_diagnostics$issues and errors, repair it as on Judge whether a fit can be used and rerun; raw_rho_text only shows the size of the available differences.
3. Plot the refitted series
plot_retro(rb, rho_digits = 3)

plot_retro() draws the stored series without refitting, one panel per quantity ("Total biomass", "Recruitment", "Spawning stock biomass (SSB)" and "Total abundance", on a y axis named "Estimate") in two columns, the default layout for four panels. Each line is one fit, colored by its last time step. The full fit ends in 2019, the peels in 2018, 2017 and 2016. Under the default style the full fit is orange and drawn on top, the peels are greys, darkest for the first peel, and each panel leaves room for the Mohn's rho label above the lines. The legend is titled "Terminal year" for annual time steps and "Terminal period" for shorter ones, where quarters are labelled as in "2019 Q4", also when peel_step is above 1. A fit that failed the numerical checks is drawn with a dashed line under a second legend, "Numerical checks", and a fit without estimates stays in the legend marked "(no estimates)". The open point marks each fit's terminal estimate, the value that Mohn's rho compares with the full fit, and the panel label reads "Mohn's rho = " followed by the value with rho_digits decimals. The figures on this page add rho_size = 3, point_size = 1 and line_size = 0.6.

In both figures, the largest visible differences between the peeled and full fits occur near the end of the series. Compare the stored estimates to quantify revisions at other time steps. When Mohn's rho is NA the panel reads, for example, "Mohn's rho not available (2 of 3 peels valid); see the fit diagnostics"; if no fit produced estimates, plot_retro() stops and asks you to read fit_diagnostics and errors. Titles, labels, font sizes and the colors of the fits (palette, colors) follow Colors and export; every argument is in the plot_retro reference.
plot and silent must each be a single TRUE or FALSE; invalid values stop before any fitting. If no stored row has both a finite time and a finite estimate, plot_retro() stops with a diagnostic message. With some valid estimates, missing interior values stay as gaps rather than being joined across.
4. Interpret Mohn's rho
Mohn's rho averages, over the peels, the relative difference between the terminal estimate of each peel and the full fit's estimate for the same time step:
K is nyear and T the last time step of the full fit; peel k ends at T-k with the default peel_step = 1, and at T minus k times peel_step otherwise. A rho of +0.03 means that the terminal estimates from shorter fits were on average 3% above the corresponding full-fit estimates. A negative rho means they were lower on average. Terms of opposite sign cancel, so read rho_by_peel as well; a full-fit estimate of zero leaves its term undefined. Mohn's rho measures the revision of terminal estimates when later observations are added; forecast accuracy is the question of hindcast validation. Report the direction and magnitude of the revisions for each quantity.
5. Adapt the analysis to your assessment
rb2 <- retro_alscl(x, nyear = 3, nstarts = 2, ncores = 3, silent = TRUE)
rb2$fit_diagnostics
Run the analysis with the settings of the fit you report, so that differences between peels come from the removed observations only. Arguments in the call reach every fit. nstarts = 2 runs two starts per fit and keeps the lower objective, ncores = 3 runs the full fit and the three peels on three worker processes (at most nyear + 1 workers), and a map, parameters or control argument replaces the whole stored list (Choose the fitting settings). An optional model structure, start_spread, the ACL bounds, the ALSCL t0_lower and a survey catchability given as survey_q or survey_q_age, stored in the bundle or given in the call, also reach every fit. Five rules apply to your own bundle:
- Maps for
dev_log_Randdev_log_F, the process deviations of recruitment and fishing mortality, must cover the complete time grid of the full tables, all groups of one time step before the next (one group whenF_structure = "year"); each peel keeps the map entries of its retained time steps, and a map of another length stops the analysis. The restriction on fixed or repeated entries in Choose the fitting settings applies to every peel; a map that breaks it makes every fit fail, and the call stops with the reason. - A natural mortality rate by age and time step, and a survey catchability by length and time step, have one column per time step of the complete tables. Each peel uses the columns of the time steps that it keeps.
- Use the same F structure as the main fit. The stored
F_structureis used, and an explicit one in the call applies to every fit. - Keep at least two observed time steps in the shortest peel, and more when the series is short, because a short peel estimates the same parameters from fewer observations.
- Choose the length of a peel with
peel_step. With quarterly data the default removes one quarter per peel, andretro_alscl(x, nyear = 3, peel_step = 4)removes one year per peel, so that peelkendskyears before the last time step and Mohn's rho is a mean over annual peels.RetrospectiveYearshows the last time step kept.
6. Record the result
save_assessment(b, "ytf_alscl.rds")
saveRDS(rb, "ytf_alscl_retro.rds")
plot_retro(readRDS("ytf_alscl_retro.rds"), rho_digits = 3)
The retrospective result holds tables only, with no live TMB object, so saveRDS() keeps all of it and plot_retro() draws the reloaded object in a new session. save_assessment() is for fits. It stores b as a saved fit with its recipe for refit_model() and stops with A complete fit recipe is required when given the retrospective result. Keep the two files together; Reproduce results and fix problems shows how to record the package versions and the session.
What next
| What you want to do | Read |
|---|---|
| Work through the case | Do estimates change when recent data are removed? |
| Repair a failed peel | Judge whether a fit can be used |
| Change the map, F structure or starts | Choose the fitting settings |
| Test predictions of later time steps | Model validation |
| Run the peels on more cores | Speed settings |
| Change colors and labels | Colors and export |
| Read every argument | retro_model, retro_acl, retro_alscl, plot_retro |