Do ACL and ALSCL give different answers?
View source ↗On this page
On this page you fit ACL and ALSCL to the same synthetic YTF observations and see where the two population structures agree and where they differ. You need the package installed (Install ALSCL); YTF_example supplies the tables, the biology and the fixed parameters of both models, so the comparison is conditional on those teaching values. At the end you have comparison tables, four figures and a saved folder.
1. Fit both models to the same observations
library(ALSCL)
data("YTF_example")
x <- YTF_example
inputs <- x[c("data.CatL", "data.wgt", "data.mat")]
a <- run_acl(x, train_times = 2, silent = TRUE)
b <- run_alscl(x, train_times = 2, silent = TRUE)
Both fits read the input bundle x, so they share the tables, M, survey catchability and time grid, and each model takes its starting values and map from x$fit_config; the fixed growth and process values contribute no uncertainty to the intervals. Use the same tables and biological inputs, and document each model's map, fixed values, bounds and numerical checks. YTF_example was generated by the age-based flatfish operating model, which assigns lengths to ages with a von Bertalanffy curve and a CV of length at age, as ACL does, at the values that both fits fix. ALSCL grows fish by length increments instead, so on these data the growth structure of ACL matches that of the operating model and that of ALSCL does not.
2. Check both fits and compare the fit statistics
diagnose_model(x$data.CatL, a)
diagnose_model(x$data.CatL, b)
comparison <- compare_models(a, b, x$data.CatL)
comparison$summary
comparison$fit_diagnostics
comparison$comparison
plot_compare_residuals(a, b, x$data.CatL)
Read the numerical checks first (Understand your first fit). compare_models() verifies that both fits used the same survey table, then compares the objective, AIC, BIC and the fit statistics in fit_metrics. comparison$comparison records data_verified, eligible (both fits passed the checks), preferred (the model with the lower AIC, given only when both are eligible and the AIC values differ by at least 2) and issues. In the recorded run (comparison_summary.csv) both fits passed; ACL had the lower AIC and, in the fit statistics (comparison_fit_metrics.csv), the smaller survey-index RMSE, 2.5 against 4.4. A lower AIC is statistical support on these data; whether the structure suits the stock is a biological decision.

The four panels show the distribution of the log residuals, a normal quantile-quantile plot, the mean log residual by time step with error bars of one standard deviation on each side, and the absolute log residual by length bin; Judge whether a fit can be used explains the patterns.
3. Compare the fit to the survey observations
plot_compare_CatL(a, b, x$data.CatL, years = c(2000, 2005, 2010, 2015))

Points are the observations and curves the fitted medians in the four selected years. Compare the fitted shapes, in particular in the larger length bins with low survey indices, before reading differences in abundance.
4. Compare the population estimates
plot_compare_ts(a, b, se = TRUE)
comparison$correlation
comparison$length_at_age
comparison$growth

Compare the timing, trends and magnitudes of the point estimates, then inspect their uncertainty; se = TRUE adds each fit's approximate intervals. Overlap alone does not show that point estimates are close, because wide intervals can overlap despite large differences. For a quantitative comparison, report differences or ratios at matching times. Inference about those differences requires their joint uncertainty because the fits use the same data. This example describes one dataset.
comparison$correlation (recorded run: comparison_correlation.csv) gives the correlation between the two fits and the ratio of their means for spawning stock biomass (SSB), recruitment, biomass and abundance. Catch is compared as relative catch (rows CN (relative) and CB (relative), without a ratio), because a fit to a survey index does not determine the level of catch. Compare growth through comparison$length_at_age, the mean length at age of both fits. comparison$growth (recorded run: comparison_growth.csv) lists Linf, k and t0 in a separate block for each model, because they are the parameters of a von Bertalanffy curve of mean length at age in ACL and set the growth increment at length in ALSCL (Judge whether a fit can be used).
5. Compare fishing mortality
plot_compare_F(a, b)

ACL estimates fishing mortality by age and ALSCL by length, so the panels' cells match only in time. plot_compare_F_ts() summarizes the groups of each time step by their maximum (method = "apical", the default) or mean; quarterly values stay per quarter.
6. Save the comparison for review
dir.create("my_model_comparison", showWarnings = FALSE)
write.csv(comparison$summary, "my_model_comparison/summary.csv", row.names = FALSE)
write.csv(comparison$fit_metrics, "my_model_comparison/fit_metrics.csv", row.names = FALSE)
write.csv(comparison$fit_diagnostics, "my_model_comparison/fit_diagnostics.csv", row.names = FALSE)
p_population <- plot_compare_ts(a, b, quantities = c("B", "SSB", "Rec"), se = TRUE)
acl_save_plot(p_population, "my_model_comparison/population.png")
saveRDS(list(inputs = inputs, fit_args = x$fit_args, fit_config = x$fit_config,
comparison = comparison, ACL_report = a$report, ALSCL_report = b$report),
"my_model_comparison/summary.rds")
writeLines(capture.output(sessionInfo()), "my_model_comparison/session.txt")
acl_save_plot() saves a package plot at 300 dpi in the size that acl_figure_size() recommends for its layout. The folder holds the CSV tables, the population figure, an RDS with the inputs, settings, comparison and both reports, and the session information. Report with it the time window, fixed biology, zero treatment and sensitivity to the fixed values.
What next
| What you want to do | Read |
|---|---|
| Draw the other comparison figures | Model comparisons |
| Examine the residual patterns of one fit | Judge whether a fit can be used |
| Remove recent time steps and refit | Do estimates change when recent data are removed? |
| Test the sensitivity to M and the F structure | How sensitive is an assessment, and what happens under future F scenarios? |
| Fit both models to your own tables | How do I fit my own survey data? |