knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>"
)

Introduction

This vignette demonstrates how to back-calculate lengths at previous ages from radial measurements made on calcified structures of fish. This vignette assumes that you have an understanding of

Packages used in this vignette are loaded below.

library(RFishBC)   # for bcFuns()
library(FSA)       # for validn(), sumTable()
library(dplyr)     # for %>%, inner_join(), arrange(), group_by, summarize()

Finally, some of the data manipulations used in this vignette, which may not be familiar to all readers, are described in detail in Ogle (2016).

\

\


Data for Back-Calculation

The radial measurements from multiple fish should be combined into one data.frame using combineData(). In addition, the length-at-capture for each fish should be appended to that data.frame. A method to combine radial measurements from multiple fish and append a length-at-capture variable was demonstrated in the Output Data File section of the Collecting Radii Data vignette.

Several of the back-calculation methods require estimating parameters from the relationship between fish length and structure radius or structure radius and fish length (as described in Short Introduction to Back-calculation vignette). These methods cannot be demonstrated well with a small number of fish (as in the Collecting Radii Data vignette). Thus, data from a large number of Smallmouth Bass (Micropterus dolomieu) collected from West Bearskin Lake (MN) in 1990 will be used in this vignette.

A data.frame of the Smallmouth Bass data as it would appear from combineData() is obtained as follows.[^dataexplain]

data(SMBassWB2,package="RFishBC")
head(SMBassWB2)

A data.frame of fish-specific information, most importantly the length-at-capture, is obtained as follows.[^SMBassWB1yearnote]

data(SMBassWB1,package="RFishBC")
head(SMBassWB1)

These data can be joined by the common id variable as shown in the Output Data File section of the Collecting Radii Data vignette. The data were also arranged by id to facilitate comparisons throughout this vignette.[^arrangenotrequired]

SMBassWB <- inner_join(SMBassWB1,SMBassWB2,by="id") %>%
  arrange(id)
head(SMBassWB,n=3)
tail(SMBassWB,n=3)

Note that the variables in this data frame are defined as follows:[^varsnotneeded]

\

\


Computing Back-Calculated Lengths

A data.frame of back-calculated lengths ($L_{i}$) can be constructed from a data.frame that contains at least the length-at-capture ($L_{cap}$), structure radius-at-capture ($R_{cap}$), and the structure radius at each annulus ($R_{i}$) with backCalc().

The first argument to this function is a data.frame with the $L_{cap}$, $R_{cap}$, and $R_{i}$ data in either "long" or "wide" format. A long-format data.frame MUST have the following variable names:

A wide-format data.frame MUST have the following variable names:

These data.frames will be in these required formats if the data originated from the combineData() function.[^otherdataorigins] Other variables may exist in the data.frame, but these variables must exist with the names and contents shown here.

The data.frame MUST also have a variable that contains the fish's length-at-capture. The name for this variable MUST be given (without quotes) in the second or lencap= argument.

The format for the input data.frame MUST be given in inFormat=. The two choices for this argument are "long" and "wide".

Finally, one of the many back-calculation models discussed in Vigliola and Meekan (2009) must be selected for use with the BCM= argument. The back-calculation model can be chosen by "name" or number, both of which can be seen in the documentation for bcFuns(). For example, the popular Fraser-Lee model can be selected with BCM="FRALE" or BCM=2.

Some of the models require parameters estimated from models fit to the relationship between fish length and structure radius or structure radius and fish length. These models will be fit "behind-the-scenes" in backCalc(). However, some models also require parameters estimated without the observed data, which must then be provided by the user. For example, the Fraser-Lee model uses a length correction factor that may be the estimated length when the structure first forms or a standard published value for a species (Carlander 1980). If the user wants to provide one of these values, then it is given in the a= argument.[^FraserLeea] Other parameters for other models may be given in other arguments to backCalc() (see the documentation for backCalc()).

The results of backCalc() can be returned in either "long" or "wide" format as identified with outFormat= (which defaults to be the same as inFormat=). The number of digits for the back-calculated lengths may be controlled with digits=.

For example, back-calculated lengths were constructed from the wide-format data in SMBassWB, which has length-at-capture data in the lencap variable, using the Fraser-Lee model (with the "a" parameter estimated from the data) with the code below. The lengths were rounded to whole numbers (i.e., digits=0) and the results were returned in wide-format (the same as the input format).

SMBassWB_FL <- backCalc(SMBassWB,lencap,BCM="FRALE",inFormat="wide",digits=0)
head(SMBassWB_FL,n=3)
tail(SMBassWB_FL,n=3)

The example below uses the same data and same back-calculation model, but with the results returned in long-format which is more conducive to statistical summarization and modeling.

SMBassWB_FL2 <- backCalc(SMBassWB,lencap,BCM="FRALE",
                         inFormat="wide",outFormat="long",digits=0)
head(SMBassWB_FL2,n=6)
tail(SMBassWB_FL2,n=6)

\

\


Summarizing Back-Calculated Lengths

For example, the mean back-calculated length-at-age may be computed with group_by() and summarize() as shown below for the long-format Fraser-Lee results.

tmp <- SMBassWB_FL2 %>%
  group_by(ann) %>%
  summarize(n=validn(bclen),
            mn=round(mean(bclen),0),
            sd=round(sd(bclen),1)) %>%
  as.data.frame()
tmp

Additionally, the mean length at each back-calculated age computed separately for each age-at-capture is found with sumTable(), where the left side of the formula is the quantitative variable to be summarized and the right side has grouping variables presented in row*column format.

sumTable(bclen~agecap*ann,data=SMBassWB_FL2,digits=0)

\

\


References

\

\

Footnotes

[^dataexplain]: Both of these data.frames are available in the RFishBC package. However, these types of data could be the result of using comineData() and inner_join() or from loading a relevant CSV file as demonstrated in Output Data File section of the Collecting Radii Data vignette.

[^SMBassWB1yearnote]: Note that this file contains information from fish captured in years other than 1990.

[^arrangenotrequired]: Arranging the data by fish id is not required for the work below. It is simply used here for demonstration purposes.

[^varsnotneeded]: The species, lake, gear, yearcap, and reading variables are not needed in this vignette, but could be needed in further statistical analyses.

[^otherdataorigins]: If your data originated from somewhere else, then you may need to rename your variables to meet these conventions.

[^FraserLeea]: If a is not provided by the user for the Fraser-Lee model, then it will be estimated from the intercepts of the linear regression of fish length on structure radius.



fishR-Core-Team/RFishBC documentation built on Jan. 30, 2024, 4:42 a.m.