The aLBI
package provides tools for estimating
length-based indicators and assessing fish stock using methods outlined
by Cope and Punt (2009) and Froese (2004). These methods are
particularly useful in data-limited situations and for providing simple
indicators to address over-fishing. This simple package facilitates the
estimation of life history parameters of fish only from the length
frequency data.
The aLBI package offers three primary functions: - FrequencyTable: Creates frequency tables from length data. - FishPar: Estimates biological parameters using bootstrapping. - FishSS: Evaluates stock status based on estimated parameters.
The package includes functions to calculate various length-based indicators and visualize fish stock data. The approaches from Cope and Punt (2009) are used to establish reference points, while Froese (2004)’s indicators help to evaluate over-fishing status.
To install the aLBI package from GitHub, follow these steps. Note that devtools is required to install packages from GitHub.
# You can install the package using the following commands in your R session:
# Install devtools if you haven't already
# install.packages("devtools")
# # Install dplyr if you haven't already
# install.packages("dplyr")
# # Install readxl if you haven't already
# install.packages("readxl")
# install aLBI package from CRAN
# install.packages("aLBI")
# Install the most updated version of aLBI package from GitHub
# devtools::install_github("Ataher76/aLBI")
Ensure the required packages are loaded in your R session. The following code checks for package availability and stops execution with a message if a package is missing.
# Check if required packages are installed and load them
# Check if required packages are installed and load them
required_packages <- c("aLBI", "readxl", "dplyr", "devtools")
for (pkg in required_packages) {
if (!requireNamespace(pkg, quietly = TRUE)) {
warning(paste("Package", pkg, "is required but not installed."))
} else {
library(pkg, character.only = TRUE)
}
}
#>
#> Attaching package: 'dplyr'
#> The following objects are masked from 'package:stats':
#>
#> filter, lag
#> The following objects are masked from 'package:base':
#>
#> intersect, setdiff, setequal, union
#> Loading required package: usethis
Prepare your collected data in a specific format (.xlsx or .csv) before using the functions. Here’s an example of how to load and prepare your data using the readxl package:
This function will calculate the frequency table from the collected and also the extract the length frequency data from the frequency table with the upper length_range.
data: A numeric vector or data frame of fish lengths. If a data frame is used, the first numeric column is selected.
bin_width: Optional. A numeric value specifying the bin width for class intervals, if left NULL or if not provided, the bin width is automatically calculated using Wang et al. (2020) optimum bin size (OBS) formula formula.
-Lmax: Optional. The maximum observed length of fish. Required only if default method (“wang”) is used and bin_width is not provided. If not provided or left NULL then automatically calculate the frequency table with the observed maximum length of the provided data.
library(readxl)
# Load your length data from the system file
lenfreq_path <- system.file("exdata", "ExData.xlsx", package = "aLBI")
print(lenfreq_path) # Check the generated path
#> [1] "C:/Users/User/AppData/Local/Temp/RtmpGGphcq/Rinst43441e2c3fae/aLBI/exdata/ExData.xlsx"
if (lenfreq_path == "") {
stop("The required file ExData.xlsx is missing. Please check the inst/extdata directory.")
}
# load the lenght frequency data
lenght_data <- readxl::read_excel(lenfreq_path)
print(lenght_data) # check the
#> # A tibble: 1,177 × 1
#> Length
#> <dbl>
#> 1 75
#> 2 66.7
#> 3 66
#> 4 64
#> 5 63.3
#> 6 63.2
#> 7 62.3
#> 8 62.2
#> 9 62
#> 10 61.3
#> # ℹ 1,167 more rows
# Running the FrequencyTable function
freqTable <- FrequencyTable(data = lenght_data, bin_width = NULL, Lmax = NULL)
#> Lmax not provided. Using maximum observed length: 75
#> Calculated actual bin width using Wang's formula: 3.07, and the nearest round bin width: 3
# Viewing the results
freqTable$lfqTable # Display the frequency table
#> # A tibble: 21 × 2
#> Length_Range Frequency
#> <fct> <dbl>
#> 1 [9,12) 15
#> 2 [12,15) 63
#> 3 [15,18) 135
#> 4 [18,21) 137
#> 5 [21,24) 135
#> 6 [24,27) 156
#> 7 [27,30) 143
#> 8 [30,33) 80
#> 9 [33,36) 88
#> 10 [36,39) 67
#> # ℹ 11 more rows
The FishPar function estimates biological parameters such as Lmax, Linf, Lmat, and Lopt using bootstrapping resampling method.
library(readxl)
# Load your length-frequency data from the system file
lenfreq_path <- system.file("exdata", "LC.xlsx", package = "aLBI")
print(lenfreq_path) # Check the generated path
#> [1] "C:/Users/User/AppData/Local/Temp/RtmpGGphcq/Rinst43441e2c3fae/aLBI/exdata/LC.xlsx"
if (lenfreq_path == "") {
stop("The required file LC.xlsx is missing. Please check the inst/extdata directory.")
}
# load the lenght frequency data
lenfreq_data <- readxl::read_excel(lenfreq_path)
print(lenfreq_data) # check the data
#> # A tibble: 15 × 2
#> LengthClass Frequency
#> <dbl> <dbl>
#> 1 12 26
#> 2 15 166
#> 3 18 244
#> 4 21 582
#> 5 24 973
#> 6 27 1067
#> 7 30 963
#> 8 33 511
#> 9 36 472
#> 10 39 286
#> 11 42 173
#> 12 45 171
#> 13 48 83
#> 14 51 36
#> 15 54 36
# Running the FishPar function
results <- FishPar(data = lenfreq_data, resample = 1000, progress = FALSE)
# Viewing the results
results$estimated_length_par
#> Parameters Mean_estimate Lower_CI Upper_CI
#> 1 Lmax 52.34100 45.00000 54.00000
#> 2 Linf 55.09579 47.36842 56.84211
#> 3 Lmat 30.55625 26.68219 31.42811
#> 4 Lopt 32.16141 27.88119 33.12655
#> 5 Lopt_p10 35.37755 30.66930 36.43920
#> 6 Lopt_m10 28.94526 25.09307 29.81389
results$estimated_froese_par
#> Parameters Mean_froese Lower_CI Upper_CI
#> 1 Pmat 38.57051 22.470428 66.59921
#> 2 Popt 33.37720 18.673269 56.49013
#> 3 Pmega 18.16770 9.976972 35.60169
The function returns a list with the following components:
estimated_length_par: Data frame of estimated length parameters with confidence intervals. estimated_froese_par: Data frame of estimated Froese indicators. estimated_freq_par: Data frame of frequency parameters. forese_ind_vs_target: Data frame comparing Froese indicators with targets. LM_ratio: Length at maturity ratio. Pobj: Objective percentage combining Pmat, Popt, and Pmega.
The FishSS function evaluates stock status using criteria based on the estimated parameters.
# Load the stock status criteria data
cpdata_path <- system.file("exdata", "cpdata.xlsx", package = "aLBI")
print(cpdata_path) #check if the path exist
#> [1] "C:/Users/User/AppData/Local/Temp/RtmpGGphcq/Rinst43441e2c3fae/aLBI/exdata/cpdata.xlsx"
if (cpdata_path == "") {
stop("The required file cpdata.xlsx is missing. Please check the inst/extdata directory.")
}
# loading the cope and punt table
cpdata <- readxl::read_excel(cpdata_path)
print(cpdata)
#> # A tibble: 21 × 11
#> Tx A B C D E F G H I J
#> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
#> 1 100 0 0 0 0 0 0 0 0 100 100
#> 2 95 0 0 0 0 22 0 11 0 100 93
#> 3 90 0 0 0 0 100 44 83 22 100 74
#> 4 85 0 0 0 0 100 100 100 67 100 63
#> 5 80 0 0 0 0 100 100 100 100 89 52
#> 6 75 0 0 0 0 100 100 100 100 74 37
#> 7 70 0 0 0 0 100 100 100 100 48 30
#> 8 65 0 0 0 0 100 100 100 100 33 22
#> 9 60 0 0 0 0 100 100 100 100 22 15
#> 10 55 0 0 0 0 100 100 100 100 11 7
#> # ℹ 11 more rows
# Running the FishSS function
stock_status <- FishSS(data = cpdata,
LM_ratio = results$LM_ratio,
Pobj = results$Pobj,
Pmat = results$estimated_froese_par[1, 2],
Popt = results$estimated_froese_par[2, 2])
# Viewing the stock status
stock_status
#> $Target_Cols
#> Tx B D
#> 1 100 0 0
#> 2 95 0 0
#> 3 90 0 0
#> 4 85 0 0
#> 5 80 0 0
#> 6 75 0 0
#> 7 70 0 0
#> 8 65 0 0
#> 9 60 0 0
#> 10 55 0 0
#> 11 50 0 0
#> 12 45 0 0
#> 13 40 0 0
#> 14 35 0 0
#> 15 30 7 7
#> 16 25 19 11
#> 17 20 37 22
#> 18 15 52 44
#> 19 10 67 67
#> 20 5 67 67
#> 21 0 67 67
#>
#> $Target_value
#> [1] 38.57051
#>
#> $Colesest_value
#> [1] 13
#>
#> $StockStatus
#> TSB40 LSB25
#> 0 0
The function returns a named vector with TSB40 and LSB25 values indicating stock status.
The Fish Stock Assessment package provides a robust framework for estimating biological parameters and assessing fish stock status. By following the steps outlined in this vignette, you can effectively utilize this package for your fish stock assessment needs.
For any questions or issues, please contact the package maintainer: Name: Ataher Ali Email: ataher.cu.ms@gmail.com
I would like to express my heartfelt gratitude to my supervisor, Dr. Mohammed Shahidul Alam, for his unwavering guidance, support, and encouragement. I am also sincerely thankful to the contributors and community members for their valuable feedback and support.
This vignette provides a comprehensive guide to using the Assessment package. By following these instructions, users can effectively conduct fish stock assessments and contribute to sustainable fishery management practices.
Wang, K., Zhang, C., Xu, B., Xue, Y., & Ren, Y. (2020). Selecting optimal bin size to account for growth variability in Electronic LEngth Frequency ANalysis (ELEFAN). Fisheries Research, 225, 105474. https://doi.org/10.1016/j.fishres.2019.105474
Cope, J. M., & Punt, A. E. (2009). Length‐Based Reference Points for Data‐Limited Situations: Applications and Restrictions. Marine and Coastal Fisheries, 1(1), 169–186. https://doi.org/10.1577/C08-025.1
Froese, R. (2004). Keep it simple: Three indicators to deal with overfishing. Fish and Fisheries, 5(1), 86–91. https://doi.org/10.1111/j.1467-2979.2004.00144.x