On this page

Plot the survey catchability that a fit used, either catchability at length, by time step when it changes, or the catchability multiplier by age.

Usage

plot_survey_catchability(
  fit,
  type = c("length", "age"),
  line_size = NULL,
  line_color = NULL,
  line_type = "solid",
  point_size = NULL,
  return_data = FALSE,
  title = NULL,
  xlab = NULL,
  ylab = NULL,
  font_family = NULL,
  title_size = NULL,
  axis_title_size = NULL,
  axis_text_size = NULL,
  strip_text_size = NULL,
  legend_text_size = NULL,
  x_breaks = NULL,
  base_theme = NULL,
  title_hjust = NULL
)

Arguments

ArgumentDefaultDescription
fitrequired

An ACL or ALSCL fit, or a saved fit read with read_assessment().

typec("length", "age")

Character. "length" (default) draws survey catchability at length against the length-bin midpoints; "age" draws the survey catchability multiplier by age class (survey_q_age) against age and is an error for a fit without this input. Letter case does not matter.

line_sizeNULL

Numeric or NULL. Line width. NULL inherits the global line_size setting.

line_colorNULL

Character or NULL. Color of the line and points. NULL inherits the global line_color setting. When catchability at length changes over time, the lines take the colors of the global palette.

line_type"solid"

Character. Line type, such as "solid" or "dashed". Default "solid".

point_sizeNULL

Numeric or NULL. Size of the points at the length bins or age classes; NULL inherits the global point_size setting (default 2.5).

return_dataFALSE

Logical. TRUE returns a list with the plot and the plotted data, described under the return value. Default FALSE.

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.

xlabNULL

Character or NULL. Label of the x axis. NULL uses the global theme setting.

ylabNULL

Character or NULL. Label of the y axis. NULL uses the global theme setting.

font_familyNULL

Character or NULL. Font family of the text, which must be installed on the computer. NULL uses the global theme setting (default "sans").

title_sizeNULL

Numeric or NULL. Size of the plot title in pt. NULL uses the global theme setting (default 14).

axis_title_sizeNULL

Numeric or NULL. Size of the axis titles in pt. NULL uses the global theme setting (default 12).

axis_text_sizeNULL

Numeric or NULL. Size of the axis tick labels in pt. NULL uses the global theme setting (default 10).

strip_text_sizeNULL

Numeric or NULL. Size of the panel labels in pt. NULL uses the global theme setting (default 10).

legend_text_sizeNULL

Numeric or NULL. Size of the legend text in pt. NULL uses the global theme setting (default 10).

x_breaksNULL

Numeric vector or NULL. Positions of the x-axis breaks. NULL inherits the global x_breaks setting when at least one of its values lies on this axis; otherwise the breaks are chosen automatically.

base_themeNULL

Character or NULL. Name of the base ggplot2 theme, such as "bw", "minimal" or "theme_bw". NULL uses the global theme setting. Letter case does not matter.

title_hjustNULL

Numeric or NULL. Horizontal position of the title, 0 for left, 0.5 for centered and 1 for right. NULL uses the global theme setting.

Value

A ggplot object; with return_data = TRUE, a list with plot and the plotted data, which has the columns Length (or Age) and Value, and Curve when catchability changes over time.

Details

The figure shows the survey catchability that a fitted ACL or ALSCL model used, either catchability at length, by time step when it changes over time, or the catchability multiplier by age class when one was supplied. Survey catchability is an input and is not estimated.

Catchability at length is the logistic curve from sel_L50 and sel_L95, or the values supplied as survey_q; the values of the length bins are connected directly. When survey_q was supplied by length and time step and differs among time steps, one line is drawn for each distinct curve, and the legend gives the time steps of each curve. type = "age" draws the catchability multiplier by age class (survey_q_age) and is an error for a fit without this input. The survey index at length is catchability at length multiplied by the sum over age classes of the multiplier by age and numbers at length and age, so catchability at length is one input for all age classes. The level and the descending part of catchability are assumptions. The survey index does not inform them, and the level of the estimated abundance depends on them. plot_compare_selectivity() draws catchability at length of two fits in one panel. The titles use the theme keys survey_q and survey_q_age; the axis labels use xlab$length or xlab$age, and ylab$survey_q or ylab$survey_q_age.

Additional details from R help

Catchability at length is the logistic curve from sel_L50 and sel_L95, or the values supplied as survey_q (see run_alscl()). The supplied values are connected directly. When survey_q was supplied by length and time step and differs among time steps, one line is drawn for each distinct curve, and the legend gives the time steps of each curve. A fit without a recipe is read from its live TMB object.

The survey index at length is survey catchability at length multiplied by the sum over age classes of the multiplier by age and numbers at length and age. Survey catchability at length is therefore one input for all age classes. Its level and its descending part are assumptions, because the survey index does not inform them, and the level of the estimated abundance depends on them.

plot_compare_selectivity() draws survey catchability at length of two fits in one panel. The titles use the theme keys survey_q and survey_q_age; the axis labels use xlab$length or xlab$age, and ylab$survey_q or ylab$survey_q_age.

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_survey_catchability(b)
# The catchability of each length bin
head(plot_survey_catchability(b, return_data = TRUE)$data)
Example figure
Example figure: plot_natural_mortality(b, title = "Natural mortality rate") | plot_survey_catchability(b, title = "Survey catchability at length")

See also

Search documentation