How sensitive is the assessment, and what happens under future F?
View source ↗On this page
On this page you ask three questions of one fitted assessment, the synthetic YTF example: how much the estimates move when the fixed natural mortality or the F structure changes, how well the data determine an estimated parameter, and what deterministic future F scenarios imply. You need the package installed (Install ALSCL); the code runs in order from the fits of step 1 and takes a few minutes. At the end you have a scenario table and figure, a parameter profile and two projections, each with its numerical checks.
1. Fit the reference models
library(ALSCL)
library(ggplot2)
data("YTF_example")
x <- YTF_example
check_alscl_data(x, "acl")$summary
check_alscl_data(x, "alscl")$summary
a <- run_acl(x, silent = TRUE)
b <- run_alscl(x, silent = TRUE)
summary(a)
summary(b)
The ACL fit a serves the scenarios and the profile, because an ACL refit takes less than ten seconds; the ALSCL fit b serves the projections. summary() prints the time steps, the F structure, the numerical checks (they should read Numerical checks: passed) and the estimated and the fixed scalar parameters on the natural scale. YTF_example fixes growth, the length CVs, two process standard deviations and the recruitment correlation at teaching values, with M = 0.20 per annual time step and the default F_structure = "group_year"; your own bundle needs supported biology (Choose the fitting settings). If a check fails, repair the fit before any scenario (Judge whether a fit can be used).
2. Fit the sensitivity scenarios
scenarios <- fit_scenarios(x, list(
reference = list(),
low_M = list(M = 0.15),
shared_F = list(F_structure = "year")
), model = "acl", ncores = 1, nstarts = 1,
F_summary = "mean", silent = TRUE)
scenarios$status
head(scenarios$estimates)
scenario_ssb <- subset(scenarios$estimates, quantity == "SSB")
ggplot(scenario_ssb, aes(year, estimate, color = scenario)) +
geom_line() +
labs(x = "Year", y = "Spawning stock biomass (SSB)", color = "Scenario") +
scale_colour_manual(values = acl_palette(3), labels = c(reference = "Reference",
low_M = "Natural mortality rate 0.15 per year",
shared_F = "Fishing mortality by year only")) +
expand_limits(y = 0) + theme_acl(quantity = "stock")
fit_scenarios() refits the same three tables under named changes of the inputs the model takes as given. Each scenario is a list of arguments that replace the settings of x, an empty list is the reference, and a list such as map replaces the stored list completely. low_M lowers natural mortality from 0.20 to 0.15 per time step; shared_F sets F_structure = "year", one F per time step shared by all ages (one per quarter for quarterly data), leaving the correlation across ages inactive. ncores runs scenarios on separate workers, each fit with one worker and the bundle's or the call's nstarts (one start when neither sets it); F_summary = "mean" averages F over the ages of each time step and "apical" takes the maximum. Read scenarios$status first. It has one row per scenario with time taken, warnings, errors and the numerical checks. A scenario that failed the checks stays in scenarios$estimates with numerical_ok = FALSE, and one that stopped with an error has no estimates. theme_acl() gives the figure the look of the package plots, and acl_palette() gives their colors.

