project_model()
View source ↗On this page
Project the population forward from the last time step of a fit under supplied fishing mortality, recruitment and future biology, without uncertainty.
Usage
project_model(
fit,
F,
recruitment,
weight,
maturity,
M = NULL,
allow_failed_fit = FALSE
)
Arguments
| Argument | Default | Description |
|---|---|---|
fit | required | An ACL or ALSCL fit that holds the population arrays of its last time step and its age, length and time coordinates. |
F | required | Nonnegative instantaneous fishing mortality rate per model time step, as one value per future time step shared by all groups, or as a matrix with one row per group (age class for ACL, length bin for ALSCL) and one column per future time step. |
recruitment | required | Finite nonnegative recruitment numbers, one per future time step; the length of the vector sets the number of future time steps. Zero is allowed. |
weight | required | Complete nonnegative matrix of individual weights, with one row per length bin and one column per future time step. Row names, if given, must match the length labels or midpoints of the fit, and column names the future times. |
maturity | required | Complete maturity matrix with one row per length bin and one column per future time step, with values between 0 and 1. Values are never carried forward or recycled. |
M | NULL | Future natural mortality rate per model time step, as a single number, one value per future time step, or a matrix with one row per age class and one column per future time step (or one column used for every future time step). NULL uses the M of the fit. For a fit with M by age and time step, NULL uses the fitted rate by age when it is the same in every time step; when it varies over time the future rate must be supplied, because no value is carried forward. For an ALSCL fit with M by length, NULL uses that rate by length. The last fitted time step uses its fitted rate. A fit that does not hold its inputs and settings needs an explicit M, whose first value is then also used for the last fitted time step. |
allow_failed_fit | FALSE | Logical. FALSE (default) rejects a fit whose numerical checks failed. TRUE allows a projection from such a fit with a warning and records the override in |
Value
A list with summary (one row per future time step with year, N, B, SSB, Rec, CN, CB, F_mean and F_apical), the long tables trajectories and fishing_mortality, F (the future F used), states (NA, NL and, for ALSCL, NLA), catch (CNA and CNL), biology (the future weight, maturity and M), model_type, year, time_step, terminal_year and assumptions. CN is catch in numbers; CB is catch in weight, in the unit of the supplied weights. assumptions records the timing and units of the projection, the source of M in the last fitted time step and the numerical checks of the fit, as source_fit_status ("passed", "failed" or "unknown"), source_fit_numerical_ok and failed_fit_override.
Details
Population numbers, B and SSB refer to the start of each future time step. The first future state is the population of the last fitted time step after the fitted F and the original M of that time step, plus the first future recruitment. The future F[t] and M[t] set the catch of time step t and the survival into t+1, so changing F in one time step changes the catch of that time step but not the SSB at its start; project at least two time steps to see its effect on the population.
ACL moves the survivors to the next age class, keeps a plus group and uses its fitted age-length key; ALSCL applies survival at length before its fitted growth matrix. Growth and the age-length probabilities stay as fitted. ACL catch at length, and with it catch in weight, is calculated from catch at age through the fitted age-length key. F_mean is the unweighted mean of F over groups and F_apical the maximum; neither converts a quarterly rate to an annual one.
The projections are deterministic and conditional on the supplied F, recruitment and future biology. They have no uncertainty intervals and no estimated stock-recruitment relationship, and the function calculates no MSY or TAC.
A fit whose numerical checks failed is rejected unless allow_failed_fit = TRUE, which gives a warning and is recorded in assumptions. A fit without a stored verdict of the numerical checks is accepted with the status "unknown". The projection needs no TMB object; the report arrays and metadata of the fit are enough.
M can be a single number, one value per future time step, or a matrix with one row per age class and one column per future time step (or one column that is used for every future time step). For a fit with a natural mortality rate by age and time step, M = NULL uses the fitted rate by age when it is the same in every time step; when it varies over time the future rate must be supplied, because no value is carried forward. For an ALSCL fit with a rate by length, M = NULL uses that rate by length. The last fitted time step uses its fitted rate.
Additional details from R help
The projection has no confidence intervals and no estimated stock-recruitment relationship, and it computes neither maximum sustainable yield nor a total allowable catch.
Population states, biomass and SSB refer to the start of each future time step. The first future state is the population of the last fitted time step, survived through its fitted F and M, plus the first supplied recruitment. The future F and M of time step t set the catch in that time step and the survival into t + 1; they do not replace the fitted F of the last time step. A future F given for one time step therefore changes the catch but not the SSB at the start of that time step; project at least two time steps to see its effect on the population.
ACL uses its fitted age-length key and age survival with a plus group; ALSCL uses its fitted numbers by length and age and its growth matrix, with survival before growth. Growth and the age-length probabilities stay fixed. ACL catch at length, and with it catch in weight, is derived from catch at age through the fitted age-length key. F_mean is the unweighted mean over ages or lengths and F_apical the maximum; neither converts a rate per quarter to an annual rate.
The projection needs only the saved report arrays and metadata, not the
TMB object, and the result keeps every assumption and supplied input. A
fit that does not record the verdict of the numerical checks is
accepted with the status "unknown"; check its diagnostics before using
the projection. Passing the numerical checks does not show that the
model is adequate or its parameters identifiable. The assumptions record
source_fit_status as "passed", "failed", or "unknown", along with
source_fit_numerical_ok and whether a failed_fit_override was used.
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)
# Assumption of the example: the biology of the last time step
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)
scenario <- project_model(b, F = rep(0.15, h),
recruitment = rep(tail(b$report$Rec, 1), h),
weight = future_w, maturity = future_mat)
scenario$summary
# F is a rate per model time step; the recruitment and biology supplied are assumptions

project_model(b, F = rep(0.15, h), recruitment = rep(tail(b$report$Rec, 1), h), weight = future_w, maturity = future_mat)