Title: | Shark Demographic Analyses Using Leslie Matrix Models |
---|---|
Description: | Run Leslie Matrix models using Monte Carlo simulations for any specified shark species. This package was developed during the publication of Smart, JJ, White, WT, Baje, L, et al. (2020) "Can multi-species shark longline fisheries be managed sustainably using size limits? Theoretically, yes. Realistically, no".J Appl Ecol. 2020; 57; 1847–1860. <doi:10.1111/1365-2664.13659>. |
Authors: | Jonathan Smart [aut, cre, ctb, cph]
|
Maintainer: | Jonathan Smart <[email protected]> |
License: | GPL (>= 3) |
Version: | 1.1.0 |
Built: | 2025-02-14 06:13:16 UTC |
Source: | https://github.com/jonathansmart/sharkdemography |
Using provided life history estimates from various sources, a demographic analysis is performed using Leslie matrix methods. This function can be run as stand alond and will given the outputs of a stochastic matrix model given the provided life history parameters and their associated error. However, the main purpose of this function is to be used in other simulation functions provided in this package. In each use this function will calculate:
The finite rate of population growth
The reproductive value of the population
The generation length of the population
The mean elasticity of the fecundity elements
The mean elasticity of the juvenile survivoship elements
The ratio of fecundity to juvenile elasticities
The ratio of fecundity to adult elasticities
The natural mortality estimator randomly used in this analysis
Calculate_demography( data, AAFC = NULL, F. = 0, AALC = NULL, M.estimators = NULL )
Calculate_demography( data, AAFC = NULL, F. = 0, AALC = NULL, M.estimators = NULL )
data |
A multi-level list of the class 'Demography.inputs' produced from the 'create_data_input' function and then manually completed. |
AAFC |
Age-at-first-capture which can be specified by the user or automated in the 'Simulate_AAFC' function. Must be an integer age which can include zero to indicate the availability of the population to capture from birth. |
F. |
The instantaneous rate of fishing mortality 'F'. This will be applied to all ages available to capture as defined by either the AALC or AAFC arguments. |
AALC |
Age-at-last-capture which can be specified by the user or automated in the 'Simulate_AALC' function. Must be an integer age which can include zero. |
M.estimators |
Any specific natural mortality estimators to be included in the analysis. Only one will be used in each run which is randomly selected. In the simulation functions these will be varied among simulations. Must be a single estimator or a vector of estimators. These can include: "Pet.Wro","Jensen.mat","Chen.Yuan","Then_hoenig","Then_pauly", " Jensen.mat","Charnov" or "Chen.Want". If none are specified then all applicable estimators could be chosen. |
A list of parameters including:
The finite rate of population growth
The reproductive value of the population
The generation length of the population
The mean elasticity of the fecundity elements
The mean elasticity of the juvenile survivoship elements
The ratio of fecundity to juvenile elasticities
The ratio of fecundity to adult elasticities
The natural mortality estimator randomly used in this analysis
# load Silky shark data produced by create_data_input() # Type `?create_data_input()` for details data("Silky_data") # run a single Leslie Matrix analysis with random draws from biological data # distributions. Use `Simulate_demography()` to run Monte Carlo Simulations # using this function Calculate_demography(Silky_data)
# load Silky shark data produced by create_data_input() # Type `?create_data_input()` for details data("Silky_data") # run a single Leslie Matrix analysis with random draws from biological data # distributions. Use `Simulate_demography()` to run Monte Carlo Simulations # using this function Calculate_demography(Silky_data)
The demography functions in this package require a large amount of detailed life history information. This is provided to these functions as a multi-level list of various life history parameters with the class 'Demography.inputs'. This function creates the template for this input data which can be filled in after it is created.
create_data_input(maturity.type, t0 = FALSE)
create_data_input(maturity.type, t0 = FALSE)
maturity.type |
The type of maturity estimates from the source life history study. must be one of 'logistic - int/slope', 'logistic - a50/a95', 'normal' or 'uniform'. |
t0 |
Logical argument regarding whether the growth models included "t0" or "L0" as as a parameter. Default is 'FALSE' |
A multi-level list of the class 'Demography.inputs'
######----------- # Example code for Silky sharks ######----------- silky_data <- create_data_input("logistic - int/slope", t0 = FALSE) # Add growth data silky_data$`growth`$model.type <- "logistic" silky_data$growth$pars$Linf <- 268 silky_data$growth$pars$k <- 0.14 silky_data$growth$pars$L0 <- 82.7 silky_data$growth$se$Linf.se <- 5.8 silky_data$growth$se$k.se <- 0.006 silky_data$growth$se$L0.se <- 1.6 silky_data$growth$corr.matrix <- matrix(ncol = 3, nrow = 3, dimnames = list(c("Linf", "k", "L0"),c("Linf", "k", "L0")), data = c(1.0000000, -0.907188, 0.6233407, -0.9071881, 1.0000000, -0.8572509, 0.6233407,-0.857250, 1.0000000)) # Add maturity data silky_data$maturity$pars$intercept <- -15.90 silky_data$maturity$pars$slope <- 1.14 silky_data$maturity$se$intercept.se <- 2.78258 silky_data$maturity$se$slope.se <- 0.1971363 silky_data$maturity$corr.matrix <- matrix(ncol = 2, nrow = 2, dimnames = list(c("Intercept", "slope") ,c("Intercept", "slope")), data = c(1.0000000, -0.9922574, -0.9922574, 1.0000000)) # max age lower bound silky_data$max.age$min <- 28 # Add fecundity info silky_data$litter.size$mean <- 10 silky_data$litter.size$se <- 3 silky_data$gest.period <- 1 silky_data$repro.cycle <- 2 # Add TL conversions (if available and required) silky_data$Lt.type <- "TL" silky_data$Lt.to.Wt$model.type <- "PCL" silky_data$Lt.to.Wt$pars$a <- 2.73e-5 silky_data$Lt.to.Wt$pars$b <- 2.86 silky_data$convert.TL$model.type <- "PCL" silky_data$convert.TL$pars$a <- 2.08 silky_data$convert.TL$pars$b <- 1.32
######----------- # Example code for Silky sharks ######----------- silky_data <- create_data_input("logistic - int/slope", t0 = FALSE) # Add growth data silky_data$`growth`$model.type <- "logistic" silky_data$growth$pars$Linf <- 268 silky_data$growth$pars$k <- 0.14 silky_data$growth$pars$L0 <- 82.7 silky_data$growth$se$Linf.se <- 5.8 silky_data$growth$se$k.se <- 0.006 silky_data$growth$se$L0.se <- 1.6 silky_data$growth$corr.matrix <- matrix(ncol = 3, nrow = 3, dimnames = list(c("Linf", "k", "L0"),c("Linf", "k", "L0")), data = c(1.0000000, -0.907188, 0.6233407, -0.9071881, 1.0000000, -0.8572509, 0.6233407,-0.857250, 1.0000000)) # Add maturity data silky_data$maturity$pars$intercept <- -15.90 silky_data$maturity$pars$slope <- 1.14 silky_data$maturity$se$intercept.se <- 2.78258 silky_data$maturity$se$slope.se <- 0.1971363 silky_data$maturity$corr.matrix <- matrix(ncol = 2, nrow = 2, dimnames = list(c("Intercept", "slope") ,c("Intercept", "slope")), data = c(1.0000000, -0.9922574, -0.9922574, 1.0000000)) # max age lower bound silky_data$max.age$min <- 28 # Add fecundity info silky_data$litter.size$mean <- 10 silky_data$litter.size$se <- 3 silky_data$gest.period <- 1 silky_data$repro.cycle <- 2 # Add TL conversions (if available and required) silky_data$Lt.type <- "TL" silky_data$Lt.to.Wt$model.type <- "PCL" silky_data$Lt.to.Wt$pars$a <- 2.73e-5 silky_data$Lt.to.Wt$pars$b <- 2.86 silky_data$convert.TL$model.type <- "PCL" silky_data$convert.TL$pars$a <- 2.08 silky_data$convert.TL$pars$b <- 1.32
This function performs a Monte Carlo simulation analysis which determines the distributions of the left and right eigenvector. To facilitate this, maximum age is fixed as the minimum value + 20% for the species.
Estimate_eigenvectors(n = 1000, data, M.estimators = NULL)
Estimate_eigenvectors(n = 1000, data, M.estimators = NULL)
n |
The number of simulations to be run |
data |
A multi-level list of the class 'Demography.inputs' produced from the 'create_data_input' function and then manually completed. |
M.estimators |
Any specific natural mortality estimators to be included in the analysis. Must be a single estimator or a vector of estimators. These can include: "Pet.Wro", "Jensen.mat","Chen.Yuan","Then_hoenig","Then_pauly", "Jensen.mat","Charnov" or "Chen.Want". If none are specified then all applicable estimators could be chosen. |
A dataframe with the mean and 95% quantiles for each eigenvector for each age class
# load Silky shark data produced by create_data_input() # Type `?create_data_input()` for details data("Silky_data") # Run function to get Eigenvectors from Monte Carlo simulations for # all available natural mortality estimators. Set n = at least 1000 for full # analysis but use n = 100 for testing Estimate_eigenvectors(n = 100, Silky_data)
# load Silky shark data produced by create_data_input() # Type `?create_data_input()` for details data("Silky_data") # Run function to get Eigenvectors from Monte Carlo simulations for # all available natural mortality estimators. Set n = at least 1000 for full # analysis but use n = 100 for testing Estimate_eigenvectors(n = 100, Silky_data)
This function performs a Monte Carlo simulation analysis which determines the distributions of natural mortality (M) produced by each estimator.
Estimate_mortality_dists(n = 1000, data, M.estimators = NULL)
Estimate_mortality_dists(n = 1000, data, M.estimators = NULL)
n |
The number of simulations to be run |
data |
A multi-level list of the class 'Demography.inputs' produced from the 'create_data_input' function and then manually completed. |
M.estimators |
Any specific natural mortality estimators to be included in the analysis. Must be a single estimator or a vector of estimators. These can include: "Pet.Wro", "Jensen.mat","Chen.Yuan","Then_hoenig","Then_pauly", "Jensen.mat","Charnov" or "Chen.Want". If none are specified then all applicable estimators could be chosen. |
A list which includes a data.frame of the distributions age invariant estimators summarised as the mean and 95% quantiles and dataframes of any age dependent estimators with the mean and 95% quantiles for each age class
# load Silky shark data produced by create_data_input() # Type `?create_data_input()` for details data("Silky_data") # Run function to get natural mortality distributions from Monte Carlo # simulations for all available natural mortality estimators. # Set n = at least 1000 for full analysis but use n = 100 for testing Estimate_mortality_dists(n = 100, Silky_data)
# load Silky shark data produced by create_data_input() # Type `?create_data_input()` for details data("Silky_data") # Run function to get natural mortality distributions from Monte Carlo # simulations for all available natural mortality estimators. # Set n = at least 1000 for full analysis but use n = 100 for testing Estimate_mortality_dists(n = 100, Silky_data)
A package to conduct Shark demographic analyses using Leslie matrix models.
Jonathan Smart
An example dataset of a completed set of life history data for Silky Sharks in a 'create_data_input()' template.
data(Silky_data)
data(Silky_data)
A list of 10 with class "Demography.inputs"
This is a wrapper function for 'Calculate_demography' which runs this function the specified number of times using a range of F and Age-at-first-capture (AAFC) values
Simulate_AAFC(n = 1000, .data, M.estimators = NULL, max.AAFC = 15, n_cores = 1)
Simulate_AAFC(n = 1000, .data, M.estimators = NULL, max.AAFC = 15, n_cores = 1)
n |
The number of simulations to be run. 1000 is recomended but smaller numbers should be run when testing to avoid long run times. |
.data |
A multi-level list of the class 'Demography.inputs' produced from the 'create_data_input' function and then manually completed. |
M.estimators |
Any specific natural mortality estimators to be included in the analysis. Only one will be used in each run which is randomly selected. Must be a single estimator or a vector of estimators. These can include: "Pet.Wro","Jensen.mat","Chen.Yuan", "Then_hoenig","Then_pauly", "Jensen.mat","Charnov" or "Chen.Want". If none are specified then all applicable estimators could be chosen. |
max.AAFC |
The maximum Age class to be run in the analyses. This does not need to be the maximum age for the population and keeping this number reasonable reduces run-time. |
n_cores |
The number of cores to be used for parallel processing. It should be 1 core less than the maximum number available. |
A list with two data.frames. The first provides Fcritical values for each age class. This is the value of F where the population growth rate is stable (lambda = 1). The second dataframe is the mean lambda produced for each combination of AAFC and F
# load Silky shark data produced by create_data_input() # Type `?create_data_input()` for details data("Silky_data") # Run function to get conduct an age-at-first-capture (AAFC) analysis using # Monte Carlo Simulations using for all available natural mortality estimators. # Set n = at least 1000 for full analysis but use n = 10 for testing given long run times Simulate_AAFC(n = 10, Silky_data, n_cores = 1)
# load Silky shark data produced by create_data_input() # Type `?create_data_input()` for details data("Silky_data") # Run function to get conduct an age-at-first-capture (AAFC) analysis using # Monte Carlo Simulations using for all available natural mortality estimators. # Set n = at least 1000 for full analysis but use n = 10 for testing given long run times Simulate_AAFC(n = 10, Silky_data, n_cores = 1)
This is a wrapper function for 'Calculate_demography' which runs this function the specified number of times using a range of F and Age-at-last-capture (AALC) values
Simulate_AALC(n = 1000, data, M.estimators = NULL, min.AALC = 15, n_cores = 1)
Simulate_AALC(n = 1000, data, M.estimators = NULL, min.AALC = 15, n_cores = 1)
n |
The number of simulations to be run. 1000 is recomended but smaller numbers should be run when testing to avoid long run times. |
data |
A multi-level list of the class 'Demography.inputs' produced from the 'create_data_input' function and then manually completed. |
M.estimators |
Any specific natural mortality estimators to be included in the analysis. Only one will be used in each run which is randomly selected. Must be a single estimator or a vector of estimators. These can include: "Pet.Wro","Jensen.mat","Chen.Yuan", "Then_hoenig","Then_pauly", "Jensen.mat","Charnov" or "Chen.Want". If none are specified then all applicable estimators could be chosen. |
min.AALC |
The last Age class to be run in the analyses. This does not need to be the maximum age for the population and keeping this number reasonable reduces run-time. |
n_cores |
The number of cores to be used for parallel processing. It should be 1 core less than the maximum number available. |
A list with two data.frames. The first provides Fcritical values for each age class. This is the value of F where the population growth rate is stable (lambda = 1). The second dataframe is the mean lambda produced for each combination of AALC and F
# load Silky shark data produced by create_data_input() # Type `?create_data_input()` for details data("Silky_data") # Run function to get conduct an age-at-last-capture (AALC) analysis using # Monte Carlo Simulations using for all available natural mortality estimators. # Set n = at least 1000 for full analysis but use n = 10 for testing given long run times Simulate_AALC(n = 10, Silky_data, n_cores = 1)
# load Silky shark data produced by create_data_input() # Type `?create_data_input()` for details data("Silky_data") # Run function to get conduct an age-at-last-capture (AALC) analysis using # Monte Carlo Simulations using for all available natural mortality estimators. # Set n = at least 1000 for full analysis but use n = 10 for testing given long run times Simulate_AALC(n = 10, Silky_data, n_cores = 1)
This is a wrapper function for 'Calculate_demography' which runs this function the specified number of times.
Simulate_demography( n, data, AALC = NULL, AAFC = NULL, F. = 0, M.estimators = NULL, Verbatim = TRUE )
Simulate_demography( n, data, AALC = NULL, AAFC = NULL, F. = 0, M.estimators = NULL, Verbatim = TRUE )
n |
The number of specified Monte Carlo simulations to run |
data |
A multi-level list of the class 'Demography.inputs' produced from the 'create_data_input' function and then manually completed. |
AALC |
Age-at-last-capture which can be specified by the user. Must be an integer age which can include zero. |
AAFC |
Age-at-first-capture which can be specified by the user.Must be an integer age which can include zero to indicate the availability of the population to capture from birth. |
F. |
The instantaneous rate of fishing mortality 'F'. This will be applied to all ages available to capture as defined by either the AALC or AAFC arguments. |
M.estimators |
Any specific natural mortality estimators to be included in the analysis. Only one will be used in each run which is randomly selected. Must be a single estimator or a vector of estimators. These can include: "Pet.Wro","Jensen.mat","Chen.Yuan", "Then_hoenig","Then_pauly", "Jensen.mat","Charnov" or "Chen.Want". If none are specified then all applicable estimators could be chosen. |
Verbatim |
Print summary results to screen if TRUE. When FALSE, the progress bar is also disabled. |
A list with two data.frames. The first is the summary of the Monte Carlo simulations for all parameters calculated by the 'Calculate_demography' function with mean and 95% quantiles. The second is all of the results for each parameter from individual simulations so that their distributions can be interrogated further.
# load Silky shark data produced by create_data_input() # Type `?create_data_input()` for details data("Silky_data") # Run function to get conduct Monte Carlo Simulations using # `Calculate_demography()` for all available natural mortality estimators. # Set n = at least 1000 for full analysis but use n = 100 for testing Simulate_demography(n = 100, Silky_data)
# load Silky shark data produced by create_data_input() # Type `?create_data_input()` for details data("Silky_data") # Run function to get conduct Monte Carlo Simulations using # `Calculate_demography()` for all available natural mortality estimators. # Set n = at least 1000 for full analysis but use n = 100 for testing Simulate_demography(n = 100, Silky_data)
This is a wrapper function for 'Calculate_demography' which runs this function the specified number of times using a range of F values accross the enture age range of the population. This determines the rate of population increase at each increment of F.
Simulate_F_critical( n = 1000, .data, M.estimators = NULL, max.F = 0.3, n_cores = 1 )
Simulate_F_critical( n = 1000, .data, M.estimators = NULL, max.F = 0.3, n_cores = 1 )
n |
The number of simulations to be run. 1000 is recomended but smaller numbers should be run when testing to avoid long run times. |
.data |
A multi-level list of the class 'Demography.inputs' produced from the 'create_data_input' function and then manually completed. |
M.estimators |
Any specific natural mortality estimators to be included in the analysis. Only one will be used in each run which is randomly selected. Must be a single estimator or a vector of estimators. These can include: "Pet.Wro","Jensen.mat","Chen.Yuan", "Then_hoenig","Then_pauly", "Jensen.mat","Charnov" or "Chen.Want". If none are specified then all applicable estimators could be chosen. |
max.F |
The maximum value of F for simulations |
n_cores |
The number of cores to be used for parallel processing. It should be 1 core less than the maximum number available. |
A list with two data.frames. The first provides the mean F critical with 95% confidence intervals. The second dataframe provides the rate of increase for each increment of F.
# load Silky shark data produced by create_data_input() # Type `?create_data_input()` for details data("Silky_data") # Run function to get conduct an F critical analysis using # Monte Carlo Simulations using for all available natural mortality estimators. # Set n = at least 1000 for full analysis but use n = 10 for testing given long run times Simulate_F_critical(n = 10, Silky_data, n_cores = 1)
# load Silky shark data produced by create_data_input() # Type `?create_data_input()` for details data("Silky_data") # Run function to get conduct an F critical analysis using # Monte Carlo Simulations using for all available natural mortality estimators. # Set n = at least 1000 for full analysis but use n = 10 for testing given long run times Simulate_F_critical(n = 10, Silky_data, n_cores = 1)
This is a wrapper function for 'Calculate_demography' which runs this function using different values of AAFC, AALC and F to simulate Havest Slot options. The Fcritical is retuned for each simulation to show the max level of F needed to sustain a stable population.
Simulate_harvest_slots( n, data, M.estimators = NULL, Age.mid.point = NULL, HS.width = NULL, max.F = 1 )
Simulate_harvest_slots( n, data, M.estimators = NULL, Age.mid.point = NULL, HS.width = NULL, max.F = 1 )
n |
number of iterations for each combination of Age.mid.point, HS.width and F. |
data |
A multi-level list of the class 'Demography.inputs' produced from the 'create_data_input' function and then manually completed. |
M.estimators |
Any specific natural mortality estimators to be included in the analysis. Only one will be used in each run which is randomly selected. Must be a single estimator or a vector of estimators. These can include: "Pet.Wro","Jensen.mat","Chen.Yuan", "Then_hoenig","Then_pauly", "Jensen.mat","Charnov" or "Chen.Want". If none are specified then all applicable estimators could be chosen. |
Age.mid.point |
A vector of ages to be used in the simulation. Each age is used as a mid point and will have HS.Width subtracted and added to it to determine AAFC and AALC, respectively. |
HS.width |
A vector of widths for the Harvest slots in years. Widths are subtracted and added to mid points to determine the AAFC and AALC in each sim. |
max.F |
The maximum value of F for simulations |
A data.frame with three columns: MinAge, MaxAge and 'F.'. These represent the age at the start of a harvest slot, the age at the end of the harvest slot and the F for that harvest slot.
# load Silky shark data produced by create_data_input() # Type `?create_data_input()` for details data("Silky_data") # Run function to get conduct an F critical analysis for different harvest slots using # Monte Carlo Simulations using for all available natural mortality estimators. # Set n = at least 1000 for full analysis but use n = 10 for testing given long run times Simulate_harvest_slots(n = 10, Silky_data,Age.mid.point = 0:28, HS.width = 0:8)
# load Silky shark data produced by create_data_input() # Type `?create_data_input()` for details data("Silky_data") # Run function to get conduct an F critical analysis for different harvest slots using # Monte Carlo Simulations using for all available natural mortality estimators. # Set n = at least 1000 for full analysis but use n = 10 for testing given long run times Simulate_harvest_slots(n = 10, Silky_data,Age.mid.point = 0:28, HS.width = 0:8)