In the recorded run all three fits passed (scenario-status.csv), and at the last time step, 2019 (scenario-estimates.csv):
| Scenario | Spawning stock biomass (SSB), 2019 | Mean F per time step |
|---|---|---|
reference |
75.5 | 0.320 |
low_M |
75.4 | 0.371 |
shared_F |
74.1 | 0.335 |
Lowering M by 0.05 raises mean F in 2019 by 0.051, so the total mortality rate F + M stays at 0.52. A fit to survey data alone estimates total mortality, and the fixed M decides how much of it is F (Model principles). Terminal SSB hardly moves and the three curves nearly coincide, because the survey index and the fixed survey catchability set the abundance scale; with your own data the spread between the curves is the sensitivity to report.
3. Profile an estimated parameter
profile_values <- exp(a$opt$par[["mean_log_F"]]) * c(0.9, 1, 1.1)
profile_F <- profile_model(a, "mean_log_F", profile_values,
scale = "natural", ncores = 1)
profile_F$grid
ggplot(profile_F$grid, aes(value, delta_nll)) +
geom_line(colour = acl_palette(role = "primary")) +
geom_point(colour = acl_palette(role = "primary")) +
labs(x = "Median fishing mortality rate (per year)",
y = "Change in negative log likelihood") +
theme_acl()
profile_model() fixes one estimated scalar parameter at each grid value and refits the other scalar parameters and the process deviations; the name must be in names(a$opt$par), so log_Linf, fixed in YTF_example, stops with an error, while mean_log_F is estimated. With scale = "natural" the grid is on the natural scale, here 0.9, 1 and 1.1 times the fitted median fishing mortality rate exp(mean_log_F), and must lie within the optimizer bounds. profile_F$grid gives each value with its objective, delta_nll (the rise in negative log likelihood relative to the original fit) and the numerical checks of that refit; failed points stay visible. Negative delta_nll values are retained; a value below -10⁻⁶ triggers a warning about a lower objective. Check that grid fit's numerical status and rerun the original with more starts. Tiny negative differences can reflect roundoff. Fixed inputs such as M and survey catchability belong in step 2.

In the recorded run (profile-F.csv) the three points 0.278, 0.309 and 0.340 gave changes of 0.43, about 0 (-5 × 10⁻¹², rounding) and 0.35, all passing the checks. A 10% change of the median F costs about 0.4 units. Three points show the method; a profile for a report needs a denser grid, and the function infers no confidence interval from it.
4. Project future F scenarios
h <- 4L
w <- as.matrix(x$data.wgt[-1L])
mat <- as.matrix(x$data.mat[-1L])
future_w <- matrix(w[, ncol(w)], nrow(w), h)
future_mat <- matrix(mat[, ncol(mat)], nrow(mat), h)
future_rec <- rep(tail(b$report$Rec, 1), h)
low_F <- project_model(b, F = rep(0.10, h), recruitment = future_rec,
weight = future_w, maturity = future_mat)
higher_F <- project_model(b, F = rep(0.25, h), recruitment = future_rec,
weight = future_w, maturity = future_mat)
low_F$summary
higher_F$summary
low_F$assumptions
projection_ssb <- rbind(
transform(low_F$summary, scenario = "0.10"),
transform(higher_F$summary, scenario = "0.25"))
ggplot(projection_ssb, aes(year, SSB, color = scenario)) +
geom_line() + geom_point() + labs(x = "Year",
y = "Spawning stock biomass (SSB)",
color = "Future fishing mortality rate (per year)") +
scale_colour_manual(values = acl_palette(2)) +
expand_limits(y = 0) + theme_acl(quantity = "stock")
project_model() advances the last fitted population through future time steps under values you supply: F (one value per step shared by all groups, or a group by step matrix), recruitment (its length sets the horizon), and complete weight and maturity matrices with one column per future step; M stays at the fitted value unless you pass another. Nothing is carried forward for you. The code repeats the last observed weight and maturity columns and the last fitted recruitment for four steps, a choice to state in the report. Each row of summary describes the start of a time step. The first future state is the last fitted population survived through the last fitted F and M plus the first supplied recruitment, and a future F[t] sets the catch of step t and the survival into step t + 1, so the two scenarios share the first future SSB and separate from the second step on, though their first catches differ. The projection is deterministic and conditional on the fit, without intervals, a stock-recruitment relationship or reference points; low_F$assumptions records every choice. A fit that failed the numerical checks is refused unless allow_failed_fit = TRUE, which records the override.

In the recorded run (projections.csv) both scenarios start at an SSB of 66.1 in 2020; in 2023 it is 114 under F = 0.10 and 73.0 under F = 0.25, in the units implied by the example's weights and conditional on the held recruitment and biology.
What next
| What you want to do | Read |
|---|---|
| Save the scenario, profile and projection record with the fit | Assessment workflows |
| Examine residual patterns before trusting a projection | Judge whether a fit can be used |
| Refit after removing recent time steps | Do estimates change when recent data are removed? |
| Simulate from the fit and score predictions of withheld time steps | Can the fitted model reproduce observations and predict withheld time steps? |