On this page

Compare the fishing mortality of two fits summarized over groups in each time step, as the maximum (apical) or the mean.

Usage

plot_compare_F_ts(
  model1,
  model2,
  model1_name = NULL,
  model2_name = NULL,
  method = c("apical", "mean"),
  colors = NULL,
  linetypes = NULL,
  line_size = NULL,
  ...,
  point_size = NULL,
  basis = c("native", "age"),
  title = NULL
)

Arguments

ArgumentDefaultDescription
model1required

The first fit.

model2required

The second fit.

model1_nameNULL

Character or NULL. Name of the first fit in the plot and in the default title. NULL takes the model type ("ACL" or "ALSCL"); when both fits have the same type, the F structure, or 1 and 2, is added in parentheses.

model2_nameNULL

Character or NULL. Name of the second fit in the plot and in the default title. NULL takes the model type ("ACL" or "ALSCL"); when both fits have the same type, the F structure, or 1 and 2, is added in parentheses.

methodc("apical", "mean")

Character. Summary over groups within each time step, "apical" for the maximum F and "mean" for the unweighted arithmetic mean. Rates are not annualized. ACL uses age classes and ALSCL length bins, and both summaries depend on that grouping. Letter case does not matter.

colorsNULL

Character vector of two colors, named by model or in model order. NULL uses the global compare_colors setting; fewer than two colors give a warning, and the global setting is used.

linetypesNULL

Character vector of two line types, with the same rules as colors. NULL uses the global compare_linetypes setting.

line_sizeNULL

Numeric or NULL. Line width. NULL uses the global compare_line_size setting.

...…

The former argument name linewidth (for line_size), accepted with a warning.

point_sizeNULL

Numeric or NULL. Point size. NULL uses the global compare_point_size setting, or point_size (default 2.5) when that is NULL.

basisc("native", "age")

Character. The groups over which F is summarized. "native" (default) uses the F matrix that each model estimates, F at age for ACL and F at length for ALSCL. "age" uses F at age for both fits (report$F for ACL and the derived report$FA for ALSCL) and summarizes only the fitted ages and the time steps present in both fits. ALSCL F at age covers every age, including the plus group, and every time step when the fit holds numbers at length and age (report$NLA); otherwise it has no plus-group row and no value for the last time step, and the comparison leaves out the ACL plus group and the last time step. The two fits must have the same time step. Letter case does not matter.

titleNULL

NULL (default) draws the default title, FALSE, NA or "" draws no title, and a character string draws that string; see acl_theme_set() for the default titles and the show_title setting.

Value

A ggplot object, which can be styled further or saved with acl_save_plot().

Details

apical is the maximum and mean the unweighted arithmetic mean across groups in each model time step. By default (basis = "native") ACL uses age groups and ALSCL length bins, so both summaries depend on the grouping; read the time pattern of such a pair, not the difference in level. basis = "age" uses F at age for both fits and summarizes only the fitted ages and time steps present in both. ALSCL F at age covers every age, including the plus group, and every time step. The values for the plus group and the last time step are not in the fitted report; the function computes them from the reported numbers at length and age (report$NLA) and total mortality at length (report$ZL) with the same formula. A result without numbers at length and age, for example a hand-made list, has no plus-group row and no value for the last time step, and the comparison then leaves out the ACL plus group and the last time step. The two fits must have the same time step, because F is a rate per time step, and the function stops when the steps differ. An age-group maximum need not equal a length-bin maximum, because age-specific F combines survival across lengths. Quarterly rates are not annualized. The y-axis label gives the time basis of the rate and the caption states the groups that each summary covers.

Two fits of the same model get distinct default names, such as ACL (group_year) and ACL (year); model1_name and model2_name set other names, which must differ. Each fit keeps its own time steps, so the two fits can cover different years. A visual comparison does not show that the likelihoods or the biological assumptions of the two fits are comparable.

plot_compare_annual_F() is the former name of this function; it still works and warns once per session.

Points take the global point_size setting (default 2.5) unless the global compare_point_size setting is given; a point_size in the call takes priority. acl_theme_set(compare_point_size = NULL) returns to the global point_size.

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)
# Use objects defined above
plot_compare_F_ts(a, b, method = "apical",
  title = "Apical fishing mortality rate by time step")
Example figure
Example figure: plot_compare_F_ts(a, b, method = "apical", title = "Apical fishing mortality rate by time step")

See also

Search documentation