Skip to contents

sbt_add_msy() runs the annual MSY calculation for an optimized sbt_fit() and stores the complete, portable result in its msy slot. Posterior calculations are bound to the exact retained posterior payload; MLE calculations are bound to the fitted-model runtime identity. A matching named calculation is reused without reevaluation. A different calculation cannot silently replace it.

Usage

sbt_add_msy(
  fit,
  name = "default",
  posterior = TRUE,
  years = NULL,
  iters = NULL,
  chains = NULL,
  lambda = 1e+05,
  phase1_lambda = 100,
  control = list(eval.max = 100000L, iter.max = 100000L),
  cores = 1L,
  overwrite = FALSE
)

Arguments

fit

An optimized sbt_fit() object.

name

Non-empty storage name within fit$msy$entries.

posterior

TRUE to use the stored posterior or FALSE to calculate MSY at the MLE.

years

Calendar catch years to evaluate. NULL uses every fitted catch year.

iters

Optional retained-iteration indices used in every selected chain for a posterior calculation.

chains

Optional posterior chain indices.

lambda

Final catch-allocation penalty passed to find_msy().

phase1_lambda

First-phase catch-allocation penalty passed to find_msy().

control

Control list passed to stats::nlminb().

cores

Positive integer number of forked workers.

overwrite

If TRUE, replace a non-matching calculation already stored under name. Matching calculations are always reused.

Value

The updated sbt_fit with a validated sbt_msy result stored in fit$msy$entries[[name]]$result.

Details

The lower-level run_msy() function remains available for calculations that do not belong to one fit, such as a posterior assembled from multiple grid-cell fits.