retro_alscl()
View source ↗On this page
Run a retrospective analysis of an ALSCL fit; a short form of retro_model(model_type = "alscl").
Usage
retro_alscl(
nyear = 5,
data.CatL,
data.wgt,
data.mat,
rec.age,
nage,
M,
sel_L50,
sel_L95,
growth_step = NULL,
...
)
Arguments
| Argument | Default | Description |
|---|---|---|
nyear | 5 | Integer. Number of retrospective peels. Default 5. The number of time steps that each peel removes follows the peel_step argument of |
data.CatL | required | Survey index table (length labels followed by one column per time step), or the input bundle used by |
data.wgt | required | Weight table, with the same length bins and time steps as the survey index table. |
data.mat | required | Maturity table, with values between 0 and 1 and the same length bins and time steps as the survey index table. |
rec.age | required | Recruitment age in years. |
nage | required | Number of age classes. The last class holds the fish of its starting age and older. |
M | required | Natural mortality rate per model time step; see |
sel_L50 | required | Length at 50 percent survey catchability. |
sel_L95 | required | Length at 95 percent survey catchability, greater than sel_L50. |
growth_step | NULL | Length of a time step in years (0.25 for quarterly data). NULL uses rec.age when it is below 1, otherwise 1, as in |
... | … | Other arguments of |
Value
The list that retro_model() returns, with results, last_points, rho_by_peel, rho_text, raw_rho_text, fit_diagnostics, errors, model_type, workers, nstarts, peel_step and, with plot = TRUE, plot; retro_model() describes each element.
Details
retro_alscl() calls retro_model() with model_type = "alscl". It takes the input bundle of the fitting functions, as in retro_alscl(x, nyear = 3), and passes the arguments of retro_model() that are not listed here, such as peel_step, nstarts, silent or F_structure, through .... retro_model() describes how the peels are made, the numerical checks behind Mohn's rho, the records in fit_diagnostics and the restrictions on map.
When the full fit and every peel stop with an error, the call stops with an error that quotes their messages; when at least one fit returns, the result is returned with the failures recorded in fit_diagnostics and errors. rho_text$Rho gives a value only when the full fit and every peel pass the numerical checks.
Examples
Run the setup before the example. Fitting examples require an R-compatible C++ toolchain; simulation and export examples may write files.
Example setup
library(ALSCL)
library(ggplot2)
library(patchwork)
data("YTF_example")
x <- YTF_example
inputs <- x[c("data.CatL", "data.wgt", "data.mat")]
dat <- x$data.CatL
a <- run_acl(x, silent = TRUE)
b <- run_alscl(x, silent = TRUE)
# Use objects defined above
rb <- retro_alscl(x, nyear = 3)
rb$fit_diagnostics
rb$rho_text

plot_retro(retro_alscl(x, nyear = 3))