---
title: "Catch curves (with selectivity) - TropFishR: installation instructions and running the test data set"
date: "`r format(Sys.time(), '%d %B, %Y')`"
output:
html_document:
theme: cerulean
pdf_document: default
word_document: default
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```
# Catch curves (with selectivity)
Catch curve analysis is a method for estimating the total mortality of a stock (*Z*). The rate at which individuals die can be estimated from the slope ofa regression of the logarithms of relative numbers present in each age class on age. It can be used whenever there is one or more years of catch-at-age data (or at-length data, if they can be converted to age). The data can be fishery-dependent or -independent so long as they are representative of the population's relative age/length structure. Fishing mortality (*F*) can be estimated as Z-M given an estimate of natural mortality (*M*) from another source (e.g., the literature, from a marine protected area, or from a tagging study).
The method is based on the equilibrium assumption (i.e., the total population receives constant recruitment and there is a constant mortality rate each year), which implies that all cohorts would be identical and the numbers in each age class would decline exponentially. Thus, if one assumes that fishing mortality and natural mortality have been constant, and one has the age-composition of the catch for a single year, if one plots the log-transformed numbers-at-age against age, then the slope of a linear regression through the data will provide an estimate of total mortality (*Z*).
Conventional catch-curve methods rely on the strong assumptions of constant fishing and natural mortality rates above some fully-selected age that is usually estimated by visually inspecting a plot of logged catch-at-age. Rather than just ignoring the earlier weakly selected ages below the (assumed) fully-selected age, as in the classical catch-curve, it is possible to estimate selectivity parameters as well as the total mortality rate. However, this requires the use of an equilibrium based age-structured model.
Conventional catch-curve methods rely on the strong assumptions of constant fishing and natural mortality rates above some fully selected age that is usually estimated by visually inspecting a plot of log-catch at age vs age. Rather than just ignoring the earlier weakly selected ages below the (assumed) fully selected age, as in the classical catch-curve, it is possible to estimate selectivity parameters as well as the total mortality rate.
As opposed to classic catch curves, catch curves with selectivity provide an estimate of fully- selected fishing mortality, rather than an average fishing mortality applied to all included age classes.
The *TropFishR* package is a compilation of fish stock assessment methods for the analysis of length-frequency data in the context of data-poor fisheries. It includes methods and examples included in the FAO Manual by Sparre and Venema (1998), *(Introduction to tropical fish stock assessment)*, as well as other more recent methods.
The function *catchCurve* in the *TropFishR* package applies the (length-converted) linearised catch curve to age-composition and length-frequency data, respectively, to estimate the instantaneous total mortality rate (*Z*). Optionally, gear selectivity can be estimated and a cumulative catch curve can be applied.
The main author of *TropFishR*'s catch curve package, Tobias Mildenberger, has an excellent online tutorial https://cran.r-project.org/web/packages/TropFishR/vignettes/tutorial.html.
This tutorial illustrates the application of the *TropFishR* package to perform a single-species fish stock assessment (incorporating a catch curve analysis) with length frequency data. This tutorial can be particularly useful if one lacks information on biological stock characteristics. It provides a detailed consideration of the following steps: (1) estimation of biological stock characteristics (growth and natural mortality), (2) exploration of fisheries aspects (exploitation rate and selectivity), and (3) assessment of stock size and status.
Otherwise, a good general description of the catch curve function can be found in the package vignette, at
https://rdrr.io/cran/TropFishR/man/catchCurve.html.
This can also be found, together with descriptions of all the other functions in the package, in the "Package "TropFishR"" manual, at https://cran.r-project.org/web/packages/TropFishR/TropFishR.pdf
# Installation
This package is run from R as found on CRAN. R can be installed from https://cran.r-project.org/.
The recommended way to run R is using RStudio. After you have installed R, then install RStudio. It can be found at https://www.rstudio.com/products/rstudio/download/.
The catch curve function is part of a set of stock assessment tools within the *TropFishR* package. The current version of TropFishR (v1.2) requires R >=3.0.0.
*TropFish* can be downloaded from CRAN as follows:
```{r install, eval=TRUE}
Check_Install.packages <- function(pkg){
new.pkg <- pkg[!(pkg %in% installed.packages()[, "Package"])]
if (length(new.pkg))
install.packages(new.pkg,dependencies = TRUE) else print(paste0("'",pkg,"' has been installed already!"))
sapply(pkg, require, character.only = TRUE)
}
Check_Install.packages("TropFishR")
#install.packages("TropFishR", repos = "https://cran.rstudio.com/")
```
The package is loaded into the R environment with:
```{r load package, eval=TRUE}
library(TropFishR)
```
# Reading in the data
## Obtaining life-history inputs
*TropFishR* uses von Bertalanffy growth parameters as inputs to its catch curve function.
The Mildenberger tutorial provides a detailed description and tutorial of a process for using TropFishR's ELEFAN (ELectronic LEngth Frequency Analysis) methods to allow the user to estimate *L*_{inf} and *K* from length-frequency data. This is undertaken by restructuring the data and fitting growth curves through the restructured length-frequency data (Pauly 1980).
The tutorial then describes how to obtain an estimate of instantaneous natural mortality, *M*, using estimates of the VBGF growth parameters (*L*_{inf} and *K*; Then et al. 2015). The estimation of *M* is challenging (Kenchington 2014; Powers 2014). When no controlled experiments or tagging data are available from which to estimate v, the main approach is to use empirical formulae. Overall, there are at least 30 empirical formulae for the estimation of this parameter (Kenchington 2014), relying on correlations with life history parameters and/or environmental information. TropFishR applies the most recent formula, which is based upon a meta-analysis of 201 fish species (Then et al. 2015), using its function *M*-empirical.
In our case, we will be using a simulated example dataset that has been created for the whole toolbox. Included in these test data are the following required life-history inputs:
* ***general (required) inputs:***
* **midLengths or age** : midpoints of the length classes (length-frequency data) or ages (age composition data)
* **Linf** *: asymptotic length for the investigated species in cm [cm] (= 81.44505)
* **K** *: growth coefficent for the investigated species per year [1/year] (=0.15)
* **t0** *: theoretical age at zero length, at which individuals of this species hatch (= -1.87856856036483 yr)
Our dataset was created using Stock Synthesis based on an age-at-maturity of roughly 3-4 years and a rate of natural mortality of 0.2 yr^{-1} for females, and 0.25 yr^{-1} for males.
For our worked example, we will use catch-at-age data and female growth rates.
## Reading in the catch-at-age-data
The TropFishR catch curve function requires as its main input catch-at-length, or catch-at-age.
* **catch**: catches, vector or matrix with catches of subsequent years if the catch curve with constant time intervals should be applied;
A simulated example dataset has been created for the whole toolbox.
We will use the catch-at-age data, although we do also have available catch-at-length.
Let us now read in both the catch-at-age and catch-at-length data. We assume you have saved the data to the same directory as your working directory. Otherwise you can change our code to point to the directory where the data file is and call it your working directory using the setwd command.
The simulated catch-at-age data, *TotalCatchAge*, are for years (1960-2001) in rows (2-43), with 25 age bins (ages 1 to 25) in columns (B to Z). The first 11 years of this file have no data, so we will focus on year 1971 onwards.
The simulated catch-at-length data, *LengthData.csv*, are for years 1971-2001 in rows (2-32), with 17 length bins (10cm-90cm, by 5cm) in columns (E to U).
Let us read in and inspect the data:
```{r load data }
TotCatAge <- read.csv("TotalCatchAge.csv")
print(TotCatAge[12:42,])
TotCatLen <- read.csv("LengthData.csv")
print(TotCatLen)
```
On inspection, there is no catch within many older ages from 1988. On the other hand, the earlier years also appear to have very few counts relative to those in later years.
In our case, we will focus on catch-at-age data from 1980-1995 (rows 21 to 36) inclusive. We must remove the first column containing the years.
For catch-at-length, we will remove the first 3 columns containing the year, fleet and sex.
We will also have to remove the last three length category columns, as they are greater than the specified *L*_{inf} value and so result in the catch curve function taking the log of a negative number (log(1 - *L*/*L*_{inf})).

``` {r assign age data}
naa <- TotCatAge
yrs <- 21:36
naa <- naa[yrs,2:26] # We must remove the first column containing the years.
ages <- 1:25
nal <- TotCatLen
nal <- nal[,5:18]
```
Within the catch-at-age data, we can see there is a strong year cohort progressing through from 1990 onwards, which violates the assumption of constant recruitment. Despite the large sample sizes in the 1990s, let us instead focus our analysis on 1988 in the first instance. These are years with high sample sizes (2840 and 2974, respectively) but without visual evidence of strong recruitment pulses.
To correctly format the data for input into the *catchCurve* function in *TropFishR*, catch-at-age or catch-at-length needs to be a matrix with each column being one year of data, and each row one age class. We will therefore have to transpose our data, and we will assign the column names to be the years:
``` {r correctly format the catch input data}
catch_age_input <- t(naa)
colnames(catch_age_input)<-c(1980:1995)
catch_len_input <- t(nal)
colnames(catch_len_input)<-c(1971:2001)
```
For the *catchCurve* function in *TropFishR*, the input data are fed in as function argument **param**, which needs to be a list consisting of:
* **midLengths or age** : midpoints of the length classes (length-frequency data) or ages (age composition data),
* **Linf** : asymptotic length for the investigated species in cm [cm],
* **K** : growth coefficent for the investigated species per year [1/year],
* **t0** : theoretical age at zero length, at which individuals of this species hatch,
* **catch** : catches, vector or matrix with catches of subsequent years if the catch curve with constant time intervals should be applied;
``` {r generate the input list}
TestList_age <- list("age"=c(0.5:24.5),"Linf"=81.44505,"K"=0.15,"t0"=-1.87856856036483,catch=catch_age_input)
TestList_length <- list("midLengths"=seq(12.5,77.5,by=5),"Linf"=81.44505,"K"=0.15,"t0"=-1.87856856036483,catch=catch_len_input)
```
# Fitting the model to our data
We will now apply the *catchCurve* function to year 1988 (the 8th column) in the catch-at-age data.
The function *catchCurve* is
catchCurve(
param,
catch_columns = NA,
cumulative = FALSE,
calc_ogive = FALSE,
reg_int = NULL,
reg_num = 1,
auto = FALSE,
plot = TRUE
)
with arguments
* **param** as described above
* **catch_columns** numerical; indicating the column of the catch matrix which should be used for the analysis.
* **cumulative** logical; if TRUE the cumulative catch curve is applied (Jones and van Zalinge method)
* **calc_ogive** logical; if TRUE the selection ogive is additionally calculated from the catch curve (only if cumulative = FALSE)
* **reg_int** instead of using the identity method a range can be determined, which is to be used for the regression analysis. If equal to NULL identity method is applied (default). For multiple regression lines provide list with the two points for the regression line in each element of the list.
* **reg_num** integer indicating how many separate regression lines should be applied to the data. Default 1.
* **auto** logical; no interactive functions used instead regression line is chosen automatically. Default = FALSE
* **plot** logical; should a plot be displayed? Default = TRUE
This function includes the identify function, which asks you to manually choose two points from a graph. The two points, which you choose by clicking on the plot in the graphical device, represent the start and end of the data points, which bracket the negative-linear section of the scatterplot and hence which data should be used for the analysis. Based on these points the regression line is calculated.
Here we tell the model (using the **reg_int** argument) to select points 5 and 24, as bracketing the most (negative) linear section of the scatterplot. For this demonstration, we will use the **reg_int** argument of the function to provide the interval used for the regression analysis.
```{r runModel}
catchCurve(TestList_age,reg_int=c(5,24),catch_columns=8)
```
The function value is a list with the input parameters and following list objects:
* **classes.num, tplusdt_2, t_midL, or ln_Linf_L** : age, relative age or subsitute depending on
input and method,
* **lnC or lnC_dt** : logarithm of (rearranged) catches,
* **reg_int** : the interval used for the regression analysis,
* **linear_mod** : linear model used for the regression analysis,
* **Z** : instantaneous total mortality rate, confidenceInt
* **se** : standard error of the total mortality;
* **confidenceInt** : confidence interval of the total mortality;
in case calc_ogive == TRUE, additionally:
* **intercept** : intercept of regression analysis,
* **linear_mod_sel** : linear model used for the selectivity analysis,
* **Sobs** : observed selection ogive,
* **ln_1_S_1** : dependent variable of the regression analysis for selectivity parameters,
* **Sest** : estimated selection ogive,
* **t50** : age at first capture (age at which fish have a 50% probability to be caught),
* **t75** : age at which fish have a 75% probability to be caught,
* **L50** : length at first capture (length at which fish have a 50% probability to be caught),
* **L75** : length at which fish have a 75% probability to be caught
This function applies the (length-converted) linearised catch curve to age composition or length-frequency data, respectively. It allows estimation off the instantaneous total mortality rate (Z). Optionally, the gear selectivity can be estimated and the cumulative catch curve can be applied.
The assumption is made that *Z* is constant for all year classes or length groups, respectively, when the selection ogive is calculated by means of the catch curve. According to Sparre and Venema (1998) this assumption might be true, because *F* is smaller for young fish (selectivity) while *M* is higher for young fish (high natural mortality). The selectivity for old fish that are not fully exploited (e.g. due to being caught in a gillnet fishery) can not be calculated using the catch curve method. Based on the format of the list argument **catch** and whether the argument **catch_columns** is defined, the function automatically distinguishes between the catch curve with variable parameter system (if **catch** is a vector) and the one with constant parameter system (if **catch** is a matrix or a data.frame and **catch_columns** = NA). In the case of the variable parameter system the catches of one year are assumed to represent the catches during the entire life span of a so called pseudo-cohort.
We reiterate that the cumulative catch curve does not allow for the estimation of the selectivity ogive.
Let's now run the model to also estimate the selectivity ogive, again in the year 1988.
(In this case we will use the length data, because we suspect a bug with estimating selectivity using the catch-at-age data).

```{r runModel with selectivity}
#catchCurve(TestList,reg_int=c(1,26),calc_ogive=TRUE,catch_columns=8)
catchCurve(TestList_length,reg_int=c(9,13),calc_ogive=TRUE,catch_columns=18)
```
# Interpreting results in a management context
Catch curve analysis results in an estimate of total mortality, and, assuming a fixed natural mortality, fishing mortality. It does not provide an estimate of stock status per se, except where consistently low fishing mortality is used as a proxy for sustainability (although this would require many years of age-composition data). The estimates of fishing mortality could be compared to a reference point such as the fishing mortality at maximum sustainable yield, if this were available.
As only a single year of numbers-at-age is required, catch curve analysis is appropriate for fisheries that have occasional age-structured data, and whose catch-at-age distribution is not expected to vary strongly through time. As such, catch-curve analysis is frequently applied to data-poor fisheries, where a variety of disparate information sources (each of low quality for stock assessment) may be available. Future work could formalize a process by which catch curves are combined with expert opinion (i.e., interviews with fishers) and other data-poor analyses (e.g., changes in mean length) into a quantitative estimate of stock status (Thorson and Prager 2011).
# Key references
## Catch Curve Methodology
Chapman, D.G. and D.S. Robson. 1960. The analysis of a catch curve. *Biometrics* 16:354-368.
Dunn, A., Francis, R.I.C.C. and I.J. Doonan. 2002. Comparison of the Chapman-Robson and regression estimators of Z from catch-curve data when non-sampling stochastic error is present. *Fisheries Research* 59:149-159. https://doi.org/10.1016/S0165-7836(01)00407-6
Gulland, J.A. 1971. The fish resources of the ocean. West Byfleet, UK: Fishing News Books.
Smith, M.W., Then, A.Y., Wor, C., Ralph, G., Pollock, K.H. and J.M. Hoenig. 2012. Recommendations for catch-curve analysis. *North American Journal of Fisheries Management* 32:956-967. http://dx.doi.org/10.1080/02755947.2012.711270
Thorson, J.T. and M.H. Prager. 2011. Better catch curves: Incorporating age-specific natural mortality and logistic selectivity. *Transactions of the American Fisheries Society* 140:356-366. http://dx.doi.org/10.1080/00028487.2011.557016
Wayte, S.E. and N.L. Klaer. 2010. An effective harvest strategy using improved catch-curves. *Fisheries Research* 106:310-320. https://doi.org/10.1016/j.fishres.2010.08.012
## Catch Curve Evaluation
Allen, M.S. 1997. Effects of variable recruitment on catch-curve analysis for crappie populations. *North American Journal of Fisheries Management* 17(1):202-205. https://doi.org/10.1577/1548-8675(1997)017<0202:EOVROC>2.3.CO;2
Griffiths, S.P. 2010. Stock assessment and efficacy of size limits on longtail tuna (*Thunnus tonggol*) caught in Australian waters. *Fisheries Research* 102(3):248-257. https://doi.org/10.1016/j.fishres.2009.12.004
Oyarzún, C., Cortés, N. and E. Leal. 2013. Age, growth and mortality of southern rays bream *Brama australis* (Bramidae) off the southeastern Pacific coast. *Revista de biología marina y oceanografía* 48(3). http://dx.doi.org/10.4067/S0718-19572013000300014
See references in http://derekogle.com/fishR/examples/oldFishRVignettes/CatchCurve.pdf.
## Other
Kenchington, T.J. 2014. Natural mortality estimators for information-limited fisheries. *Fish and Fisheries* 15(4):533-62. https://doi.org/10.1111/faf.12027.
Pauly, D. 1980. On the interrelationships between natural mortality, growth parameters, and mean environmental temperature in 175 fish stocks. *ICES Journal of Marine Science* 39(2):175-192 https://doi.org/10.1093/icesjms/39.2.175.
Powers, J.E. 2014. Age-specific natural mortality rates in stock assessments: size-based vs. density-dependent. *ICES Journal of Marine Science* 71(7):1629-37. https://doi.org/10.1093/icesjms/fst226
Sparre, P. and S.C. Venema. 1998. Introduction to tropical fish stock assessment. Part 1. Manual. *FAO Fisheries Technical Paper* (306.1, Rev. 2). 407 p.
Then, A.Y., Hoenig, J.M., Hall, N.G. and D.A. Hewitt. 2015. Evaluating the prodicitve performance of emiprical estimators of natural mortality rate using information on over 200 fish species. *ICES Journal of Marine Science* 72(1):82-92. https://doi.org/10.1093/icesjms/fsu136.