agesFbar: Age Range for Fbar

View source: R/agesFbar.R

agesFbarR Documentation

Age Range for Fbar

Description

Calculate a suitable age range for average fishing mortality (Fbar).

Usage

agesFbar(cn, probs = c(0.1, 0.9), plot = FALSE, main = NULL,
  xlab = NULL, ylab = NULL, col = NULL)

Arguments

cn

a vector, matrix, table, or data frame containing the catch at age as integers or decimal values. Ages are indicated in names if cn is a vector, or in column names if cn is a matrix, table, or data frame.

probs

a vector of probabilities, e.g. c(0.1, 0.9) to calculate the age range that covers 80% of the catch.

plot

whether to indicate the cut points on a bar plot.

main

passed to barplot.

xlab

passed to barplot.

ylab

passed to barplot.

col

passed to barplot.

Value

Vector of two values, the lower and upper age. These can be rounded to construct an Fbar age range.

Note

The calculations are more complicated than traditional quantiles, since the ages for Fbar are discrete and not continuous. For example, with a continuous variable, Fbar[5-6] has width one, but for a discrete variable it has width two.

The algorithm cuts off exactly probs[1] and 1-probs[2] from the left and right tails of the distribution and returns the corresponding values that can be rounded with a simple round(agesFbar(x)) to get a discrete age range that covers close to diff(probs) of the catch.

With plot = TRUE, the white bars are outside the Fbar age range and the dark gray bars are inside it. The bars affected by the lower and upper cut points are drawn in a shade between white and dark gray, providing a visual cue whether that age should be in the Fbar age range or not.

The calculated limits are somewhat unintuitive for interpretation, but they are statistically precise and unbiased. A lower limit of 6.8 means that 80% of age six was cut off the left tail, so rounding the lower age of Fbar to 7 appropriate. An upper limit of 14.1 means that all of age 14 and 10% of age 15 is inside the range, so rounding the upper age of Fbar to 14 is appropriate. See plot = TRUE example below.

Author(s)

Arni Magnusson.

See Also

gss is an example catch-at-age table.

quantile is the base function to calculate quantiles.

icesAdvice-package gives an overview of the package.

Examples

agesFbar(gss)
agesFbar(gss, plot=TRUE)
agesFbar(gss, plot=TRUE, main="Greater silver smelt in 5b and 6a")

# 50% coverage instead of 80%
agesFbar(gss, c(0.25, 0.75))

# Include only the last 20 years
agesFbar(tail(gss, 20))

# Tests
cn1 <- setNames(c(100,400,400,100), 3:6)
cn2 <- setNames(c(99,401,401,99), 3:6)
cn3 <- setNames(c(101,399,399,101), 3:6)
cn4 <- setNames(c(500,400,50,50), 3:6)
cn5 <- setNames(c(50,50,400,500), 3:6)
agesFbar(cn1)
agesFbar(cn2)
agesFbar(cn3)
agesFbar(cn4)
agesFbar(cn5)


icesAdvice documentation built on March 18, 2022, 6:19 p.m.