Choose the fitting settings
View source ↗On this page
On this page you decide which parameters the models estimate, which are fixed, how fishing mortality is structured, and how the optimizer runs. You need an input bundle x (Prepare your survey data) and you should have read Understand your first fit, whose checks tell you whether a setting needs changing.
The settings fall into three groups: the biology and data settings in x$fit_args, which Prepare your survey data explains; the model configuration (starting values, bounds, map, F structure and optional model structures), chosen separately for ACL and ALSCL; and the optimizer settings (starts, workers, passes), which change how the answer is found and leave the model unchanged.
1. Know the settings and where they live
| Setting | Meaning | Where to put it |
|---|---|---|
rec.age, nage, M, sel_L50 and sel_L95 or survey_q, survey_q_age, growth_step, len_mid, len_border |
Biology, survey catchability and time step. M is a single number, a matrix by age class and time step or, for ALSCL, a vector by length bin. survey_q supplies survey catchability at length directly, and survey_q_age is a multiplier by age class (Prepare your survey data) |
x$fit_args, shared by both models |
zero_action |
Treat survey zeros as missing ("missing", default) or stop ("error") |
x$fit_args |
parameters, parameters.L, parameters.U |
Starting values and bounds of the scalar parameters, on the optimizer scale | x$fit_config$acl or x$fit_config$alscl |
map |
Which parameters are fixed at their starting value and which default fixes are released | x$fit_config$acl or x$fit_config$alscl |
F_structure |
"group_year" (default): F varies by age or length and by time step; "year": one F per time step |
x$fit_args or the call |
structure |
Optional model structures, including the range of the AR(1) correlations; the default is the original structure (step 6) | x$fit_config$acl or x$fit_config$alscl, or the call |
t0_lower |
Lower limit of the ALSCL growth parameter t0 in years (default 0); a negative value allows a negative t0 |
x$fit_config$alscl or the call to run_alscl() |
bounds |
"default", or "wide" to give ACL the bounds of ALSCL for five parameters (step 4) |
x$fit_config$acl or the call to run_acl() |
nstarts, ncores |
Number of independent optimizer starts and of worker processes running them | The call |
start_spread |
Spread of the second and later starts around the first (default 0.15) | The call |
train_times |
Successive optimizer passes from each start (default 1) | The call |
polish |
Finish the best start with checked Newton steps (default TRUE) |
The call |
control |
nlminb() controls such as iter.max |
The call |
silent, output |
Hide progress messages; write diagnostics and plots to output/ |
The call |
Values in the call override the stored ones for that call only. A parameters list in the call replaces the stored list, and the fit names the stored values that are no longer used. Store a choice in x when every later analysis (retrospectives, scenarios, hindcast validation) should use it; step 8 shows how.
2. See which parameters are estimated
plan <- inspect_parameters(x, "acl")
plan[, c("parameter", "kind", "status", "map_source", "natural_start")]
inspect_parameters(x, "alscl")[, c("parameter", "status", "natural_start")]
inspect_parameters() lists the scalar parameters and process-deviation blocks of the chosen model, with their starting values and status, including free (estimated), fixed or tied. map_source tells whether a fixed status comes from the model default or from your map. Run it after every change below; it compiles and fits nothing.
| Meaning | ACL parameter | ALSCL parameter |
|---|---|---|
| Growth (von Bertalanffy) | log_Linf, log_vbk, t0 |
log_Linf, log_vbk, log_t0 |
| Spread of length at age; growth increment CV | log_cv_len |
log_cv_len, log_cv_grow |
| Mean of log recruitment and of log F | mean_log_R, mean_log_F |
mean_log_R, mean_log_F |
| Standard deviations of the process deviations | log_std_log_R, log_std_log_F, log_std_log_N0 |
log_sigma_log_R, log_sigma_log_F, log_sigma_log_N0 |
| Correlation of F across time; across ages or lengths | logit_log_F_y, logit_log_F_a |
logit_log_F_y, logit_log_F_l |
| Correlation of recruitment across time | logit_log_R |
logit_log_R |
| Initial total mortality; survey observation SD | log_init_Z, log_std_index |
log_init_Z, log_sigma_index |
By default ACL fixes log_std_log_F, logit_log_F_y, logit_log_F_a and t0, and ALSCL fixes log_sigma_log_F and log_t0; everything else is estimated. So that its teaching configuration runs quickly, YTF_example also fixes the growth parameters (log_Linf, log_vbk, t0 or log_t0, log_cv_len and, for ALSCL, log_cv_grow), the standard deviation of the F deviations (0.302, the marginal SD F_sd / sqrt(1 - F_ar^2) of the AR(1) process that generated the data), the standard deviation of the initial-numbers deviations, and every AR(1) correlation (logit_log_R, logit_log_F_y, and logit_log_F_a or logit_log_F_l). Each model then estimates five scalar parameters: log_init_Z, mean_log_R, mean_log_F, the recruitment SD and the survey observation SD. The intervals of the example are conditional on all of these fixed values. Your own bundle starts from the defaults. The process deviations dev_log_R, dev_log_F and dev_log_N0 are created from the data dimensions and estimated as random effects; step 3 explains why their map entries should stay at the default. The n_free, n_fixed and n_tied columns show how many entries of each block are estimated.
3. Fix or release parameters with map
# Fix growth at the starting values and estimate the F correlation across time
my_map <- list(log_Linf = factor(NA), log_vbk = factor(NA), logit_log_F_y = NULL)
a_map <- run_acl(x, map = my_map, silent = TRUE)
extract_parameters(a_map)
# Keep the choice in the bundle for later analyses
x$fit_config$acl$map <- my_map
factor(NA) fixes a parameter at its starting value; a named NULL releases a parameter that the model fixes by default. A map given in the call or stored in x$fit_config replaces the stored map completely, so list every fix you want each time. Investigate a non-positive-definite Hessian or a correlation near a boundary by checking gradients, parameter scales, bounds, additional starts and profiles. Fix a parameter when these checks support doing so and an external estimate or biological assumption provides a defensible value; record that basis with the assessment. generate_map() merges a list with the ACL defaults but drops NULL entries, so pass release lists directly as map. The assignment creates x$fit_config$acl when the bundle has no stored configuration. A model without an entry in x$fit_config uses the shared x$fit_args and the model defaults, so a bundle that stores a configuration for ACL only can still be fitted with ALSCL.
Leave the process-deviation blocks dev_log_R, dev_log_F and dev_log_N0 out of map. The models evaluate the process likelihood for every entry of a block. Fixing entries with NA, or giving several entries the same factor level, therefore does not give the likelihood of a model with fewer deviations. Such a map is rejected unless the standard deviation and the AR(1) correlations of that process are fixed as well, because their estimates would otherwise be biased. Even then the objective is not comparable with that of fits that use another map for these deviations, so do not compare it by AIC; the fit lists the blocks concerned in restricted_random. To let all ages or lengths share one fishing mortality rate in each time step, use F_structure = "year" (step 5), which has its own one-dimensional AR(1) likelihood. simulate_fit(process = "resample") requires unrestricted process deviations, and hindcast_model() requires unrestricted dev_log_R and dev_log_F. See Simulate and validate a fitted model.
For a named NULL release, copy the exact parameter name from inspect_parameters(x, model). An unknown name stops the fit. When you subset a map factor, unused levels are discarded and the remaining entries keep their fixed or estimated status.
Estimate the standard deviation of the F process
a_fixed <- run_acl(YTF_example, silent = TRUE)
cfg <- YTF_example$fit_config$acl
cfg$map["log_std_log_F"] <- list(NULL) # a named NULL releases the default fix
a_free <- run_acl(YTF_example, map = cfg$map, silent = TRUE)
subset(extract_parameters(a_free), parameter == "log_std_log_F")
c(fixed = a_fixed$opt$objective, estimated = a_free$opt$objective)
range(a_free$report$SSB / a_fixed$report$SSB)
Both models fix the standard deviation of the F process at its starting value by default (log_std_log_F in ACL and log_sigma_log_F in ALSCL). The paper that introduced ALSCL estimates this parameter (Model principles), so refit with the standard deviation estimated as a check of every assessment. A named NULL in map releases a default fix. Write it with single brackets as in the block, because cfg$map$log_std_log_F <- NULL deletes the entry and the default fix then applies again. The value is a marginal standard deviation (Model principles).
In this example the estimate is 0.24 with a standard error of 0.04, against the fixed value of 0.302. The objective falls by 1.0, and spawning stock biomass (SSB) changes by less than 1% in every year. Report both fits when they differ more than this. When the refit fails the numerical checks, for example because the standard deviation is estimated at zero, keep the fixed value and report that the data did not determine it.
4. Set starting values and bounds
p <- create_parameters(model_type = "acl", species = "flatfish")
p$parameters$log_Linf <- log(65)
p$parameters.U$log_Linf <- log(90)
x$fit_config$acl$parameters <- p$parameters
x$fit_config$acl$parameters.U <- p$parameters.U
inspect_parameters(x, "acl")[, c("parameter", "natural_start", "lower", "upper")]
# Upper bounds of ACL with bounds = "wide", on the natural scale
wide <- create_parameters(model_type = "acl", bounds = "wide")
exp(unlist(wide$parameters.U[c("log_init_Z", "mean_log_F", "log_std_log_N0",
"log_std_log_R", "log_vbk")]))
Starting values and bounds are entered on the optimizer scale, for example log_Linf = log(65) for an asymptotic length of 65 cm, logit_log_R = qlogis(0.5) for a correlation of 0.5 (with the default range of the correlations; step 6 gives the value for correlations between -1 and 1). create_parameters() returns complete lists of starts (parameters), lower bounds (parameters.L) and upper bounds (parameters.U) for a species preset ("flatfish", "tuna", "krill" or none); change the entries you have information about; Estimation parameter lists gives the full list with transformations. The presets are starting configurations taken from simulation operating models, not validated settings for a stock. The "tuna" preset, for example, is the tuna-like operating model M6 of the simulation study, with 20 quarterly age classes with a plus group at 5 years, an asymptotic length of 152 cm and constant natural mortality.
ACL uses t0 directly, while ALSCL uses log_t0 with t0 = t0_lower + exp(log_t0), so with the default t0_lower = 0 an ALSCL t0 must lie between 0 and rec.age; step 6 shows how to allow a negative t0. A starting value outside its bounds is moved to the nearest bound before fitting, with a warning when you supplied the start and with a message for a default start; the fit lists these values in clamped_starts.
The ACL defaults for Linf (start 60, bounds 10 to 100) are in the length units of the yellowtail flounder example. When they do not suit your length bins, for example tuna lengths in cm, run_acl() sets the start and bounds that you did not supply from the data. The start is 1.1 times the length below which 99 percent of the summed survey index lies. The upper bound is 2 times the largest length-bin midpoint. The lower bound is the smaller of the default (10) and half of that 99 percent length, so that length bins extending beyond the largest fish do not exclude the true Linf. run_alscl() always sets the values you did not supply from the data. The start is 1.1 times the largest length-bin midpoint and the bounds are 0.7 and 2 times that midpoint, so supply parameters.L$log_Linf when the bins extend well beyond the largest fish.
Without a species preset, the default upper bounds of ACL are lower than those of ALSCL for five parameters: the initial total mortality rate (1 against 10 per time step), the median fishing mortality rate (1 against 2 per time step), the standard deviations of the initial numbers at age and of recruitment on the log scale (1 against 10), and the growth rate k (0.1 to 1 against 0.05 to 2 per year). The ACL values suit the yellowtail flounder example, and ACL fits to other stocks often stop at them. run_acl(x, bounds = "wide") gives ACL the ALSCL bounds of these five parameters; the last lines of the block print the wide upper bounds, 10, 2, 10, 10 and 2. The default bounds are unchanged, so existing fits are reproduced. A fit that stops at a bound fails the numerical checks, and when the bound is one of these five, diagnostics$advice and the message of the fit name this argument. Entries of parameters.L and parameters.U replace the bounds of either choice. With a species preset, ACL and ALSCL have the same bounds for these parameters and bounds changes nothing. run_alscl() has no such argument.
5. Choose the F structure
With the default F_structure = "group_year", fishing mortality has one value for every age (ACL) or length bin (ALSCL) in every time step, with deviations correlated across time and across ages or lengths. With F_structure = "year", all ages or lengths share one F in each time step, which is one value per quarter for quarterly data. Consider "year" when equal F across groups is a defensible assumption or diagnostics suggest that the data provide little information about group-specific variation. A group correlation near 1 or a non-positive-definite Hessian warrants investigation, but neither alone selects the F structure. Compare the fits, residuals and sensitivity under both structures.
a_year <- run_acl(x, F_structure = "year", silent = TRUE)
diagnose_model(x$data.CatL, a_year)
plot_fishing_mortality(a_year, se = TRUE)
plot_deviance(a_year, type = "F", se = TRUE)
With "year" the correlation across groups (logit_log_F_a or logit_log_F_l) is unused and left out of the fit, report$dev_log_F has one row, and report$F keeps its age (or length) by time shape with identical rows. Use the same structure in every later analysis of the same bundle, including retrospectives.
6. Choose an optional model structure
b_structure <- run_alscl(x, structure = "von_bertalanffy", silent = TRUE)
b_structure$structure
b_structure$growth_check$stalled
a_structure <- run_acl(x, structure = list(initial_plus_group = "equilibrium"),
silent = TRUE)
a_structure$structure
The structure argument selects optional model structures. The default, an empty list, is the original structure, which implements the model of Zhang and Cadigan (2022). Two details of the original growth increment are in the code and not in the paper. The paper defines the logistic function of the table below but gives neither the lengths at which the increment is 50% and 95% of its maximum (the code uses 0.5 Linf and 0.05 Linf) nor the conversion of the increment to a time step shorter than one year (the code multiplies it by growth_step). structure = "von_bertalanffy" selects the first four settings of the table together, so that the first time step and the growth transition follow one growth model; structure = "original" is the default structure. A named list selects single settings, and a list can name a set and add settings to it, for example list(set = "von_bertalanffy", correlation_range = "symmetric"). "published" and "consistent" are accepted as other names for "original" and "von_bertalanffy". ACL has the first and the last two settings of the table; ALSCL has all six.
| Setting | Original structure (default) | Optional structure |
|---|---|---|
initial_plus_group (ACL and ALSCL) |
"single_cohort": the plus group of the first time step holds one cohort |
"equilibrium": it holds the sum of all older cohorts at the initial total mortality rate init_Z |
initial_length (ALSCL) |
"length_at_age": in the first time step every age has the length-at-age distribution with coefficient of variation cv_len |
"growth": the first age has that distribution, and each older age is the previous age after survival at init_Z and one growth step, as in all later time steps |
growth_increment (ALSCL) |
"logistic": the expected growth increment is a decreasing logistic function of length, multiplied by growth_step |
"von_bertalanffy": the expected increment over one time step is (Linf - L) * (1 - exp(-vbk * growth_step)) for a length L below Linf and declines smoothly to zero above Linf, so Linf and vbk have the same meaning as in the length-at-age curve. Fish then stop growing at about Linf, so Linf acts as an upper limit of length after the first time step. Data with many fish larger than the mean asymptotic length fit poorly, and the standard error of Linf can be very small. The logistic increment stays positive above Linf |
growth_transition (ALSCL) |
"midpoint": every fish in a length bin grows from the bin midpoint |
"bin": starting lengths are uniform within the bin and the transition is integrated over the bin, so fish keep moving to the next bin when the growth increment per time step is small relative to the bin width |
correlation_range (ACL and ALSCL) |
"positive": the AR(1) correlations of recruitment and of F lie between 0 and 1, as the logistic transform of the logit_* parameters |
"symmetric": they lie between -1 and 1, as 2 times the logistic transform minus 1, so a correlation of zero is an interior value and a negative correlation can be estimated |
initial_deviations (ACL and ALSCL) |
"cumulative": the log numbers of each age class in the first time step are those of the previous age class minus init_Z plus a deviation, so the deviations accumulate over age classes (nage - 1 deviations) |
"independent": Equation 11 of Zhang and Cadigan (2022). The log numbers of each age class are the log recruitment of the first time step minus init_Z times the number of age classes before it, plus a deviation of its own; the first age class also has one (nage deviations) |
Two pairs of settings give a property that the original structure does not have. With initial_length = "growth" and initial_plus_group = "equilibrium", a population with constant recruitment, no fishing and init_Z equal to M stays constant over time. With growth_increment = "von_bertalanffy" and growth_transition = "bin", the mean length of a cohort follows the von Bertalanffy curve closely when the length bins are a few times wider than the growth increment per time step. With much wider bins it remains approximate, because fish are spread evenly over their bin after every time step. Under the original structure the mean length falls well below the curve when the increment per time step is small relative to the bin width, as with quarterly time steps and wide length bins. As an example, take a cohort that starts in the length bin nearest 40 cm, with quarterly time steps, Linf of 152 cm, vbk of 0.38 per year and a coefficient of variation of the growth increment of 0.3. After 10 years the von Bertalanffy curve gives 149.5 cm. With "von_bertalanffy" and "bin" the mean length is 149.6 cm with 1-cm bins, 148.3 cm with 5-cm bins and 146.6 cm with 10-cm bins. With the original structure it is 143.0 cm with 1-cm bins, 121.7 cm with 5-cm bins and 105.3 cm with 10-cm bins.
Use the four settings of "von_bertalanffy" together. With growth_transition = "midpoint", growth stops at the length where the growth increment in one time step falls well below half the bin width, whatever the value of Linf. In simulation tests with quarterly time steps and 5-cm length bins (Linf of 152 cm), growth under the original structure stopped between 113 and 120 cm. Fits with only the two initial-state settings or only the two growth settings then failed the numerical checks or gave strongly biased estimates of the fishing mortality rate, because the first time step and the later time steps followed different growth models. "von_bertalanffy" is the name of the set and also a value of the single setting growth_increment. structure = list(growth_increment = "von_bertalanffy") changes one setting, and structure = "von_bertalanffy" changes all four. When the structure list of an ALSCL fit changes one, two or three of the four settings, the fit gives a message that names the settings left at their original values (unless silent = TRUE; fit_scenarios(), hindcast_model() and retro_model() give it once per call). A list that names the set and replaces one of its settings, for example list(set = "von_bertalanffy", growth_transition = "midpoint"), is taken as a deliberate choice and gives no message. When the fitted transition has a length bin, with a midpoint below 90% of the estimated Linf, in which fish stay with a probability of at least 0.99 per time step, run_alscl() reports it in a message (unless silent = TRUE), summary() prints it, and growth_check in the fit stores the result. The original structure and the "von_bertalanffy" set have the same number of parameters, so fit both and compare their objective values.
initial_deviations does not belong to the set "von_bertalanffy" and gives no message when it is used alone. It combines with the other settings. With initial_plus_group = "equilibrium" the deviation of the plus group multiplies the sum of the older cohorts. With initial_length = "growth" the length distribution of each age class follows from growth and survival at init_Z without deviations, and the deviation of an age class multiplies the numbers of that age class only. Under "independent" the first age class of the first time step has a deviation, and the recruitment that the fit reports for that time step is the number of the first age class, this deviation included. The two forms have the same fixed-effect parameters, so fit both and compare their objective values. Differences between the package and the paper gives the results of a simulation test and of refits of three North Sea stocks.
b_structure$structure and a_structure$structure list the value used for every setting except initial_deviations, which a fit lists only when it is "independent". A saved fit keeps them. A fit with an optional structure is a different model, so compare its numerical checks, residuals and estimates with those of the default fit before you choose it (Diagnostics). If run_acl() stops because a setting "applies to ALSCL only", remove the growth and initial-length settings from the ACL call, because ACL has no growth transition matrix. Store the choice under the model it belongs to, for example in x$fit_config$alscl$structure, so that later fits of the bundle, including the retrospective peels, use it. To simulate data with the same structure, see Simulate survey data.
Allow negative AR(1) correlations
# Start from the stored configuration of YTF_example
cfg <- YTF_example$fit_config$acl
cfg$parameters$logit_log_R <- qlogis((0.1 + 1) / 2) # a correlation of 0.1
cfg$map$logit_log_R <- NULL # estimate the recruitment correlation
a_sym <- run_acl(YTF_example, parameters = cfg$parameters, map = cfg$map,
structure = list(correlation_range = "symmetric"), silent = TRUE)
a_sym$structure$correlation_range
subset(extract_parameters(a_sym), parameter == "logit_log_R")
With the default correlation_range = "positive", every AR(1) correlation (recruitment over time; F over time and over ages or lengths) lies between 0 and 1, because the correlation is the logistic transform of its logit_* parameter. When the recruitment deviations of a stock have no autocorrelation or a negative one, the estimate then runs to the lower limit, the fit reports a natural-scale boundary and it fails the numerical checks. With correlation_range = "symmetric" the correlations lie between -1 and 1. A correlation of zero is then an interior value, at a logit_* value of 0, a negative correlation can be estimated, and the numerical checks flag a correlation only when it is close to -1 or 1. The block estimates the recruitment correlation of the example. The estimate is 0.18 with a standard error of 0.23, and the 95% interval from -0.27 to 0.57 includes zero and negative values.
A logit_* starting value or fixed value has a different meaning under the two settings. A correlation rho is qlogis(rho) under "positive" and qlogis((rho + 1) / 2) under "symmetric". Convert every logit_* value that you supply, as the line of the block that sets logit_log_R does. Starting values that you do not supply keep their natural value under either setting; the two F correlations of this fit stay fixed at 0.75. inspect_parameters(), extract_parameters(), profile_model() and simulate_fit() use the transform of the bundle or fit, so the values they show or take on the natural scale are correlations under both settings. Store the choice with the converted values, for example in x$fit_config$acl$structure and x$fit_config$acl$parameters, so that later fits of the bundle use both.
Allow a negative t0 in ALSCL
x_t0 <- YTF_example
x_t0$fit_config$alscl$t0_lower <- -1
x_t0$fit_config$alscl$parameters$log_t0 <- log(-0.2 + 1) # t0 = -0.2 years
plan_t0 <- inspect_parameters(x_t0, "alscl")
plan_t0[plan_t0$parameter == "log_t0", c("parameter", "natural_start", "transform", "status")]
b_t0 <- run_alscl(x_t0, silent = TRUE)
subset(extract_parameters(b_t0), parameter == "log_t0")
b_t0$t0_lower
ALSCL holds the von Bertalanffy parameter t0 on the log scale, as t0 = t0_lower + exp(log_t0). The default t0_lower = 0 is the original parameterization, in which t0 is positive. For a stock with a negative t0, set t0_lower to a value below the smallest t0 you consider, for example -1, and supply t0 as log_t0 = log(t0 - t0_lower); the block fixes t0 at -0.2 years with log(-0.2 + 1). t0_lower must be below the recruitment age, and t0 itself stays below the recruitment age. inspect_parameters() shows the natural starting value -0.2 with the transform t0_lower+exp. extract_parameters(), plot_VB(), profile_model() and b_t0$report$t0 give or take t0 in years, and the fit keeps the limit in b_t0$t0_lower. To estimate t0 in place of fixing it, release it with a named NULL in map (step 3). When t0_lower and log_t0 come from different places, one from the arguments of the call and the other from the bundle or the recipe of a saved fit, the fit gives a message with the t0 in years that log_t0 means (unless silent = TRUE). For example, run_alscl(YTF_example, t0_lower = -1) reads the stored log_t0 = log(1/60), chosen for t0_lower = 0, as a t0 of -0.983 years. Storing both in the bundle, as in the block, or giving both in the same call gives no message.
The value -0.2 only shows how the argument works. YTF_example was generated with a t0 of 1/60 years, so this fit has a higher objective than the default fit. ACL needs no such argument, because its parameter t0 is on the natural scale and can be negative. run_acl() does not accept t0_lower. Store t0_lower under x$fit_config$alscl, as in the block; later ALSCL fits of the bundle, including the retrospective peels, then use it. A t0_lower in x$fit_args, which both models read, is left out of ACL fits with a message. retro_alscl() and retro_model() also take t0_lower in the call.
7. Control the optimizer
a4 <- run_acl(x, nstarts = 4, ncores = 2, silent = TRUE)
a4$start_diagnostics
a4$start_summary
a4$refinement$status
# For results that will be reported: more starts, spread more widely
a5 <- run_acl(x, nstarts = 5, start_spread = 0.5, ncores = 2, silent = TRUE)
a5$start_summary
nstarts runs independent starts, the first from the supplied starting values and the later ones from deterministic perturbations of them, and keeps the lowest objective. The perturbations are normal deviates with standard deviation start_spread (default 0.15) on the optimizer scale. start_diagnostics lists every start with its objective and convergence code, and start_summary gives the number of converged starts, the range of their objectives and the number that agree with the best one; a range above 2 is added to diagnostics$issues. If the final objectives differ, check convergence and compare the final gradients and parameter estimates before interpreting the difference as evidence for multiple local minima. ncores sets how many worker processes run the starts at the same time (nstarts defaults to ncores, so set both when you compare timings). train_times repeats the optimizer from each start's end point; polish = TRUE finishes the best start with up to five Newton steps that are accepted only when the gradient decreases and the Hessian stays positive definite, and a4$refinement records what happened. control = list(iter.max = 3000) passes limits to nlminb().
A single start can stop at a local optimum that passes every numerical check, particularly for the growth parameters of ALSCL. The numerical checks are local; they describe the solution that was found and do not show whether a better one exists. A fit with one start, the default, therefore gives a message unless silent = TRUE; a function that runs several fits, such as retro_model() or fit_scenarios(), gives it once per call. For results that will be reported, use at least three starts with a wider start_spread (for example 0.5) and compare the objectives in start_diagnostics; the last two lines of the block use five starts. Starts that lie close together can all reach the same local optimum, so widen the spread as well as raising the number. Several starts do not guarantee that the best solution is found (Subbey 2018).
A failed restart does not replace an actual successful pass when the objective values differ by at most 10⁻⁸ and every parameter differs by at most 1e-6 * max(1, abs(p1), abs(p2)). These tolerances identify numerically equivalent repeated passes; meaningful objective improvements or separated parameter vectors still compete by the lower objective. All raw codes and messages remain in optimizer_history, and raw_opt$selected_pass identifies the retained pass. The final gradient, Hessian and boundary checks remain separate from the optimizer code.
Supply each nlminb() option once by name, for example control = list(iter.max = 3000L). Both preflight and fitting check the names and values before optimization.
8. Record your choices
x$fit_args$F_structure <- "year"
x$fit_config$acl$map <- my_map
saveRDS(x, "my_bundle.rds")
a <- run_acl(x, silent = TRUE)
save_assessment(a, "my_acl.rds")
Every workflow function reads the bundle, so a choice stored in x is applied consistently by retro_acl(x), fit_scenarios(x, ...), hindcast_model(x) and the simulation functions. save_assessment() keeps the complete recipe with the fit, so a reader can see which values were fixed and refit the model with refit_model().
What next
| What you want to do | Read |
|---|---|
| Judge the fit and look for residual patterns | Diagnostics |
| See the full list of parameters and transformations | Estimation parameter lists |
| Test how fixed values change the answer | Assessment workflows |
| Make fits faster | Speed settings |