Title: | Length-Based Multispecies Analysis by Numerical Simulation |
---|---|
Description: | Set up, run and explore the outputs of the Length-based Multi-species model (LeMans; Hall et al. 2006 <doi:10.1139/f06-039>), focused on the marine environment. |
Authors: | Michael A. Spence [aut, cre] , Hayley J. Bannister [aut] , Johnathan E. Ball [aut], Paul J. Dolder [aut] , Robert B. Thorpe [aut] , Christopher A. Griffiths [ctb] |
Maintainer: | Michael A. Spence <[email protected]> |
License: | GPL-3 |
Version: | 0.1.2 |
Built: | 2024-11-06 04:11:37 UTC |
Source: | https://github.com/cran/LeMaRns |
Calculates the number of individuals of each species in each length class for the next time step.
calc_growth(N, phi, nfish, nsc)
calc_growth(N, phi, nfish, nsc)
N |
A matrix with dimensions |
phi |
A matrix with dimensions |
nfish |
A numeric value representing the number of species in the model. |
nsc |
A numeric value representing the number of length classes in the model. |
A matrix with dimensions nsc
and nfish
representing the number of individuals of each species in each length class for the next time step.
# Set up the inputs to the function - species-independent parameters nfish <- nrow(NS_par) nsc <- 32 maxsize <- max(NS_par$Linf) * 1.01 # the biggest size is 1% bigger than the largest Linf l_bound <- seq(0, maxsize, maxsize/nsc); l_bound <- l_bound[-length(l_bound)] u_bound <- seq(maxsize/nsc, maxsize, maxsize/nsc) mid <- l_bound+(u_bound-l_bound)/2 # Set up the inputs to the function - species-specific parameters Linf <- NS_par$Linf # the von-Bertalanffy asymptotic length of each species (cm). W_a <- NS_par$W_a # length-weight conversion parameter. W_b <- NS_par$W_b # length-weight conversion parameter. k <- NS_par$k # the von-Bertalnaffy growth parameter. Lmat <- NS_par$Lmat # the length at which 50\% of individuals are mature (cm). # Get phi_min tmp <- calc_phi(k, Linf, nsc, nfish, u_bound, l_bound, calc_phi_min=FALSE, phi_min=0.1) # fixed phi_min phi <- tmp$phi phi_min <- tmp$phi_min # Calculate growth increments tmp <- calc_ration_growthfac(k, Linf, nsc, nfish, l_bound, u_bound, mid, W_a, W_b, phi_min) sc_Linf <- tmp$sc_Linf wgt <- tmp$wgt # Get an initial population N0 <- get_N0(nsc, nfish, mid, wgt, sc_Linf, intercept=1e10, slope=-5) # Calculate growth growth <- calc_growth(N0, phi, nfish, nsc)
# Set up the inputs to the function - species-independent parameters nfish <- nrow(NS_par) nsc <- 32 maxsize <- max(NS_par$Linf) * 1.01 # the biggest size is 1% bigger than the largest Linf l_bound <- seq(0, maxsize, maxsize/nsc); l_bound <- l_bound[-length(l_bound)] u_bound <- seq(maxsize/nsc, maxsize, maxsize/nsc) mid <- l_bound+(u_bound-l_bound)/2 # Set up the inputs to the function - species-specific parameters Linf <- NS_par$Linf # the von-Bertalanffy asymptotic length of each species (cm). W_a <- NS_par$W_a # length-weight conversion parameter. W_b <- NS_par$W_b # length-weight conversion parameter. k <- NS_par$k # the von-Bertalnaffy growth parameter. Lmat <- NS_par$Lmat # the length at which 50\% of individuals are mature (cm). # Get phi_min tmp <- calc_phi(k, Linf, nsc, nfish, u_bound, l_bound, calc_phi_min=FALSE, phi_min=0.1) # fixed phi_min phi <- tmp$phi phi_min <- tmp$phi_min # Calculate growth increments tmp <- calc_ration_growthfac(k, Linf, nsc, nfish, l_bound, u_bound, mid, W_a, W_b, phi_min) sc_Linf <- tmp$sc_Linf wgt <- tmp$wgt # Get an initial population N0 <- get_N0(nsc, nfish, mid, wgt, sc_Linf, intercept=1e10, slope=-5) # Calculate growth growth <- calc_growth(N0, phi, nfish, nsc)
Calculates the Large Fish Indicator (LFI), Typical Length (TyL) or Length Quantile (LQ) for the community or a subset of the species.
calc_LFI(wgt, N, bry, prop) calc_LQ(wgt, u_bound, N, prob) calc_TyL(wgt, mid, N)
calc_LFI(wgt, N, bry, prop) calc_LQ(wgt, u_bound, N, prob) calc_TyL(wgt, mid, N)
wgt |
A matrix with dimensions |
N |
A matrix with dimensions |
bry |
A numeric vector representing the length classes that are larger than |
prop |
A numeric value between 0 and 1 representing how far along, as a proportion, the value of the large indicator threshold is in the length class that contains it. |
u_bound |
A numeric vector of length |
prob |
A numeric value or vector between 0 and 1 denoting the LQ to be calculated. |
mid |
A numeric vector of length |
calc_LFI
returns a numeric value or vector representing the proportion of the biomass in the length classes above bry
and in prop
of the biomass in the length class bry
.
calc_TYL
returns a numeric value or vector representing the biomass-weighted geometric mean length of the community.
calc_LQ
returns a numeric value or vector representing the length at which biomass exceeds a given proportion prob
of the total biomass.
# Set up and run the model NS_params <- LeMansParam(NS_par, tau=NS_tau, eta=rep(0.25, 21), L50=NS_par$Lmat, other=1e11) effort <- matrix(0.5, 10, dim(NS_params@Qs)[3]) model_run <- run_LeMans(NS_params, years=10, effort=effort) # Calculate the LFI for 40cm bry <- which(NS_params@l_bound<=40 & NS_params@u_bound>40) length_LFI <- 40 prop <- (length_LFI-NS_params@l_bound[bry])/(NS_params@u_bound[bry]-NS_params@l_bound[bry]) LFI <- calc_LFI(model_run@N[,,101], NS_params@wgt, bry, prop) # Calculate TyL for the final time step calc_TyL(wgt=NS_params@wgt, mid=NS_params@mid, N=model_run@N[,,101]) # Calculate the LQ for the final time step calc_LQ(wgt=NS_params@wgt, u_bound=NS_params@u_bound, N=model_run@N[,,101], prob=0.5)
# Set up and run the model NS_params <- LeMansParam(NS_par, tau=NS_tau, eta=rep(0.25, 21), L50=NS_par$Lmat, other=1e11) effort <- matrix(0.5, 10, dim(NS_params@Qs)[3]) model_run <- run_LeMans(NS_params, years=10, effort=effort) # Calculate the LFI for 40cm bry <- which(NS_params@l_bound<=40 & NS_params@u_bound>40) length_LFI <- 40 prop <- (length_LFI-NS_params@l_bound[bry])/(NS_params@u_bound[bry]-NS_params@l_bound[bry]) LFI <- calc_LFI(model_run@N[,,101], NS_params@wgt, bry, prop) # Calculate TyL for the final time step calc_TyL(wgt=NS_params@wgt, mid=NS_params@mid, N=model_run@N[,,101]) # Calculate the LQ for the final time step calc_LQ(wgt=NS_params@wgt, u_bound=NS_params@u_bound, N=model_run@N[,,101], prob=0.5)
Calculates the background mortality of each species in each length class per time step.
calc_M1( nsc, sc_Linf, phi_min, natmort_opt = rep("std_RNM", length(sc_Linf)), Nmort = rep(0.8, length(sc_Linf)), prop = rep(0.75, length(sc_Linf)) ) get_M1(nsc, sc_Linf, natmort_opt, Nmort, prop) calc_M1_stdRNM(nsc, sc_Linf, Nmort = 0.8, prop = 0.75) calc_M1_lin(nsc, sc_Linf, Nmort = 0.8) calc_M1_constRNM(nsc, sc_Linf, Nmort = 0.8)
calc_M1( nsc, sc_Linf, phi_min, natmort_opt = rep("std_RNM", length(sc_Linf)), Nmort = rep(0.8, length(sc_Linf)), prop = rep(0.75, length(sc_Linf)) ) get_M1(nsc, sc_Linf, natmort_opt, Nmort, prop) calc_M1_stdRNM(nsc, sc_Linf, Nmort = 0.8, prop = 0.75) calc_M1_lin(nsc, sc_Linf, Nmort = 0.8) calc_M1_constRNM(nsc, sc_Linf, Nmort = 0.8)
nsc |
A numeric value representing the number of length classes in the model. |
sc_Linf |
A numeric vector of length |
phi_min |
A numeric value representing the time step of the model. |
natmort_opt |
A character vector of length |
Nmort |
A numeric vector of length |
prop |
A numeric vector of length |
The background mortality is defined as the number of individuals that die per year, but not from predation or fishing
N*exp(-M1)
where N
is the total number of individuals. This function allows three different models for background mortality: (1) "constant"
, which gives M1=Nmort
for all length classes up to and including the sc_Linf
-th class; (2) "std_RNM"
, which gives M1=Nmort
for all length classes between floor(sc_Linf*prop)
and the sc_Linf
-th class and M1=0
for the rest; and (3) "linear"
, which gives M1=0
for the first length class, followed by a linear increase in M1
up to and including the sc_Linf
-th length class M1=Nmort
and M1=0
for the rest.
calc_M1
returns a matrix of dimensions nsc
and nfish
representing the background mortality of each species for each length class.
get_M1
returns a numeric vector of length nsc
representing the background mortality for each length class.
calc_M1_stdRNM
returns a numeric vector of length nsc
representing the background mortality for each length class. M1=Nmort
for all length classes between floor(sc_Linf*prop)
and the sc_Linf
-th class and M1=0
for the rest.
calc_M1_lin
returns a numeric vector of length nsc
representing the background mortality for each length class. M1=0
for the first length class. M1
then increases linearly up to and including the sc_Linf
-th length class. For all length classes above sc_Linf
, M1=0
.
calc_M1_constRNM
returns a numeric vector of length nsc
representing the background mortality for each length class. M1=Nmort
for all length classes up to and including the sc_Linf
-th class. For all length classes above sc_Linf
, M1=0
.
Thorpe, R.B., Jennings, S., Dolder, P.J. (2017). Risks and benefits of catching pretty good yield in multispecies mixed fisheries. ICES Journal of Marine Science, 74(8):2097-2106.
# Set up the inputs to the function - species-independent parameters nfish <- nrow(NS_par) nsc <- 32 maxsize <- max(NS_par$Linf)*1.01 # the biggest size is 1% bigger than the largest Linf l_bound <- seq(0, maxsize, maxsize/nsc); l_bound <- l_bound[-length(l_bound)] u_bound <- seq(maxsize/nsc, maxsize, maxsize/nsc) mid <- l_bound+(u_bound-l_bound)/2 # Set up the inputs to the function - species-specific parameters Linf <- NS_par$Linf # the von-Bertalanffy asymptotic length of each species (cm). W_a <- NS_par$W_a # length-weight conversion parameter. W_b <- NS_par$W_b # length-weight conversion parameter. k <- NS_par$k # the von-Bertalnaffy growth parameter. Lmat <- NS_par$Lmat # the length at which 50\% of individuals are mature (cm). # Get phi_min tmp <- calc_phi(k, Linf, nsc, nfish, u_bound, l_bound, calc_phi_min=FALSE, phi_min=0.1) # fixed phi_min phi_min <- tmp$phi_min # Calculate growth increments tmp <- calc_ration_growthfac(k, Linf, nsc, nfish, l_bound, u_bound, mid, W_a, W_b, phi_min) sc_Linf <- tmp$sc_Linf # Calculate background mortality with natmort_opt="std_RNM", Nmort=0.8 and prop=0.75 for all species M1 <- calc_M1(nsc, sc_Linf, phi_min) # Get background mortality with natmort_opt="std_RNM", Nmort=0.8 and prop=0.75 for all species natmort_opt <- "std_RNM" Nmort <- 0.8 prop <- 0.75 get_M1(nsc, sc_Linf, natmort_opt, Nmort, prop) # Calculate standard residual background mortality M1_stdRNM <- calc_M1_stdRNM(nsc, sc_Linf) # Calculate linear background mortality M1_lin <- calc_M1_lin(nsc, sc_Linf,Nmort=0.3) # Calculate constant residual background mortality M1_constRNM <- calc_M1_constRNM(nsc, sc_Linf)
# Set up the inputs to the function - species-independent parameters nfish <- nrow(NS_par) nsc <- 32 maxsize <- max(NS_par$Linf)*1.01 # the biggest size is 1% bigger than the largest Linf l_bound <- seq(0, maxsize, maxsize/nsc); l_bound <- l_bound[-length(l_bound)] u_bound <- seq(maxsize/nsc, maxsize, maxsize/nsc) mid <- l_bound+(u_bound-l_bound)/2 # Set up the inputs to the function - species-specific parameters Linf <- NS_par$Linf # the von-Bertalanffy asymptotic length of each species (cm). W_a <- NS_par$W_a # length-weight conversion parameter. W_b <- NS_par$W_b # length-weight conversion parameter. k <- NS_par$k # the von-Bertalnaffy growth parameter. Lmat <- NS_par$Lmat # the length at which 50\% of individuals are mature (cm). # Get phi_min tmp <- calc_phi(k, Linf, nsc, nfish, u_bound, l_bound, calc_phi_min=FALSE, phi_min=0.1) # fixed phi_min phi_min <- tmp$phi_min # Calculate growth increments tmp <- calc_ration_growthfac(k, Linf, nsc, nfish, l_bound, u_bound, mid, W_a, W_b, phi_min) sc_Linf <- tmp$sc_Linf # Calculate background mortality with natmort_opt="std_RNM", Nmort=0.8 and prop=0.75 for all species M1 <- calc_M1(nsc, sc_Linf, phi_min) # Get background mortality with natmort_opt="std_RNM", Nmort=0.8 and prop=0.75 for all species natmort_opt <- "std_RNM" Nmort <- 0.8 prop <- 0.75 get_M1(nsc, sc_Linf, natmort_opt, Nmort, prop) # Calculate standard residual background mortality M1_stdRNM <- calc_M1_stdRNM(nsc, sc_Linf) # Calculate linear background mortality M1_lin <- calc_M1_lin(nsc, sc_Linf,Nmort=0.3) # Calculate constant residual background mortality M1_constRNM <- calc_M1_constRNM(nsc, sc_Linf)
Calculates the predation mortality for each species in each length class.
calc_M2(N, ration, wgt, nfish, nsc, other, sc_Linf, suit_M2)
calc_M2(N, ration, wgt, nfish, nsc, other, sc_Linf, suit_M2)
N |
A matrix with dimensions |
ration |
A matrix with dimensions |
wgt |
A matrix with dimensions |
nfish |
A numeric value representing the number of species in the model. |
nsc |
A numeric value representing the number of length classes in the model. |
other |
A numeric value representing the amount of other food (g) available from prey that is not explicitly represented in the model. |
sc_Linf |
A numeric vector of length |
suit_M2 |
A list object of length |
The predation mortality of the i
th species in the j
th length class is
sum_m(sum_n(I[j,i]*N[j,i]*suit_M2[[m]][n,j,i]/
(sum_k(sum_l(suit_M2[[m]][n,l,k]wgt[l,k]N[l,k]))+other)))
where sum_m
represents the sum over all m
, sum_n
represents the sum over all n
, sum_l
represents the sum over all l
and sum_k
represents the sum over all k
. This equation corresponds to a Holling type-II functional response. See equation 8 of Hall et al. (2006) for more details.
A matrix with dimensions nsc
and nfish
representing the the predation mortality for each species in each length class.
Hall, S. J., Collie, J. S., Duplisea, D. E., Jennings, S., Bravington, M., & Link, J. (2006). A length-based multispecies model for evaluating community responses to fishing. Canadian Journal of Fisheries and Aquatic Sciences, 63(6):1344-1359.
# Set up the inputs to the function - species-independent parameters nfish <- nrow(NS_par) nsc <- 32 maxsize <- max(NS_par$Linf)*1.01 # the biggest size is 1% bigger than the largest Linf l_bound <- seq(0, maxsize, maxsize/nsc); l_bound <- l_bound[-length(l_bound)] u_bound <- seq(maxsize/nsc, maxsize, maxsize/nsc) mid <- l_bound+(u_bound-l_bound)/2 # Set up the inputs to the function - species-specific parameters Linf <- NS_par$Linf # the von-Bertalanffy asymptotic length of each species (cm). W_a <- NS_par$W_a # length-weight conversion parameter. W_b <- NS_par$W_b # length-weight conversion parameter. k <- NS_par$k # the von-Bertalnaffy growth parameter. Lmat <- NS_par$Lmat # the length at which 50\% of individuals are mature (cm). # Get phi_min tmp <- calc_phi(k, Linf, nsc, nfish, u_bound, l_bound, calc_phi_min=FALSE, phi_min=0.1) # fixed phi_min phi <- tmp$phi phi_min <- tmp$phi_min # Calculate growth increments tmp <- calc_ration_growthfac(k, Linf, nsc, nfish, l_bound, u_bound, mid, W_a, W_b, phi_min) ration <- tmp$ration sc_Linf <- tmp$sc_Linf wgt <- tmp$wgt g_eff <- tmp$g_eff # Calculate predator-prey size preferences prefs <- calc_prefs(pred_mu=-2.25, pred_sigma=0.5, wgt, sc_Linf) # Calculate prey preference and prey suitability suit_M2 <- calc_suit_vect(nsc, nfish, sc_Linf, prefs, NS_tau) # Get an initial population N0 <- get_N0(nsc, nfish, mid, wgt, sc_Linf, intercept=1e10, slope=-5) # Calculate the predation mortality M2 <- calc_M2(N0, ration, wgt, nfish, nsc, other=1e12, sc_Linf, suit_M2)
# Set up the inputs to the function - species-independent parameters nfish <- nrow(NS_par) nsc <- 32 maxsize <- max(NS_par$Linf)*1.01 # the biggest size is 1% bigger than the largest Linf l_bound <- seq(0, maxsize, maxsize/nsc); l_bound <- l_bound[-length(l_bound)] u_bound <- seq(maxsize/nsc, maxsize, maxsize/nsc) mid <- l_bound+(u_bound-l_bound)/2 # Set up the inputs to the function - species-specific parameters Linf <- NS_par$Linf # the von-Bertalanffy asymptotic length of each species (cm). W_a <- NS_par$W_a # length-weight conversion parameter. W_b <- NS_par$W_b # length-weight conversion parameter. k <- NS_par$k # the von-Bertalnaffy growth parameter. Lmat <- NS_par$Lmat # the length at which 50\% of individuals are mature (cm). # Get phi_min tmp <- calc_phi(k, Linf, nsc, nfish, u_bound, l_bound, calc_phi_min=FALSE, phi_min=0.1) # fixed phi_min phi <- tmp$phi phi_min <- tmp$phi_min # Calculate growth increments tmp <- calc_ration_growthfac(k, Linf, nsc, nfish, l_bound, u_bound, mid, W_a, W_b, phi_min) ration <- tmp$ration sc_Linf <- tmp$sc_Linf wgt <- tmp$wgt g_eff <- tmp$g_eff # Calculate predator-prey size preferences prefs <- calc_prefs(pred_mu=-2.25, pred_sigma=0.5, wgt, sc_Linf) # Calculate prey preference and prey suitability suit_M2 <- calc_suit_vect(nsc, nfish, sc_Linf, prefs, NS_tau) # Get an initial population N0 <- get_N0(nsc, nfish, mid, wgt, sc_Linf, intercept=1e10, slope=-5) # Calculate the predation mortality M2 <- calc_M2(N0, ration, wgt, nfish, nsc, other=1e12, sc_Linf, suit_M2)
Calculates the proportion of individuals that are mature for each species and length class.
calc_mature(Lmat, nfish, mid, kappa, sc_Linf, eps = 1e-05, force_mature = TRUE)
calc_mature(Lmat, nfish, mid, kappa, sc_Linf, eps = 1e-05, force_mature = TRUE)
Lmat |
A numeric vector of length |
nfish |
A numeric value representing the number of species in the model. |
mid |
A numeric vector of length |
kappa |
A numeric vector of length |
sc_Linf |
A numeric vector of length |
eps |
A numeric value specifying a numerical offset. The default is |
force_mature |
A logical statement indicating whether to force all fish in the largest length class to be mature. The default is |
The proportion of individuals in the j
th length class of the i
th species that are mature is described by a logistic model
1/(1+exp(-kappa[i]*(mid[j]-Lmat[i])))
A matrix with dimensions nsc
and nfish
and elements in the range 0-1 representing the proportion of individuals that are mature for each species and length class.
Hall, S. J., Collie, J. S., Duplisea, D. E., Jennings, S., Bravington, M., & Link, J. (2006). A length-based multispecies model for evaluating community responses to fishing. Canadian Journal of Fisheries and Aquatic Sciences, 63(6):1344-1359.
# Set up the inputs to the function - species-independent parameters nfish <- nrow(NS_par) nsc <- 32 maxsize <- max(NS_par$Linf)*1.01 # the biggest size is 1% bigger than the largest Linf l_bound <- seq(0, maxsize, maxsize/nsc); l_bound <- l_bound[-length(l_bound)] u_bound <- seq(maxsize/nsc, maxsize, maxsize/nsc) mid <- l_bound+(u_bound-l_bound)/2 # Set up the inputs to the function - species-specific parameters Linf <- NS_par$Linf # the von-Bertalanffy asymptotic length of each species (cm). W_a <- NS_par$W_a # length-weight conversion parameter. W_b <- NS_par$W_b # length-weight conversion parameter. k <- NS_par$k # the von-Bertalnaffy growth parameter. Lmat <- NS_par$Lmat # the length at which 50\% of individuals are mature (cm). # Get phi_min tmp <- calc_phi(k, Linf, nsc, nfish, u_bound, l_bound, calc_phi_min=FALSE, phi_min=0.1) # fixed phi_min phi <- tmp$phi phi_min <- tmp$phi_min # Calculate growth increments tmp <- calc_ration_growthfac(k, Linf, nsc, nfish, l_bound, u_bound, mid, W_a, W_b, phi_min) sc_Linf <- tmp$sc_Linf # Calculate the proportion of mature individuals mature <- calc_mature(Lmat, nfish, mid, kappa=rep(10, nfish), sc_Linf)
# Set up the inputs to the function - species-independent parameters nfish <- nrow(NS_par) nsc <- 32 maxsize <- max(NS_par$Linf)*1.01 # the biggest size is 1% bigger than the largest Linf l_bound <- seq(0, maxsize, maxsize/nsc); l_bound <- l_bound[-length(l_bound)] u_bound <- seq(maxsize/nsc, maxsize, maxsize/nsc) mid <- l_bound+(u_bound-l_bound)/2 # Set up the inputs to the function - species-specific parameters Linf <- NS_par$Linf # the von-Bertalanffy asymptotic length of each species (cm). W_a <- NS_par$W_a # length-weight conversion parameter. W_b <- NS_par$W_b # length-weight conversion parameter. k <- NS_par$k # the von-Bertalnaffy growth parameter. Lmat <- NS_par$Lmat # the length at which 50\% of individuals are mature (cm). # Get phi_min tmp <- calc_phi(k, Linf, nsc, nfish, u_bound, l_bound, calc_phi_min=FALSE, phi_min=0.1) # fixed phi_min phi <- tmp$phi phi_min <- tmp$phi_min # Calculate growth increments tmp <- calc_ration_growthfac(k, Linf, nsc, nfish, l_bound, u_bound, mid, W_a, W_b, phi_min) sc_Linf <- tmp$sc_Linf # Calculate the proportion of mature individuals mature <- calc_mature(Lmat, nfish, mid, kappa=rep(10, nfish), sc_Linf)
Calculate the proportion of individuals of each species that leave each length class at each time step.
calc_phi( k, Linf, nsc, nfish, u_bound, l_bound, calc_phi_min = FALSE, phi_min = 0.1 )
calc_phi( k, Linf, nsc, nfish, u_bound, l_bound, calc_phi_min = FALSE, phi_min = 0.1 )
k |
A numeric vector of length |
Linf |
A numeric vector of length |
nsc |
A numeric value representing the number of length classes in the model. |
nfish |
A numeric value representing the number of species in the model. |
u_bound |
A numeric vector of length |
l_bound |
A numeric vector of length |
calc_phi_min |
A logical statement indicating whether |
phi_min |
A fixed numeric value of |
Calculates the time (yrs) for an average fish to grow from the lower to the upper bound of a length class assuming von Bertalanffy growth. The values are scaled to the fastest growing fish and length class combination in order to calculate the proportion of individuals leaving each length class in a time step.
A list object containing phi
and phi_min
. phi
is a matrix of dimensions nsc
and nfish
representing the proportion of individuals of each species that leave each length class. phi_min
is a numeric value representing the time step of the model.
Hilborn, R. & Walters, C.J. (1992). Quantitative Fisheries Stock Assessment. Springer.
von Bertalanffy, L. (1957). Quantitative Laws in Metabolism and Growth. The Quarterly Review of Biology, 32:217-231.
# Set up the inputs to the function - species-independent parameters nfish <- nrow(NS_par) nsc <- 32 maxsize <- max(NS_par$Linf)*1.01 # the biggest size is 1% bigger than the largest Linf l_bound <- seq(0, maxsize, maxsize/nsc); l_bound <- l_bound[-length(l_bound)] u_bound <- seq(maxsize/nsc, maxsize, maxsize/nsc) mid <- l_bound+(u_bound-l_bound)/2 # Set up the inputs to the function - species-specific parameters Linf <- NS_par$Linf # the von-Bertalanffy asymptotic length of each species (cm). W_a <- NS_par$W_a # length-weight conversion parameter. W_b <- NS_par$W_b # length-weight conversion parameter. k <- NS_par$k # the von-Bertalnaffy growth parameter. Lmat <- NS_par$Lmat # the length at which 50\% of individuals are mature (cm). # Calculate the proportion of individuals that leave each length class # with and without a fixed value for phi_min tmp <- calc_phi(k, Linf, nsc, nfish, u_bound, l_bound, calc_phi_min=FALSE, phi_min=0.1) # fixed phi_min phi <- tmp$phi phi_min <- tmp$phi_min tmp <- calc_phi(k, Linf, nsc, nfish, u_bound, l_bound, calc_phi_min=TRUE) # without fixed phi_min phi <- tmp$phi phi_min <- tmp$phi_min
# Set up the inputs to the function - species-independent parameters nfish <- nrow(NS_par) nsc <- 32 maxsize <- max(NS_par$Linf)*1.01 # the biggest size is 1% bigger than the largest Linf l_bound <- seq(0, maxsize, maxsize/nsc); l_bound <- l_bound[-length(l_bound)] u_bound <- seq(maxsize/nsc, maxsize, maxsize/nsc) mid <- l_bound+(u_bound-l_bound)/2 # Set up the inputs to the function - species-specific parameters Linf <- NS_par$Linf # the von-Bertalanffy asymptotic length of each species (cm). W_a <- NS_par$W_a # length-weight conversion parameter. W_b <- NS_par$W_b # length-weight conversion parameter. k <- NS_par$k # the von-Bertalnaffy growth parameter. Lmat <- NS_par$Lmat # the length at which 50\% of individuals are mature (cm). # Calculate the proportion of individuals that leave each length class # with and without a fixed value for phi_min tmp <- calc_phi(k, Linf, nsc, nfish, u_bound, l_bound, calc_phi_min=FALSE, phi_min=0.1) # fixed phi_min phi <- tmp$phi phi_min <- tmp$phi_min tmp <- calc_phi(k, Linf, nsc, nfish, u_bound, l_bound, calc_phi_min=TRUE) # without fixed phi_min phi <- tmp$phi phi_min <- tmp$phi_min
Calculates the size preference of each predator species in each length class for each prey species in each length class.
calc_prefs(pred_mu, pred_sigma, wgt, sc_Linf)
calc_prefs(pred_mu, pred_sigma, wgt, sc_Linf)
pred_mu |
A numeric value representing the preferred predator-prey mass ratio. |
pred_sigma |
A numeric value representing the width of the weight preference function. |
wgt |
A matrix with dimensions |
sc_Linf |
A numeric vector of length |
A predator of species i
in length class j
has a size preference for species k
in length class l
equal to
exp(-(log10(wgt[l, k]/wgt[j, i])-pred_mu)^2/(2*pred_sigma))
.
An array of dimensions nsc
, nfish
, nsc
and nfish
. The first and second dimensions represent the prey species whereas the third and fourth dimensions represent the predator species.
Hall, S. J., Collie, J. S., Duplisea, D. E., Jennings, S., Bravington, M., & Link, J. (2006). A length-based multispecies model for evaluating community responses to fishing. Canadian Journal of Fisheries and Aquatic Sciences, 63(6):1344-1359.
Ursin, E. (1973). On the prey size preferences of cod and dab. Meddelelser fra Danmarks Fiskeri-og Havundersgelser, 7:85-98.
# Set up the inputs to the function - species-independent parameters nfish <- nrow(NS_par) nsc <- 32 maxsize <- max(NS_par$Linf)*1.01 # the biggest size is 1% bigger than the largest Linf l_bound <- seq(0, maxsize, maxsize/nsc); l_bound <- l_bound[-length(l_bound)] u_bound <- seq(maxsize/nsc, maxsize, maxsize/nsc) mid <- l_bound+(u_bound-l_bound)/2 # Set up the inputs to the function - species-specific parameters Linf <- NS_par$Linf # the von-Bertalanffy asymptotic length of each species (cm). W_a <- NS_par$W_a # length-weight conversion parameter. W_b <- NS_par$W_b # length-weight conversion parameter. k <- NS_par$k # the von-Bertalnaffy growth parameter. Lmat <- NS_par$Lmat # the length at which 50\% of individuals are mature (cm). # Get phi_min tmp <- calc_phi(k, Linf, nsc, nfish, u_bound, l_bound, calc_phi_min=FALSE, phi_min=0.1) # fixed phi_min phi_min <- tmp$phi_min # Calculate growth increments tmp <- calc_ration_growthfac(k, Linf, nsc, nfish, l_bound, u_bound, mid, W_a, W_b, phi_min) sc_Linf <- tmp$sc_Linf wgt <- tmp$wgt # Calculate predator-prey size preferences prefs <- calc_prefs(pred_mu=-2.25, pred_sigma=0.5, wgt, sc_Linf)
# Set up the inputs to the function - species-independent parameters nfish <- nrow(NS_par) nsc <- 32 maxsize <- max(NS_par$Linf)*1.01 # the biggest size is 1% bigger than the largest Linf l_bound <- seq(0, maxsize, maxsize/nsc); l_bound <- l_bound[-length(l_bound)] u_bound <- seq(maxsize/nsc, maxsize, maxsize/nsc) mid <- l_bound+(u_bound-l_bound)/2 # Set up the inputs to the function - species-specific parameters Linf <- NS_par$Linf # the von-Bertalanffy asymptotic length of each species (cm). W_a <- NS_par$W_a # length-weight conversion parameter. W_b <- NS_par$W_b # length-weight conversion parameter. k <- NS_par$k # the von-Bertalnaffy growth parameter. Lmat <- NS_par$Lmat # the length at which 50\% of individuals are mature (cm). # Get phi_min tmp <- calc_phi(k, Linf, nsc, nfish, u_bound, l_bound, calc_phi_min=FALSE, phi_min=0.1) # fixed phi_min phi_min <- tmp$phi_min # Calculate growth increments tmp <- calc_ration_growthfac(k, Linf, nsc, nfish, l_bound, u_bound, mid, W_a, W_b, phi_min) sc_Linf <- tmp$sc_Linf wgt <- tmp$wgt # Calculate predator-prey size preferences prefs <- calc_prefs(pred_mu=-2.25, pred_sigma=0.5, wgt, sc_Linf)
Calculates the catchability for each fishing gear.
calc_Q( curve = rep("logistic", nfish), species = ((0:(length(curve) - 1))%%nfish) + 1, max_catchability = rep(1, length(curve)), gear_name = paste("gear_", 1:length(curve), sep = ""), custom = NULL, nsc, nfish, l_bound, u_bound, mid, eps = 1e-05, species_names, ... ) get_Q(curve, species, gear_name, nsc, nfish, l_bound, u_bound, mid, eps, ...) logistic_catch(species, nsc, nfish, mid, eps, L50 = 50, eta = 0.25, ...) log_gaussian_catch(species, nsc, nfish, mid, eps, Lmu = 50, Lsigma = 1, ...) knife_edge_catch(species, nsc, nfish, l_bound, u_bound, Lmin = 50, ...)
calc_Q( curve = rep("logistic", nfish), species = ((0:(length(curve) - 1))%%nfish) + 1, max_catchability = rep(1, length(curve)), gear_name = paste("gear_", 1:length(curve), sep = ""), custom = NULL, nsc, nfish, l_bound, u_bound, mid, eps = 1e-05, species_names, ... ) get_Q(curve, species, gear_name, nsc, nfish, l_bound, u_bound, mid, eps, ...) logistic_catch(species, nsc, nfish, mid, eps, L50 = 50, eta = 0.25, ...) log_gaussian_catch(species, nsc, nfish, mid, eps, Lmu = 50, Lsigma = 1, ...) knife_edge_catch(species, nsc, nfish, l_bound, u_bound, Lmin = 50, ...)
curve |
A character vector of almost any length describing the type of curve to be used to determine the catchability of each species by the fishing gear. By default, |
species |
A numeric or character vector of the same length as |
max_catchability |
A numeric vector of length |
gear_name |
A character vector of the same length as |
custom |
An array of dimensions |
nsc |
A numeric value representing the number of length classes in the model. |
nfish |
A numeric value representing the number of fish species in the model. |
l_bound |
A numeric vector of length |
u_bound |
A numeric vector of length |
mid |
A numeric vector of length |
eps |
A numeric value specifying a numerical offset. The default is |
species_names |
A character vector of length |
... |
Vectors of the same length as |
L50 |
A numeric value representing the length at 50% of the maximum catchability of the catchability curve. This is used with the |
eta |
A numeric value representing the steepness of the slope of the catchability curve. This is used with the |
Lmu |
A numeric value representing the length at the maximum catchability of the catchability curve. This is used with the |
Lsigma |
A numeric value representing the standard deviation of the catchability curve. See 'Details' for more information. This is used with the |
Lmin |
A numeric value representing the minimum length that is caught by the catchability curve. This is used with the |
This function allows three different models for catchability, all of which are rescaled so that their maximum catchability is equal to one:
(1) "logistic"
is proportional to
1/(1+exp(-eta*(mid-L50)))
;
(2) "log-gaussian"
is proportional to
dlnorm(mid, log(Lmu), Lsigma)
;
and (3) "knife-edge"
is equal to 1 for the length classes indexed by max(which(l_bound<Lmin)):nsc
and 0 for all other length classes. This means that all of the individuals in the length class containing Lmin
will have a catchability of 1.
In calc_Q
the catchability is rescaled so that the maximum catchability is one.
calc_Q
returns an array of dimensions nsc
, nfish
and gear
representing the catchability of each species by each of the fishing gears, scaled from 0 to max_catchability
.
get_Q
returns a catchability curve for a given species and gear scaled from 0 to 1. If an invalid catchability curve is selected, NULL
is returned and a warning message is shown.
logistic_catch
returns a matrix with dimensions nsc
and nfish
with all elements set to zero excluding one column that represents the logistic catchability curve for the selected species scaled from 0 to 1.
log_gaussian_catch
returns a matrix with dimensions nsc
and nfish
with all elements set to zero excluding one column that represents the log-gaussian catchability curve for the selected species scaled from 0 to 1.
knife_edge_catch
returns a matrix with dimensions nsc
and nfish
with all elements set to zero excluding one column that represents the knife-edge catchability curve for the selected species scaled from 0 to 1.
Hall, S. J., Collie, J. S., Duplisea, D. E., Jennings, S., Bravington, M., & Link, J. (2006). A length-based multispecies model for evaluating community responses to fishing. Canadian Journal of Fisheries and Aquatic Sciences, 63(6):1344-1359.
Thorpe, R.B., Jennings, S., Dolder, P.J. (2017). Risks and benefits of catching pretty good yield in multispecies mixed fisheries. ICES Journal of Marine Science, 74(8):2097-2106.
# Set up the inputs to the function nfish <- nrow(NS_par) nsc <- 32 maxsize <- max(NS_par$Linf)*1.01 # the biggest size is 1% bigger than the largest Linf l_bound <- seq(0, maxsize, maxsize/nsc); l_bound <- l_bound[-length(l_bound)] u_bound <- seq(maxsize/nsc, maxsize, maxsize/nsc) mid <- l_bound+(u_bound-l_bound)/2 # Set up the inputs to the function - species-specific parameters Linf <- NS_par$Linf # the von-Bertalanffy asymptotic length of each species (cm). W_a <- NS_par$W_a # length-weight conversion parameter. W_b <- NS_par$W_b # length-weight conversion parameter. k <- NS_par$k # the von-Bertalnaffy growth parameter. Lmat <- NS_par$Lmat # the length at which 50\% of individuals are mature (cm). # Calculate gear catchability Qs <- calc_Q(curve=rep("logistic", nfish), species=NS_par$species_names, max_catchability=rep(1, nfish), gear_name=NS_par$species_names, nsc=nsc, nfish=nfish, mid=mid, l_bound=l_bound, u_bound=u_bound, species_names=NS_par$species_names, eta=rep(0.25, nfish), L50=Lmat) # Calculate logistic catchability for the first species logistic_catch(species=1, nsc, nfish, mid, eps=1e-5,L50=Lmat[1], eta=0.25) # Calculate log-gaussian catchability for the first species log_gaussian_catch(species=1, nsc, nfish, mid, eps=1e-5, Lmu=50, Lsigma=1) # Calculate knife-edge catchability for the first species knife_edge_catch(species=1, nsc, nfish, l_bound, u_bound, Lmin=50)
# Set up the inputs to the function nfish <- nrow(NS_par) nsc <- 32 maxsize <- max(NS_par$Linf)*1.01 # the biggest size is 1% bigger than the largest Linf l_bound <- seq(0, maxsize, maxsize/nsc); l_bound <- l_bound[-length(l_bound)] u_bound <- seq(maxsize/nsc, maxsize, maxsize/nsc) mid <- l_bound+(u_bound-l_bound)/2 # Set up the inputs to the function - species-specific parameters Linf <- NS_par$Linf # the von-Bertalanffy asymptotic length of each species (cm). W_a <- NS_par$W_a # length-weight conversion parameter. W_b <- NS_par$W_b # length-weight conversion parameter. k <- NS_par$k # the von-Bertalnaffy growth parameter. Lmat <- NS_par$Lmat # the length at which 50\% of individuals are mature (cm). # Calculate gear catchability Qs <- calc_Q(curve=rep("logistic", nfish), species=NS_par$species_names, max_catchability=rep(1, nfish), gear_name=NS_par$species_names, nsc=nsc, nfish=nfish, mid=mid, l_bound=l_bound, u_bound=u_bound, species_names=NS_par$species_names, eta=rep(0.25, nfish), L50=Lmat) # Calculate logistic catchability for the first species logistic_catch(species=1, nsc, nfish, mid, eps=1e-5,L50=Lmat[1], eta=0.25) # Calculate log-gaussian catchability for the first species log_gaussian_catch(species=1, nsc, nfish, mid, eps=1e-5, Lmu=50, Lsigma=1) # Calculate knife-edge catchability for the first species knife_edge_catch(species=1, nsc, nfish, l_bound, u_bound, Lmin=50)
Calculates the amount of food required for fish of a given species and length class to grow according to the von Bertalanffy growth curve in a time step.
calc_ration_growthfac( k, Linf, nsc, nfish, l_bound, u_bound, mid, W_a, W_b, phi_min, vary_growth = TRUE, growth_eff = 0.5, growth_eff_decay = 0.11 )
calc_ration_growthfac( k, Linf, nsc, nfish, l_bound, u_bound, mid, W_a, W_b, phi_min, vary_growth = TRUE, growth_eff = 0.5, growth_eff_decay = 0.11 )
k |
A numeric vector of length |
Linf |
A numeric vector of length |
nsc |
A numeric value representing the number of length classes in the model. |
nfish |
A numeric value representing the number of species in the model. |
l_bound |
A numeric vector of length |
u_bound |
A numeric vector of length |
mid |
A numeric vector of length |
W_a |
A numeric vector of length |
W_b |
A numeric vector of length |
phi_min |
A numeric value representing the time step of the model. |
vary_growth |
A logical statement indicating whether growth efficiency should vary for each species ( |
growth_eff |
If |
growth_eff_decay |
A numeric value specifying the rate at which growth efficiency decreases as length approaches |
The weight increments of the i
th species in the j
th length class is calculated by determining the amount an individual will grow in one time step, phi_min
, if it were to follow the von Bertalanffy growth curve
L22=(Linf[i]-mid[j])*(1-exp(-k[i]*phi_min))
.
The weight of a fish at the mid-point of the size class is calculated using the length-weight relationship
wgt[j,i] = a[i]*mid[j]^b[i]
,
and similarly the expected change in weight of the the fish is calculated as
growth_inc = (W_a[i]*L22^W_b[i])
.
It also has a growth efficiency
g_eff[j, i]=(1-(wgt[j,i]/(W_a[i]*Linf[i]^W_b[i]))^growth_eff_decay)*growth_eff
if vary_growth==TRUE
or g_eff[j, i]=growth_eff
otherwise.
ration
is then calculated by
growth_inc*(1/g_eff[j, i])
.
A list object containing ration
, sc_Linf
, wgt
and g_eff
. ration
is a matrix with dimensions nsc
and nfish
representing the amount of food required for fish of a given species and length class to grow according to the von Bertalanffy growth curve in a time step. sc_Linf
is a numeric vector of length nfish
representing the length class at which each species reaches Linf
. wgt
is a matrix with dimensions nsc
and nfish
representing the weight of each species in each length class. g_eff
is a matrix with dimensions nsc
and nfish
representing the growth efficiency of each species in each length class.
von Bertalanffy, L. (1957). Quantitative Laws in Metabolism and Growth. The Quarterly Review of Biology, 32:217-231
# Set up the inputs to the function - species-independent parameters nfish <- nrow(NS_par) nsc <- 32 maxsize <- max(NS_par$Linf)*1.01 # the biggest size is 1% bigger than the largest Linf l_bound <- seq(0, maxsize, maxsize/nsc); l_bound <- l_bound[-length(l_bound)] u_bound <- seq(maxsize/nsc, maxsize, maxsize/nsc) mid <- l_bound+(u_bound-l_bound)/2 # Set up the inputs to the function - species-specific parameters Linf <- NS_par$Linf # the von-Bertalanffy asymptotic length of each species (cm). W_a <- NS_par$W_a # length-weight conversion parameter. W_b <- NS_par$W_b # length-weight conversion parameter. k <- NS_par$k # the von-Bertalnaffy growth parameter. Lmat <- NS_par$Lmat # the length at which 50\% of individuals are mature (cm). # Get phi_min tmp <- calc_phi(k, Linf, nsc, nfish, u_bound, l_bound, calc_phi_min=FALSE, phi_min=0.1) # fixed phi_min phi_min <- tmp$phi_min # Calculate growth increments tmp <- calc_ration_growthfac(k, Linf, nsc, nfish, l_bound, u_bound, mid, W_a, W_b, phi_min) ration <- tmp$ration sc_Linf <- tmp$sc_Linf wgt <- tmp$wgt g_eff <- tmp$g_eff
# Set up the inputs to the function - species-independent parameters nfish <- nrow(NS_par) nsc <- 32 maxsize <- max(NS_par$Linf)*1.01 # the biggest size is 1% bigger than the largest Linf l_bound <- seq(0, maxsize, maxsize/nsc); l_bound <- l_bound[-length(l_bound)] u_bound <- seq(maxsize/nsc, maxsize, maxsize/nsc) mid <- l_bound+(u_bound-l_bound)/2 # Set up the inputs to the function - species-specific parameters Linf <- NS_par$Linf # the von-Bertalanffy asymptotic length of each species (cm). W_a <- NS_par$W_a # length-weight conversion parameter. W_b <- NS_par$W_b # length-weight conversion parameter. k <- NS_par$k # the von-Bertalnaffy growth parameter. Lmat <- NS_par$Lmat # the length at which 50\% of individuals are mature (cm). # Get phi_min tmp <- calc_phi(k, Linf, nsc, nfish, u_bound, l_bound, calc_phi_min=FALSE, phi_min=0.1) # fixed phi_min phi_min <- tmp$phi_min # Calculate growth increments tmp <- calc_ration_growthfac(k, Linf, nsc, nfish, l_bound, u_bound, mid, W_a, W_b, phi_min) ration <- tmp$ration sc_Linf <- tmp$sc_Linf wgt <- tmp$wgt g_eff <- tmp$g_eff
Calculates the number of recruits of each species in a year.
calc_recruits(SSB, stored_rec_funs, rec_args)
calc_recruits(SSB, stored_rec_funs, rec_args)
SSB |
A numeric vector of length |
stored_rec_funs |
A list object of length |
rec_args |
A list object of length |
A numeric vector of length nfish
representing the number of new recruits of each species.
Barrowman, N.J., Myers, R.A. (2000). Still more spawner-recruit curves: the hockey stick and its generalisations. Canadian Journal of Fisheries and Aquatic Science, 57:665–676.
Beverton, R.J.H., Holt, S.J. (1957). On the Dynamics of Exploited Fish Populations, volume 19 of Fisheries Investigations (Series 2). United Kingdom Ministry of Agriculture and Fisheries.
Hall, S. J., Collie, J. S., Duplisea, D. E., Jennings, S., Bravington, M., & Link, J. (2006). A length-based multispecies model for evaluating community responses to fishing. Canadian Journal of Fisheries and Aquatic Sciences, 63(6):1344-1359.
Ogle, D.H. (2016). Introductory Fisheries Analyses with R. CRC Press.
Ricker, W.E. (1954). Stock and recruitment. Journal of the Fisheries Research Board of Canada, 11:559-623.
Thorpe, R.B., Le Quesne, W.J.F., Luxford, F., Collie, J.S., Jennings, S. (2015). Evaluation and management implications of uncertainty in a multispecies size-structured model of population and community responses to fishing. Methods in Ecology and Evolution, 6:49-58.
get_rec_fun
, make_rec_fun
, rec_BH
, rec_Ricker
, rec_hockey
, rec_const
, rec_linear
and calc_SSB
# Set up the inputs to the function - species-independent parameters nfish <- nrow(NS_par) nsc <- 32 maxsize <- max(NS_par$Linf)*1.01 # the biggest size is 1% bigger than the largest Linf l_bound <- seq(0, maxsize, maxsize/nsc); l_bound <- l_bound[-length(l_bound)] u_bound <- seq(maxsize/nsc, maxsize, maxsize/nsc) mid <- l_bound+(u_bound-l_bound)/2 # Set up the inputs to the function - species-specific parameters Linf <- NS_par$Linf # the von-Bertalanffy asymptotic length of each species (cm). W_a <- NS_par$W_a # length-weight conversion parameter. W_b <- NS_par$W_b # length-weight conversion parameter. k <- NS_par$k # the von-Bertalnaffy growth parameter. Lmat <- NS_par$Lmat # the length at which 50\% of individuals are mature (cm). # Get phi_min tmp <- calc_phi(k, Linf, nsc, nfish, u_bound, l_bound, calc_phi_min=FALSE, phi_min=0.1) # fixed phi_min phi_min <- tmp$phi_min # Run calc_ration_growthfac() tmp <- calc_ration_growthfac(k, Linf, nsc, nfish, l_bound, u_bound, mid, W_a, W_b, phi_min) sc_Linf <- tmp$sc_Linf wgt <- tmp$wgt # Calculate maturity mature <- calc_mature(Lmat, nfish, mid, kappa=rep(10, nfish), sc_Linf) # Create recruitment functions stored_rec_funs <- get_rec_fun(rep("hockey-stick", nfish)) recruit_params <- do.call("Map", c(c, list(a=NS_par$a, b=NS_par$b))) # Get an initial population N0 <- get_N0(nsc, nfish, mid, wgt, sc_Linf, intercept=1e10, slope=-5) # Calculate the SSB SSB <- calc_SSB(mature, N0, wgt) # Calculate the number of recruits R <- calc_recruits(SSB, stored_rec_funs, recruit_params)
# Set up the inputs to the function - species-independent parameters nfish <- nrow(NS_par) nsc <- 32 maxsize <- max(NS_par$Linf)*1.01 # the biggest size is 1% bigger than the largest Linf l_bound <- seq(0, maxsize, maxsize/nsc); l_bound <- l_bound[-length(l_bound)] u_bound <- seq(maxsize/nsc, maxsize, maxsize/nsc) mid <- l_bound+(u_bound-l_bound)/2 # Set up the inputs to the function - species-specific parameters Linf <- NS_par$Linf # the von-Bertalanffy asymptotic length of each species (cm). W_a <- NS_par$W_a # length-weight conversion parameter. W_b <- NS_par$W_b # length-weight conversion parameter. k <- NS_par$k # the von-Bertalnaffy growth parameter. Lmat <- NS_par$Lmat # the length at which 50\% of individuals are mature (cm). # Get phi_min tmp <- calc_phi(k, Linf, nsc, nfish, u_bound, l_bound, calc_phi_min=FALSE, phi_min=0.1) # fixed phi_min phi_min <- tmp$phi_min # Run calc_ration_growthfac() tmp <- calc_ration_growthfac(k, Linf, nsc, nfish, l_bound, u_bound, mid, W_a, W_b, phi_min) sc_Linf <- tmp$sc_Linf wgt <- tmp$wgt # Calculate maturity mature <- calc_mature(Lmat, nfish, mid, kappa=rep(10, nfish), sc_Linf) # Create recruitment functions stored_rec_funs <- get_rec_fun(rep("hockey-stick", nfish)) recruit_params <- do.call("Map", c(c, list(a=NS_par$a, b=NS_par$b))) # Get an initial population N0 <- get_N0(nsc, nfish, mid, wgt, sc_Linf, intercept=1e10, slope=-5) # Calculate the SSB SSB <- calc_SSB(mature, N0, wgt) # Calculate the number of recruits R <- calc_recruits(SSB, stored_rec_funs, recruit_params)
Calculates the spawning stock biomass (SSB) or total biomass of each species in the model.
calc_SSB(wgt, mature, N) calc_biomass(wgt, N)
calc_SSB(wgt, mature, N) calc_biomass(wgt, N)
wgt |
A matrix with dimensions |
mature |
A matrix with dimensions |
N |
A matrix with dimensions |
The Spawning Stock Biomass is equal to colSums(mature*N*wgt)
and the total biomass is equal to colSums(mature*N*wgt)
.
calc_SSB
returns a numeric vector of length nfish
representing the SSB of each species (g).
calc_biomass
returns a numeric vector of length length(species)
where the j
th element is the biomass (g) of the j
th species.
# Set up and run the model NS_params <- LeMansParam(NS_par, tau=NS_tau, eta=rep(0.25, 21), L50=NS_par$Lmat, other=1e12) effort <- matrix(0.5, 10, dim(NS_params@Qs)[3]) model_run <- run_LeMans(NS_params, years=10, effort=effort) # Calculate SSB calc_SSB(wgt=NS_params@wgt, mature=NS_params@mature, N=model_run@N[,,101]) # Calculate biomass in the last time step calc_biomass(wgt=NS_params@wgt, N=model_run@N[,,101])
# Set up and run the model NS_params <- LeMansParam(NS_par, tau=NS_tau, eta=rep(0.25, 21), L50=NS_par$Lmat, other=1e12) effort <- matrix(0.5, 10, dim(NS_params@Qs)[3]) model_run <- run_LeMans(NS_params, years=10, effort=effort) # Calculate SSB calc_SSB(wgt=NS_params@wgt, mature=NS_params@mature, N=model_run@N[,,101]) # Calculate biomass in the last time step calc_biomass(wgt=NS_params@wgt, N=model_run@N[,,101])
Calculates a combined value for prey preference and prey suitability standardised to a value between 0 and 1.
calc_suit_vect(nsc, nfish, sc_Linf, prefs, tau)
calc_suit_vect(nsc, nfish, sc_Linf, prefs, tau)
nsc |
A numeric value representing the number of length classes in the model. |
nfish |
A numeric value representing the number of species in the model. |
sc_Linf |
A numeric vector of length |
prefs |
An array of dimensions |
tau |
A matrix of dimensions |
tau
values are assigned to an array of dimensions nsc
, nfish
, nsc
and nfish
and multiplied by the array prefs
. This creates an array of dimensions nsc
, nfish
, nsc
and nfish
indicating prey suitability. Prey suitability is then standardised to sum to 1 for each predator species in each length class.
A list object of length nfish
. Each element in the list is an array of dimensions nsc
, nsc
and nfish
containing a value between 0 and 1 that represents prey preference and prey suitability for each species and length class.
Hall, S. J., Collie, J. S., Duplisea, D. E., Jennings, S., Bravington, M., & Link, J. (2006). A length-based multispecies model for evaluating community responses to fishing. Canadian Journal of Fisheries and Aquatic Sciences, 63(6):1344-1359.
# Set up the inputs to the function - species-independent parameters nfish <- nrow(NS_par) nsc <- 32 maxsize <- max(NS_par$Linf)*1.01 # the biggest size is 1% bigger than the largest Linf l_bound <- seq(0, maxsize, maxsize/nsc); l_bound <- l_bound[-length(l_bound)] u_bound <- seq(maxsize/nsc, maxsize, maxsize/nsc) mid <- l_bound+(u_bound-l_bound)/2 # Set up the inputs to the function - species-specific parameters Linf <- NS_par$Linf # the von-Bertalanffy asymptotic length of each species (cm). W_a <- NS_par$W_a # length-weight conversion parameter. W_b <- NS_par$W_b # length-weight conversion parameter. k <- NS_par$k # the von-Bertalnaffy growth parameter. Lmat <- NS_par$Lmat # the length at which 50\% of individuals are mature (cm). # Get phi_min tmp <- calc_phi(k, Linf, nsc, nfish, u_bound, l_bound, calc_phi_min=FALSE, phi_min=0.1) # fixed phi_min phi_min <- tmp$phi_min # Calculate growth increments tmp <- calc_ration_growthfac(k, Linf, nsc, nfish, l_bound, u_bound, mid, W_a, W_b, phi_min) sc_Linf <- tmp$sc_Linf wgt <- tmp$wgt # Calculate predator-prey size preferences prefs <- calc_prefs(pred_mu=-2.25, pred_sigma=0.5, wgt, sc_Linf) # Calculate prey preference and prey suitability suit_M2 <- calc_suit_vect(nsc, nfish, sc_Linf, prefs, NS_tau)
# Set up the inputs to the function - species-independent parameters nfish <- nrow(NS_par) nsc <- 32 maxsize <- max(NS_par$Linf)*1.01 # the biggest size is 1% bigger than the largest Linf l_bound <- seq(0, maxsize, maxsize/nsc); l_bound <- l_bound[-length(l_bound)] u_bound <- seq(maxsize/nsc, maxsize, maxsize/nsc) mid <- l_bound+(u_bound-l_bound)/2 # Set up the inputs to the function - species-specific parameters Linf <- NS_par$Linf # the von-Bertalanffy asymptotic length of each species (cm). W_a <- NS_par$W_a # length-weight conversion parameter. W_b <- NS_par$W_b # length-weight conversion parameter. k <- NS_par$k # the von-Bertalnaffy growth parameter. Lmat <- NS_par$Lmat # the length at which 50\% of individuals are mature (cm). # Get phi_min tmp <- calc_phi(k, Linf, nsc, nfish, u_bound, l_bound, calc_phi_min=FALSE, phi_min=0.1) # fixed phi_min phi_min <- tmp$phi_min # Calculate growth increments tmp <- calc_ration_growthfac(k, Linf, nsc, nfish, l_bound, u_bound, mid, W_a, W_b, phi_min) sc_Linf <- tmp$sc_Linf wgt <- tmp$wgt # Calculate predator-prey size preferences prefs <- calc_prefs(pred_mu=-2.25, pred_sigma=0.5, wgt, sc_Linf) # Calculate prey preference and prey suitability suit_M2 <- calc_suit_vect(nsc, nfish, sc_Linf, prefs, NS_tau)
LeMans_outputs
objectsCombines two LeMans_outputs objects.
comb_LeMans_run(LeMans_run_x, LeMans_run_y, cont = TRUE)
comb_LeMans_run(LeMans_run_x, LeMans_run_y, cont = TRUE)
LeMans_run_x |
A LeMans_outputs object. |
LeMans_run_y |
A LeMans_outputs object. |
cont |
A logical statement indicating whether or not |
If cont==T
, the first years output from LeMans_run_y
is removed as this will be the same as the last year of LeMans_run_x
.
A LeMans_outputs
object.
# Set up the inputs to the model NS_params <- LeMansParam(NS_par, tau=NS_tau, eta=rep(0.25, 21), L50=NS_par$Lmat, other=NS_other) # Define fishing effort effort <- matrix(0.5, 10, dim(NS_params@Qs)[3]) # Run the model for the first time model_run1 <- run_LeMans(NS_params, years=10, effort=effort) # Run the model for another 12 years effort1 <- matrix(0.5, 12, dim(NS_params@Qs)[3]) model_run2 <- run_LeMans(N=model_run1@N[,,101], NS_params, years=12, effort=effort1) # Combine the two model runs into a single run out <- comb_LeMans_run(model_run1, model_run2, cont=TRUE)
# Set up the inputs to the model NS_params <- LeMansParam(NS_par, tau=NS_tau, eta=rep(0.25, 21), L50=NS_par$Lmat, other=NS_other) # Define fishing effort effort <- matrix(0.5, 10, dim(NS_params@Qs)[3]) # Run the model for the first time model_run1 <- run_LeMans(NS_params, years=10, effort=effort) # Run the model for another 12 years effort1 <- matrix(0.5, 12, dim(NS_params@Qs)[3]) model_run2 <- run_LeMans(N=model_run1@N[,,101], NS_params, years=12, effort=effort1) # Combine the two model runs into a single run out <- comb_LeMans_run(model_run1, model_run2, cont=TRUE)
Get annual catch for each species, the Catch Per Unit Effort (CPUE) or the Catch Per Gear (CPG)
get_annual_catch(inputs, outputs, ...) ## S4 method for signature 'missing,missing' get_annual_catch( Catch, years = (dim(Catch)[3] + (inc_first - 1)) * phi_min, phi_min = 0.1, inc_first = FALSE ) ## S4 method for signature 'LeMans_param,missing' get_annual_catch( inputs, Catch, years = (dim(Catch)[3] + (inc_first - 1)) * inputs@phi_min, inc_first = FALSE ) ## S4 method for signature 'LeMans_param,LeMans_outputs' get_annual_catch( inputs, outputs, years = (dim(outputs@Catch)[3] + (inc_first - 1)) * inputs@phi_min, inc_first = FALSE ) ## S4 method for signature 'missing,LeMans_outputs' get_annual_catch( outputs, years = (dim(outputs@Catch)[3] + (inc_first - 1)) * phi_min, phi_min = 0.1, inc_first = FALSE ) get_CPUE(inputs, outputs, ...) ## S4 method for signature 'LeMans_param,LeMans_outputs' get_CPUE(inputs, outputs, effort, years = nrow(effort), inc_first = FALSE) ## S4 method for signature 'LeMans_param,missing' get_CPUE(inputs, Catch, effort, years = nrow(effort), inc_first = FALSE) ## S4 method for signature 'missing,LeMans_outputs' get_CPUE( outputs, Qs, effort, years = nrow(effort), phi_min = 0.1, inc_first = FALSE ) ## S4 method for signature 'missing,missing' get_CPUE( Catch, Qs, effort, years = nrow(effort), phi_min = 0.1, inc_first = FALSE ) get_CPG(inputs, outputs, ...) ## S4 method for signature 'LeMans_param,LeMans_outputs' get_CPG(inputs, outputs, effort, years = nrow(effort), inc_first = FALSE) ## S4 method for signature 'LeMans_param,missing' get_CPG(inputs, Catch, effort, years = nrow(effort), inc_first = FALSE) ## S4 method for signature 'missing,LeMans_outputs' get_CPG( outputs, Qs, effort, years = nrow(effort), phi_min = 0.1, inc_first = FALSE ) ## S4 method for signature 'missing,missing' get_CPG( Catch, Qs, effort, years = nrow(effort), phi_min = 0.1, inc_first = FALSE )
get_annual_catch(inputs, outputs, ...) ## S4 method for signature 'missing,missing' get_annual_catch( Catch, years = (dim(Catch)[3] + (inc_first - 1)) * phi_min, phi_min = 0.1, inc_first = FALSE ) ## S4 method for signature 'LeMans_param,missing' get_annual_catch( inputs, Catch, years = (dim(Catch)[3] + (inc_first - 1)) * inputs@phi_min, inc_first = FALSE ) ## S4 method for signature 'LeMans_param,LeMans_outputs' get_annual_catch( inputs, outputs, years = (dim(outputs@Catch)[3] + (inc_first - 1)) * inputs@phi_min, inc_first = FALSE ) ## S4 method for signature 'missing,LeMans_outputs' get_annual_catch( outputs, years = (dim(outputs@Catch)[3] + (inc_first - 1)) * phi_min, phi_min = 0.1, inc_first = FALSE ) get_CPUE(inputs, outputs, ...) ## S4 method for signature 'LeMans_param,LeMans_outputs' get_CPUE(inputs, outputs, effort, years = nrow(effort), inc_first = FALSE) ## S4 method for signature 'LeMans_param,missing' get_CPUE(inputs, Catch, effort, years = nrow(effort), inc_first = FALSE) ## S4 method for signature 'missing,LeMans_outputs' get_CPUE( outputs, Qs, effort, years = nrow(effort), phi_min = 0.1, inc_first = FALSE ) ## S4 method for signature 'missing,missing' get_CPUE( Catch, Qs, effort, years = nrow(effort), phi_min = 0.1, inc_first = FALSE ) get_CPG(inputs, outputs, ...) ## S4 method for signature 'LeMans_param,LeMans_outputs' get_CPG(inputs, outputs, effort, years = nrow(effort), inc_first = FALSE) ## S4 method for signature 'LeMans_param,missing' get_CPG(inputs, Catch, effort, years = nrow(effort), inc_first = FALSE) ## S4 method for signature 'missing,LeMans_outputs' get_CPG( outputs, Qs, effort, years = nrow(effort), phi_min = 0.1, inc_first = FALSE ) ## S4 method for signature 'missing,missing' get_CPG( Catch, Qs, effort, years = nrow(effort), phi_min = 0.1, inc_first = FALSE )
inputs |
A |
outputs |
A |
... |
Additional arguments. |
Catch |
An array with dimensions |
years |
A numeric value representing the number of years included in |
phi_min |
A numeric value representing the time step of the model. |
inc_first |
A logical statement indicating whether the first time step of |
effort |
A matrix with dimensions |
Qs |
An array of dimensions |
get_annual_catch
returns a matrix with dimensions years
and length(species)
where the i,j
th element represents the total catch (g) of the j
th species
in the i
th year.
get_CPUE
returns a matrix with dimensions tot_time
and nfish
where the i,j
th element represents the CPUE in the i
th time step for the j
th species.
get_CPG
returns an array with dimensions nfish
, dim(Qs[3])
and the number of time steps, where the i,j,k
th element denotes the total catch of the i
th species by the j
th gear in the k
th time step.
# Set up and run the model NS_params <- LeMansParam(NS_par, tau=NS_tau, eta=rep(0.25, 21), L50=NS_par$Lmat, other=1e12) effort <- matrix(0.5, 10, dim(NS_params@Qs)[3]) model_run <- run_LeMans(NS_params, years=10, effort=effort) # Get annual catch get_annual_catch(inputs=NS_params, outputs=model_run) # Calculate the CPUE get_CPUE(inputs=NS_params, outputs=model_run, effort=effort) # Calculate Catch Per Gear (CPG) get_CPG(inputs=NS_params, outputs=model_run, effort=effort)
# Set up and run the model NS_params <- LeMansParam(NS_par, tau=NS_tau, eta=rep(0.25, 21), L50=NS_par$Lmat, other=1e12) effort <- matrix(0.5, 10, dim(NS_params@Qs)[3]) model_run <- run_LeMans(NS_params, years=10, effort=effort) # Get annual catch get_annual_catch(inputs=NS_params, outputs=model_run) # Calculate the CPUE get_CPUE(inputs=NS_params, outputs=model_run, effort=effort) # Calculate Catch Per Gear (CPG) get_CPG(inputs=NS_params, outputs=model_run, effort=effort)
Calculates Mean Maximum Length (MML), the Large Fish Indicator (LFI), Typical Length (TyL) and Length Quantiles (LQ) of the whole community or a subset of the species.
get_indicators(inputs, outputs, ...) ## S4 method for signature 'LeMans_param,LeMans_outputs' get_indicators( inputs, outputs, species = 1:dim(outputs@N)[2], time_steps = 1:dim(outputs@N)[3], prob = 0.5, length_LFI = 40 ) ## S4 method for signature 'LeMans_param,missing' get_indicators( inputs, N, species = 1:dim(N)[2], time_steps = 1:dim(N)[3], prob = 0.5, length_LFI = 40 ) ## S4 method for signature 'missing,LeMans_outputs' get_indicators( wgt, mid, l_bound, u_bound, Linf, outputs, species = 1:dim(outputs@N)[2], time_steps = 1:dim(outputs@N)[3], species_names = NULL, prob = 0.5, length_LFI = 40 ) ## S4 method for signature 'missing,missing' get_indicators( wgt, mid, l_bound, u_bound, Linf, N, species = 1:dim(N)[2], time_steps = 1:dim(N)[3], species_names = NULL, prob = 0.5, length_LFI = 40 ) get_LFI(inputs, outputs, ...) ## S4 method for signature 'LeMans_param,LeMans_outputs' get_LFI( inputs, outputs, species = 1:dim(outputs@N)[2], time_steps = 1:dim(outputs@N)[3], length_LFI = 40 ) ## S4 method for signature 'LeMans_param,missing' get_LFI( inputs, N, species = 1:dim(N)[2], time_steps = 1:dim(N)[3], length_LFI = 40 ) ## S4 method for signature 'missing,LeMans_outputs' get_LFI( wgt, l_bound, u_bound, outputs, species = 1:dim(outputs@N)[2], time_steps = 1:dim(outputs@N)[3], species_names = NULL, length_LFI = 40 ) ## S4 method for signature 'missing,missing' get_LFI( wgt, l_bound, u_bound, N, species = 1:dim(N)[2], time_steps = 1:dim(N)[3], species_names = NULL, length_LFI = 40 ) get_MML(inputs, outputs, ...) ## S4 method for signature 'LeMans_param,LeMans_outputs' get_MML( inputs, outputs, species = 1:dim(outputs@N)[2], time_steps = 1:dim(outputs@N)[3] ) ## S4 method for signature 'LeMans_param,missing' get_MML(inputs, N, species = 1:dim(N)[2], time_steps = 1:dim(N)[3]) ## S4 method for signature 'missing,LeMans_outputs' get_MML( wgt, Linf, outputs, species = 1:dim(outputs@N)[2], time_steps = 1:dim(outputs@N)[3], species_names = NULL ) ## S4 method for signature 'missing,missing' get_MML( wgt, Linf, N, species = 1:dim(N)[2], time_steps = 1:dim(N)[3], species_names = NULL ) get_TyL(inputs, outputs, ...) ## S4 method for signature 'LeMans_param,LeMans_outputs' get_TyL( inputs, outputs, species = 1:dim(outputs@N)[2], time_steps = 1:dim(outputs@N)[3] ) ## S4 method for signature 'LeMans_param,missing' get_TyL(inputs, N, species = 1:dim(N)[2], time_steps = 1:dim(N)[3]) ## S4 method for signature 'missing,LeMans_outputs' get_TyL( wgt, mid, outputs, species = 1:dim(outputs@N)[2], time_steps = 1:dim(outputs@N)[3], species_names = NULL ) ## S4 method for signature 'missing,missing' get_TyL( wgt, mid, N, species = 1:dim(N)[2], time_steps = 1:dim(N)[3], species_names = NULL ) get_LQ(inputs, outputs, ...) ## S4 method for signature 'LeMans_param,LeMans_outputs' get_LQ( inputs, outputs, species = 1:dim(outputs@N)[2], time_steps = 1:dim(outputs@N)[3], prob = 0.5 ) ## S4 method for signature 'LeMans_param,missing' get_LQ(inputs, N, species = 1:dim(N)[2], time_steps = 1:dim(N)[3], prob = 0.5) ## S4 method for signature 'missing,LeMans_outputs' get_LQ( wgt, u_bound, outputs, species = 1:dim(outputs@N)[2], time_steps = 1:dim(outputs@N)[3], species_names = NULL, prob = 0.5 ) ## S4 method for signature 'missing,missing' get_LQ( wgt, u_bound, N, species = 1:dim(N)[2], time_steps = 1:dim(N)[3], species_names = NULL, prob = 0.5 )
get_indicators(inputs, outputs, ...) ## S4 method for signature 'LeMans_param,LeMans_outputs' get_indicators( inputs, outputs, species = 1:dim(outputs@N)[2], time_steps = 1:dim(outputs@N)[3], prob = 0.5, length_LFI = 40 ) ## S4 method for signature 'LeMans_param,missing' get_indicators( inputs, N, species = 1:dim(N)[2], time_steps = 1:dim(N)[3], prob = 0.5, length_LFI = 40 ) ## S4 method for signature 'missing,LeMans_outputs' get_indicators( wgt, mid, l_bound, u_bound, Linf, outputs, species = 1:dim(outputs@N)[2], time_steps = 1:dim(outputs@N)[3], species_names = NULL, prob = 0.5, length_LFI = 40 ) ## S4 method for signature 'missing,missing' get_indicators( wgt, mid, l_bound, u_bound, Linf, N, species = 1:dim(N)[2], time_steps = 1:dim(N)[3], species_names = NULL, prob = 0.5, length_LFI = 40 ) get_LFI(inputs, outputs, ...) ## S4 method for signature 'LeMans_param,LeMans_outputs' get_LFI( inputs, outputs, species = 1:dim(outputs@N)[2], time_steps = 1:dim(outputs@N)[3], length_LFI = 40 ) ## S4 method for signature 'LeMans_param,missing' get_LFI( inputs, N, species = 1:dim(N)[2], time_steps = 1:dim(N)[3], length_LFI = 40 ) ## S4 method for signature 'missing,LeMans_outputs' get_LFI( wgt, l_bound, u_bound, outputs, species = 1:dim(outputs@N)[2], time_steps = 1:dim(outputs@N)[3], species_names = NULL, length_LFI = 40 ) ## S4 method for signature 'missing,missing' get_LFI( wgt, l_bound, u_bound, N, species = 1:dim(N)[2], time_steps = 1:dim(N)[3], species_names = NULL, length_LFI = 40 ) get_MML(inputs, outputs, ...) ## S4 method for signature 'LeMans_param,LeMans_outputs' get_MML( inputs, outputs, species = 1:dim(outputs@N)[2], time_steps = 1:dim(outputs@N)[3] ) ## S4 method for signature 'LeMans_param,missing' get_MML(inputs, N, species = 1:dim(N)[2], time_steps = 1:dim(N)[3]) ## S4 method for signature 'missing,LeMans_outputs' get_MML( wgt, Linf, outputs, species = 1:dim(outputs@N)[2], time_steps = 1:dim(outputs@N)[3], species_names = NULL ) ## S4 method for signature 'missing,missing' get_MML( wgt, Linf, N, species = 1:dim(N)[2], time_steps = 1:dim(N)[3], species_names = NULL ) get_TyL(inputs, outputs, ...) ## S4 method for signature 'LeMans_param,LeMans_outputs' get_TyL( inputs, outputs, species = 1:dim(outputs@N)[2], time_steps = 1:dim(outputs@N)[3] ) ## S4 method for signature 'LeMans_param,missing' get_TyL(inputs, N, species = 1:dim(N)[2], time_steps = 1:dim(N)[3]) ## S4 method for signature 'missing,LeMans_outputs' get_TyL( wgt, mid, outputs, species = 1:dim(outputs@N)[2], time_steps = 1:dim(outputs@N)[3], species_names = NULL ) ## S4 method for signature 'missing,missing' get_TyL( wgt, mid, N, species = 1:dim(N)[2], time_steps = 1:dim(N)[3], species_names = NULL ) get_LQ(inputs, outputs, ...) ## S4 method for signature 'LeMans_param,LeMans_outputs' get_LQ( inputs, outputs, species = 1:dim(outputs@N)[2], time_steps = 1:dim(outputs@N)[3], prob = 0.5 ) ## S4 method for signature 'LeMans_param,missing' get_LQ(inputs, N, species = 1:dim(N)[2], time_steps = 1:dim(N)[3], prob = 0.5) ## S4 method for signature 'missing,LeMans_outputs' get_LQ( wgt, u_bound, outputs, species = 1:dim(outputs@N)[2], time_steps = 1:dim(outputs@N)[3], species_names = NULL, prob = 0.5 ) ## S4 method for signature 'missing,missing' get_LQ( wgt, u_bound, N, species = 1:dim(N)[2], time_steps = 1:dim(N)[3], species_names = NULL, prob = 0.5 )
inputs |
A |
outputs |
A |
... |
Additional arguments. |
species |
A numeric value or vector or a character string representing the species that you wish to use to calculate the indicators. The default is |
time_steps |
A numeric vector of the time steps that you wish to use to calculate the indicators. The default is |
prob |
A numeric value or vector between 0 and 1 denoting the length quantiles to be calculated. The default is |
length_LFI |
A numeric vector representing the thresholds to be used to calculate the LFI. The default value is |
N |
An array with dimensions |
wgt |
A matrix with dimensions |
mid |
A numeric vector of length |
l_bound |
A numeric vector of length |
u_bound |
A numeric vector of length |
Linf |
A numeric vector of length |
species_names |
A character vector of length |
The LFI represents the proportion of biomass with a length larger than length_LFI
. The MML is the biomass weighted mean of Linf
:
sum(biomass[species]*Linf[species])/sum(biomass[species])
where biomass
is a numeric vector of length nfish
representing the biomass of each species. TyL is the biomass-weighted geometric mean length of the community:
exp(sum(biomass_*log(mid))/sum(Bio_l))
where biomass_
is a numeric vector of length nsc
representing the biomass of all the species in each length class. The LQ is the length at which the biomass exceeds a given proportion prob
of the total biomass.
get_indicators
returns a list object with names 'LFI', 'MML', 'TYL' and 'LQ'. If length(length_LFI)>1
, 'LFI' is a matrix with dimensions length(time_steps)
by length(length_LFI)
where the i,j
th element represents the LFI using the j
th length_LFI
in the i
th time_steps
. If length(length_LFI)==1
, the function will return a numeric vector of length length(time_steps)
. 'MML' is a numeric vector of length time_steps
where each element is the MML for the species in species
. 'TYL' is a numeric vector of length time_steps
where each element is the TyL for the species in species
. If length(prob)==1
, 'LQ' is a matrix with dimensions length(time_steps)
by length(prob)
where the i,j
th element is the LQ using thej
th prob
in the i
th time_steps
. If length(prob)==1
, the function will return a numeric vector of length length(time_steps)
.
If length(length_LFI)==1
, get_LFI
returns a matrix with dimensions length(time_steps)
by length(length_LFI)
where the i,j
th element is the LFI using the j
th length_LFI
in the i
th time_steps
. If length(length_LFI)==1
, the function will return a numeric vector of length length(time_steps)
.
get_MML
returns a numeric vector of length time_steps
where each element is the MML for the species in species
.
If length(prob)>1
, get_LQ
returns a matrix with dimensions length(time_steps)
and length(prob)
where the i,j
th element is the LQ using the the j
th prob
in the i
th time_steps
. If length(prob)==1
, the function will return a numeric vector of length length(time_steps)
.
# Set up and run the model NS_params <- LeMansParam(NS_par, tau=NS_tau, eta=rep(0.25, 21), L50=NS_par$Lmat, other=1e12) effort <- matrix(0.5, 10, dim(NS_params@Qs)[3]) model_run <- run_LeMans(NS_params, years=10, effort=effort) # Calculate the indicators get_indicators(inputs=NS_params, outputs=model_run) # Calculate the LFI get_LFI(inputs=NS_params, outputs=model_run) # Calculate MML get_MML(inputs=NS_params, outputs=model_run) # Calculate TyL get_TyL(inputs=NS_params, outputs=model_run) # Calculate LQs get_LQ(inputs=NS_params, outputs=model_run)
# Set up and run the model NS_params <- LeMansParam(NS_par, tau=NS_tau, eta=rep(0.25, 21), L50=NS_par$Lmat, other=1e12) effort <- matrix(0.5, 10, dim(NS_params@Qs)[3]) model_run <- run_LeMans(NS_params, years=10, effort=effort) # Calculate the indicators get_indicators(inputs=NS_params, outputs=model_run) # Calculate the LFI get_LFI(inputs=NS_params, outputs=model_run) # Calculate MML get_MML(inputs=NS_params, outputs=model_run) # Calculate TyL get_TyL(inputs=NS_params, outputs=model_run) # Calculate LQs get_LQ(inputs=NS_params, outputs=model_run)
Generate a starting value for N
, which represents the number of individuals in each length class for each species.
get_N0(nsc, nfish, mid, wgt, sc_Linf, intercept = 1e+10, slope = -5)
get_N0(nsc, nfish, mid, wgt, sc_Linf, intercept = 1e+10, slope = -5)
nsc |
A numeric value representing the number of length classes in the model. |
nfish |
A numeric value representing the number of fish species in the model. |
mid |
A numeric vector of length |
wgt |
A matrix with dimensions |
sc_Linf |
A numeric vector of length |
intercept |
A numeric value representing the number of individuals in the first length class. The default is |
slope |
A numeric value representing the slope of the community size spectrum. The default is -5. |
The total number of individuals in the community in each length class is equal to intercept*mid^slope
. Within each length class, the number of individuals of each species is determined using the proportion of each species' biomass that is found in that length class.
A matrix with dimensions nsc
and nfish
representing the number of individuals in each length class.
Andersen, K.H., Blanchard, J.L., Fulton, E.A., Gislason, H., Jacobsen, N.S., van Kooten, T. (2016). Assumptions behind size-based ecosystem models are realistic. ICES Journal of Marine Science, 73(6):1651-1655.
# Set up the inputs to the function nfish <- nrow(NS_par) nsc <- 32 maxsize <- max(NS_par$Linf)*1.01 # the biggest size is 1% bigger than the largest Linf l_bound <- seq(0, maxsize, maxsize/nsc); l_bound <- l_bound[-length(l_bound)] u_bound <- seq(maxsize/nsc, maxsize, maxsize/nsc) mid <- l_bound+(u_bound-l_bound)/2 # Set up the inputs to the function - species-specific parameters Linf <- NS_par$Linf # the von-Bertalanffy asymptotic length of each species (cm). W_a <- NS_par$W_a # length-weight conversion parameter. W_b <- NS_par$W_b # length-weight conversion parameter. k <- NS_par$k # the von-Bertalnaffy growth parameter. Lmat <- NS_par$Lmat # the length at which 50\% of individuals are mature (cm). # Get phi_min tmp <- calc_phi(k, Linf, nsc, nfish, u_bound, l_bound, calc_phi_min=FALSE, phi_min=0.1) # fixed phi_min phi_min <- tmp$phi_min # Calculate growth increments tmp <- calc_ration_growthfac(k, Linf, nsc, nfish, l_bound, u_bound, mid, W_a, W_b, phi_min) sc_Linf <- tmp$sc_Linf wgt <- tmp$wgt # Get an initial population get_N0(nsc, nfish, mid, wgt, sc_Linf)
# Set up the inputs to the function nfish <- nrow(NS_par) nsc <- 32 maxsize <- max(NS_par$Linf)*1.01 # the biggest size is 1% bigger than the largest Linf l_bound <- seq(0, maxsize, maxsize/nsc); l_bound <- l_bound[-length(l_bound)] u_bound <- seq(maxsize/nsc, maxsize, maxsize/nsc) mid <- l_bound+(u_bound-l_bound)/2 # Set up the inputs to the function - species-specific parameters Linf <- NS_par$Linf # the von-Bertalanffy asymptotic length of each species (cm). W_a <- NS_par$W_a # length-weight conversion parameter. W_b <- NS_par$W_b # length-weight conversion parameter. k <- NS_par$k # the von-Bertalnaffy growth parameter. Lmat <- NS_par$Lmat # the length at which 50\% of individuals are mature (cm). # Get phi_min tmp <- calc_phi(k, Linf, nsc, nfish, u_bound, l_bound, calc_phi_min=FALSE, phi_min=0.1) # fixed phi_min phi_min <- tmp$phi_min # Calculate growth increments tmp <- calc_ration_growthfac(k, Linf, nsc, nfish, l_bound, u_bound, mid, W_a, W_b, phi_min) sc_Linf <- tmp$sc_Linf wgt <- tmp$wgt # Get an initial population get_N0(nsc, nfish, mid, wgt, sc_Linf)
Collates the stock recruitment functions for all of the species in the model.
get_rec_fun(rec_fun = "hockey-stick")
get_rec_fun(rec_fun = "hockey-stick")
rec_fun |
A character vector representing the stock recruitment function to be applied to each species. The default is |
For "Beverton-Holt"
, the stock recruitment function is defined as a*SSB/(1+b*SSB)
; for "Ricker"
it is defined as a*SSB*exp(-b*SSB)
; for "hockey-stick"
it is defined as min(a*SSB, b)
; for "constant"
it is defined as a
, and for "linear"
it is defined as a*SSB
. In all cases, SSB
is the Spawning Stock Biomass in 1000s of tonnes and a
and b
are parameters of the specific stock recruitment functions.
A list object of length rec_fun
where each element includes the stock recruitment function for a given species. If an invalid recruitment function is selected, NULL
is returned and a warning message is shown.
Barrowman, N.J., Myers, R.A. (2000). Still more spawner-recruit curves: the hockey stick and its generalisations. Canadian Journal of Fisheries and Aquatic Science, 57:665–676.
Beverton, R.J.H., Holt, S.J. (1957). On the Dynamics of Exploited Fish Populations, volume 19 of Fisheries Investigations (Series 2). United Kingdom Ministry of Agriculture and Fisheries.
Hall, S. J., Collie, J. S., Duplisea, D. E., Jennings, S., Bravington, M., & Link, J. (2006). A length-based multispecies model for evaluating community responses to fishing. Canadian Journal of Fisheries and Aquatic Sciences, 63(6):1344-1359.
Ogle, D.H. (2016). Introductory Fisheries Analyses with R. CRC Press.
Ricker, W.E. (1954). Stock and recruitment. Journal of the Fisheries Research Board of Canada, 11:559-623.
Thorpe, R.B., Le Quesne, W.J.F., Luxford, F., Collie, J.S., Jennings, S. (2015). Evaluation and management implications of uncertainty in a multispecies size-structured model of population and community responses to fishing. Methods in Ecology and Evolution, 6:49-58.
calc_recruits
, make_rec_fun
, rec_BH
, rec_Ricker
, rec_hockey
, rec_const
, rec_linear
and calc_SSB
nfish <- nrow(NS_par) stored_rec_funs <- get_rec_fun(rep("hockey-stick", nfish))
nfish <- nrow(NS_par) stored_rec_funs <- get_rec_fun(rep("hockey-stick", nfish))
Calculates the Spawning Stock Biomass (SSB) or the total biomass of each species in the model.
get_SSB(inputs, outputs, ...) ## S4 method for signature 'LeMans_param,LeMans_outputs' get_SSB( inputs, outputs, species = 1:dim(outputs@N)[2], time_steps = 1:dim(outputs@N)[3] ) ## S4 method for signature 'LeMans_param,missing' get_SSB(inputs, N, species = 1:dim(N)[2], time_steps = 1:dim(N)[3]) ## S4 method for signature 'missing,LeMans_outputs' get_SSB( wgt, mature, outputs, species = 1:dim(outputs@N)[2], time_steps = 1:dim(outputs@N)[3], species_names = NULL ) ## S4 method for signature 'missing,missing' get_SSB( wgt, mature, N, species = 1:dim(N)[2], time_steps = 1:dim(N)[3], species_names = NULL ) get_biomass(inputs, outputs, ...) ## S4 method for signature 'LeMans_param,LeMans_outputs' get_biomass( inputs, outputs, species = 1:dim(outputs@N)[2], time_steps = 1:dim(outputs@N)[3] ) ## S4 method for signature 'LeMans_param,missing' get_biomass(inputs, N, species = 1:dim(N)[2], time_steps = 1:dim(N)[3]) ## S4 method for signature 'missing,LeMans_outputs' get_biomass( wgt, outputs, species = 1:dim(outputs@N)[2], time_steps = 1:dim(outputs@N)[3], species_names = NULL ) ## S4 method for signature 'missing,missing' get_biomass( wgt, N, species = 1:dim(N)[2], time_steps = 1:dim(N)[3], species_names = NULL )
get_SSB(inputs, outputs, ...) ## S4 method for signature 'LeMans_param,LeMans_outputs' get_SSB( inputs, outputs, species = 1:dim(outputs@N)[2], time_steps = 1:dim(outputs@N)[3] ) ## S4 method for signature 'LeMans_param,missing' get_SSB(inputs, N, species = 1:dim(N)[2], time_steps = 1:dim(N)[3]) ## S4 method for signature 'missing,LeMans_outputs' get_SSB( wgt, mature, outputs, species = 1:dim(outputs@N)[2], time_steps = 1:dim(outputs@N)[3], species_names = NULL ) ## S4 method for signature 'missing,missing' get_SSB( wgt, mature, N, species = 1:dim(N)[2], time_steps = 1:dim(N)[3], species_names = NULL ) get_biomass(inputs, outputs, ...) ## S4 method for signature 'LeMans_param,LeMans_outputs' get_biomass( inputs, outputs, species = 1:dim(outputs@N)[2], time_steps = 1:dim(outputs@N)[3] ) ## S4 method for signature 'LeMans_param,missing' get_biomass(inputs, N, species = 1:dim(N)[2], time_steps = 1:dim(N)[3]) ## S4 method for signature 'missing,LeMans_outputs' get_biomass( wgt, outputs, species = 1:dim(outputs@N)[2], time_steps = 1:dim(outputs@N)[3], species_names = NULL ) ## S4 method for signature 'missing,missing' get_biomass( wgt, N, species = 1:dim(N)[2], time_steps = 1:dim(N)[3], species_names = NULL )
inputs |
A LeMans_param object containing the parameter values of the current LeMans model. |
outputs |
A LeMans_outputs object containing the outputs of the model run. |
... |
Additional arguments. |
species |
A numeric value or vector or a character string or vector of the species that you wish to calculate the mean maximum length. The default is |
time_steps |
A numeric vector of the time steps that you wish to calculate the mean maximum length. The default is |
N |
An array with dimensions |
wgt |
A matrix with dimensions |
mature |
A matrix with dimensions |
species_names |
A character vector of length |
The SSB for each species in species
is equal to:
colSums(N[, species]*wgt[, species]*mature[, species])
.
The biomass for each species in species
is equal to:
colSums(N[, species]*wgt[, species])
If length(species)>1
, get_SSB
returns a matrix with dimensions length(time_steps)
by length(species)
where the i,j
th element is the SSB (g) of the j
th species
in the i
th time_steps
. If length(species)==1
, the function will return a numeric vector of length length(time_steps)
.
If length(species)>1
, get_biomass
returns a matrix with dimensions length(time_steps)
by length(species)
where the i,j
th element is the biomass (g) of the j
th species
in the i
th time_steps
. If length(species)==1
, the function will return a numeric vector of length length(time_steps)
.
# Set up and run the model NS_params <- LeMansParam(NS_par, tau=NS_tau, eta=rep(0.25, 21), L50=NS_par$Lmat, other=1e12) effort <- matrix(0.5, 10, dim(NS_params@Qs)[3]) model_run <- run_LeMans(NS_params, years=10, effort=effort) # Calculate SSB get_SSB(inputs=NS_params, outputs=model_run) # Calculate biomass get_biomass(inputs=NS_params, outputs=model_run)
# Set up and run the model NS_params <- LeMansParam(NS_par, tau=NS_tau, eta=rep(0.25, 21), L50=NS_par$Lmat, other=1e12) effort <- matrix(0.5, 10, dim(NS_params@Qs)[3]) model_run <- run_LeMans(NS_params, years=10, effort=effort) # Calculate SSB get_SSB(inputs=NS_params, outputs=model_run) # Calculate biomass get_biomass(inputs=NS_params, outputs=model_run)
An S4 class representing the outputs of the LeMans model
N
An array with dimensions nsc
, nfish
and tot_time
representing the number of individuals in each length class at each time step of the model.
Catch
An array with dimensions nsc
, nfish
and tot_time
representing the biomass of each species that is caught in each length class at each time step of the model.
M2
An array with dimensions nsc
, nfish
and tot_time
representing the predation mortality of each species in each length class at each time step of the model.
R
A matrix with dimensions tot_time
and nfish
representing the number of recruits of each species at each time step of the model.
An S4 class representing the inputs of the LeMans model
Sets the class of a LeMansParam object, which is then used to run the LeMans model.
nsc
A numeric value representing the number of length classes in the model.
nfish
A numeric value representing the number of fish species in the model.
phi_min
A numeric value representing the time step of the model.
l_bound
A numeric vector of length nsc
representing the lower bounds of the length classes.
u_bound
A numeric vector of length nsc
representing the upper bounds of the length classes.
mid
A numeric vector of length nfish
representing the mid-point of the length classes.
species_names
A numeric or character vector of length nfish
that denotes the names of the species in the model.
Linf
A numeric vector of length nfish
representing the mid-point of the length classes.
W_a
A numeric vector representing the parameter a
in the length-weight conversion.
W_b
A numeric vector representing the parameter b
in the length-weight conversion.
k
k A numeric vector of length nfish
representing the von Bertalanffy growth parameter (1/yr)
for each species.
Lmat
A numeric vector of length nsc
representing the length at which 50% of the individuals are mature.
mature
A matrix with dimensions nsc
and nfish
with elements in the range 0-1 representing the proportion of mature individuals of each species in each length class.
sc_Linf
A numeric vector of length nsc
representing the length class at which each species reaches its asymptotic length.
wgt
A matrix with dimensions nsc
and nfish
representing the weight of each species in each length class.
phi
A matrix with dimensions nsc
and nfish
representing the proportion of individuals that leave each length class.
ration
A matrix with dimensions nsc
and nfish
representing the amount of food required for fish of a given species and length class to grow according to the von Bertalanffy growth curve in a time step.
other
A numeric value representing the amount of other food (g) available from prey that is not explicitly represented in the model.
M1
A matrix of dimensions nsc
and nfish
representing the natural mortality of each species for each length class.
suit_M2
A list object of length nfish
. Each element in the list is an array of dimensions nsc
, nsc
and nfish
containing a value between 0 and 1 representing prey preference and prey suitability for each species and length class.
Qs
An array of dimensions nsc
, nfish
and length(gear)
representing the catchability of each species by each of the fishing gears.
stored_rec_funs
A list object of length rec_fun
where each element includes the stock recruitment function for a given species. If an invalid recruitment function is selected, NULL
is returned and a warning message is shown.
eps
A numeric value specifying a numerical offset. The default value is 1e-5
.
recruit_params
A list object of length nfish
specifying the parameters for the recruitment function.
LeMansParam
classA constructor for the LeMansParam
class.
LeMansParam(df, gdf, ...) ## S4 method for signature 'ANY,ANY' LeMansParam( df, gdf, nfish = nrow(df), nsc = 32, pred_mu = -2.25, pred_sigma = 0.5, other = 1e+12, bounds = NULL, calc_phi_min = FALSE, phi_min = 0.1, vary_growth = TRUE, growth_eff = 0.5, growth_eff_decay = 0.11, eps = 1e-05, force_mature = TRUE, species_names = paste("species", 1:nfish, sep = "_"), kappa = rep(10, nfish), tau = matrix(1, nfish, nfish), rec_fun = rep("hockey-stick", nfish), recruit_params = list(a = 18.835 - 4.133 * df$Linf, b = rep(1000/nfish, nfish)), natmort_opt = rep("std_RNM", nfish), Nmort = rep(0.8, nfish), prop = rep(3/4, nfish), curve = rep("logistic", nfish), catch_species = ((0:(length(curve) - 1))%%nfish) + 1, max_catchability = rep(1, length(curve)), gear_name = paste("gear_", 1:length(curve), sep = ""), custom = NULL, ... ) ## S4 method for signature 'missing,ANY' LeMansParam( gdf, nfish = length(Linf), nsc = 32, pred_mu = -2.25, pred_sigma = 0.5, other = 1e+12, bounds = NULL, calc_phi_min = FALSE, phi_min = 0.1, vary_growth = FALSE, growth_eff = 0.5, growth_eff_decay = 0.11, eps = 1e-05, force_mature = TRUE, Linf, k, W_a, W_b, Lmat, species_names = paste("species", 1:nfish, sep = "_"), kappa = rep(10, nfish), tau = matrix(1, nfish, nfish), rec_fun = rep("hockey-stick", nfish), recruit_params = list(a = 18.835 - 4.133 * Linf, b = rep(1000/nfish, nfish)), natmort_opt = rep("std_RNM", nfish), Nmort = rep(0.8, nfish), prop = rep(3/4, nfish), curve = rep("logistic", nfish), catch_species = ((0:(length(curve) - 1))%%nfish) + 1, max_catchability = rep(1, length(curve)), gear_name = paste("gear_", 1:length(curve), sep = ""), custom = NULL, ... ) ## S4 method for signature 'missing,missing' LeMansParam( df, gdf, nfish = length(Linf), nsc = 32, pred_mu = -2.25, pred_sigma = 0.5, other = 1e+12, bounds = NULL, calc_phi_min = TRUE, phi_min = 0.1, vary_growth = FALSE, growth_eff = 0.5, growth_eff_decay = 0.11, eps = 1e-05, force_mature = TRUE, species_names = paste("species", 1:nfish, sep = "_"), Linf, k, W_a, W_b, Lmat, kappa = rep(10, nfish), tau = matrix(1, nfish, nfish), rec_fun = rep("hockey-stick", nfish), recruit_params = list(a = 18.835 - 4.133 * Linf, b = rep(1000/nfish, nfish)), natmort_opt = rep("std_RNM", nfish), Nmort = rep(0.8, nfish), prop = rep(3/4, nfish), curve = rep("logistic", nfish), catch_species = ((0:(length(curve) - 1))%%nfish) + 1, max_catchability = rep(1, length(curve)), gear_name = paste("gear_", 1:length(curve), sep = ""), custom = NULL, ... )
LeMansParam(df, gdf, ...) ## S4 method for signature 'ANY,ANY' LeMansParam( df, gdf, nfish = nrow(df), nsc = 32, pred_mu = -2.25, pred_sigma = 0.5, other = 1e+12, bounds = NULL, calc_phi_min = FALSE, phi_min = 0.1, vary_growth = TRUE, growth_eff = 0.5, growth_eff_decay = 0.11, eps = 1e-05, force_mature = TRUE, species_names = paste("species", 1:nfish, sep = "_"), kappa = rep(10, nfish), tau = matrix(1, nfish, nfish), rec_fun = rep("hockey-stick", nfish), recruit_params = list(a = 18.835 - 4.133 * df$Linf, b = rep(1000/nfish, nfish)), natmort_opt = rep("std_RNM", nfish), Nmort = rep(0.8, nfish), prop = rep(3/4, nfish), curve = rep("logistic", nfish), catch_species = ((0:(length(curve) - 1))%%nfish) + 1, max_catchability = rep(1, length(curve)), gear_name = paste("gear_", 1:length(curve), sep = ""), custom = NULL, ... ) ## S4 method for signature 'missing,ANY' LeMansParam( gdf, nfish = length(Linf), nsc = 32, pred_mu = -2.25, pred_sigma = 0.5, other = 1e+12, bounds = NULL, calc_phi_min = FALSE, phi_min = 0.1, vary_growth = FALSE, growth_eff = 0.5, growth_eff_decay = 0.11, eps = 1e-05, force_mature = TRUE, Linf, k, W_a, W_b, Lmat, species_names = paste("species", 1:nfish, sep = "_"), kappa = rep(10, nfish), tau = matrix(1, nfish, nfish), rec_fun = rep("hockey-stick", nfish), recruit_params = list(a = 18.835 - 4.133 * Linf, b = rep(1000/nfish, nfish)), natmort_opt = rep("std_RNM", nfish), Nmort = rep(0.8, nfish), prop = rep(3/4, nfish), curve = rep("logistic", nfish), catch_species = ((0:(length(curve) - 1))%%nfish) + 1, max_catchability = rep(1, length(curve)), gear_name = paste("gear_", 1:length(curve), sep = ""), custom = NULL, ... ) ## S4 method for signature 'missing,missing' LeMansParam( df, gdf, nfish = length(Linf), nsc = 32, pred_mu = -2.25, pred_sigma = 0.5, other = 1e+12, bounds = NULL, calc_phi_min = TRUE, phi_min = 0.1, vary_growth = FALSE, growth_eff = 0.5, growth_eff_decay = 0.11, eps = 1e-05, force_mature = TRUE, species_names = paste("species", 1:nfish, sep = "_"), Linf, k, W_a, W_b, Lmat, kappa = rep(10, nfish), tau = matrix(1, nfish, nfish), rec_fun = rep("hockey-stick", nfish), recruit_params = list(a = 18.835 - 4.133 * Linf, b = rep(1000/nfish, nfish)), natmort_opt = rep("std_RNM", nfish), Nmort = rep(0.8, nfish), prop = rep(3/4, nfish), curve = rep("logistic", nfish), catch_species = ((0:(length(curve) - 1))%%nfish) + 1, max_catchability = rep(1, length(curve)), gear_name = paste("gear_", 1:length(curve), sep = ""), custom = NULL, ... )
df |
A data frame with |
gdf |
A data frame with |
... |
Additional arguments for calculating catchability curves. See |
nfish |
A numeric value representing the number of fish species in the model. |
nsc |
A numeric value representing the number of length classes in the model. |
pred_mu |
A numeric value representing the preferred predator-prey mass ratio. |
pred_sigma |
A numeric value representing the width of the weight preference function. |
other |
A numeric value representing the amount of other food (g) available from prey that is not explicitly represented in the model. The default is |
bounds |
An optional argument specifying the bounds of the length classes. |
calc_phi_min |
A logical statement indicating whether |
phi_min |
A fixed numeric value of |
vary_growth |
A logical statement indicating whether growth efficiency should vary for each species ( |
growth_eff |
If |
growth_eff_decay |
A numeric value specifying the rate at which growth efficiency decreases as length increases to |
eps |
A numeric value specifying a numerical offset. The default value is |
force_mature |
A logical statement indicating whether to force maturity for all fish in the largest length class. The default is |
species_names |
A numeric or character vector of length |
kappa |
A numeric vector of length |
tau |
A matrix with dimensions |
rec_fun |
A character vector representing the stock recruitment function to be applied to each species. The default value is |
recruit_params |
A list object of length |
natmort_opt |
A character vector of length |
Nmort |
A numeric vector of length |
prop |
A numeric vector of length |
curve |
A character vector of almost any length describing the type of curve to be used to determine the catchability of each species by fishing gear. By default, |
catch_species |
A numeric value or character string describing the species to apply the catchability curve to. |
max_catchability |
A numeric vector of length |
gear_name |
A character vector of the same length as |
custom |
An array with dimensions |
Linf |
A numeric vector of length |
k |
k A numeric vector of length |
W_a |
A numeric vector representing the parameter |
W_b |
A numeric vector representing the parameter |
Lmat |
A numeric vector of length |
Converts objects of class data frame or vector to class LeMansParams for use in the LeMans model. Linf
, W_a
, W_b
, k
and Lmat
are required as either a data frame or as vectors.
An object of class LeMansParam
for use in the LeMans model.
# To run the model with all inputs specified explicitly: # Set up species-specific parameters Linf <- NS_par$Linf # the von-Bertalanffy asymptotic length of each species (cm). W_a <- NS_par$W_a # length-weight conversion parameter. W_b <- NS_par$W_b # length-weight conversion parameter. k <- NS_par$k # the von-Bertalnaffy growth parameter. Lmat <- NS_par$Lmat # the length at which 50% of individuals are mature (cm). NS_params <- LeMansParam(species_names=NS_par$species_names, Linf=Linf, k=k, W_a=W_a, W_b=W_b, Lmat=Lmat, tau=NS_tau, recruit_params=list(a=NS_par$a, b=NS_par$b), eta=rep(0.25, 21), L50=Lmat, other=NS_other) ############################################### # Alternatively: NS_params <- LeMansParam(NS_par, tau=NS_tau, eta=rep(0.25, 21), L50=NS_par$Lmat, other=NS_other)
# To run the model with all inputs specified explicitly: # Set up species-specific parameters Linf <- NS_par$Linf # the von-Bertalanffy asymptotic length of each species (cm). W_a <- NS_par$W_a # length-weight conversion parameter. W_b <- NS_par$W_b # length-weight conversion parameter. k <- NS_par$k # the von-Bertalnaffy growth parameter. Lmat <- NS_par$Lmat # the length at which 50% of individuals are mature (cm). NS_params <- LeMansParam(species_names=NS_par$species_names, Linf=Linf, k=k, W_a=W_a, W_b=W_b, Lmat=Lmat, tau=NS_tau, recruit_params=list(a=NS_par$a, b=NS_par$b), eta=rep(0.25, 21), L50=Lmat, other=NS_other) ############################################### # Alternatively: NS_params <- LeMansParam(NS_par, tau=NS_tau, eta=rep(0.25, 21), L50=NS_par$Lmat, other=NS_other)
Generates the stock recruitment function for a given species.
make_rec_fun(rec_fun = "hockey-stick")
make_rec_fun(rec_fun = "hockey-stick")
rec_fun |
A character vector representing the stock recruitment function to be applied to each species. The default is |
For "Beverton-Holt"
, the stock recruitment function is defined as a*SSB/(1+b*SSB)
; for "Ricker"
it is defined as a*SSB*exp(-b*SSB)
; for "hockey-stick"
it is defined as min(a*SSB, b)
; for "constant"
it is defined as a
, and for "linear"
it is defined as a*SSB
. In all cases, SSB
is the Spawning Stock Biomass in 1000s of tonnes and a
and b
are parameters of the specific stock recruitment functions.
The stock recruitment function for a given species. If an invalid recruitment function is selected, NULL
is returned and a warning message is shown.
Barrowman, N.J., Myers, R.A. (2000). Still more spawner-recruit curves: the hockey stick and its generalisations. Canadian Journal of Fisheries and Aquatic Science, 57:665–676.
Beverton, R.J.H., Holt, S.J. (1957). On the Dynamics of Exploited Fish Populations, volume 19 of Fisheries Investigations (Series 2). United Kingdom Ministry of Agriculture and Fisheries.
Hall, S. J., Collie, J. S., Duplisea, D. E., Jennings, S., Bravington, M., & Link, J. (2006). A length-based multispecies model for evaluating community responses to fishing. Canadian Journal of Fisheries and Aquatic Sciences, 63(6):1344-1359.
Ogle, D.H. (2016). Introductory Fisheries Analyses with R. CRC Press.
Ricker, W.E. (1954). Stock and recruitment. Journal of the Fisheries Research Board of Canada, 11:559-623.
Thorpe, R.B., Le Quesne, W.J.F., Luxford, F., Collie, J.S., Jennings, S. (2015). Evaluation and management implications of uncertainty in a multispecies size-structured model of population and community responses to fishing. Methods in Ecology and Evolution, 6:49-58.
calc_recruits
, get_rec_fun
, rec_BH
, rec_Ricker
, rec_hockey
, rec_const
, rec_linear
and calc_SSB
# Run the function make_rec_fun("Ricker")
# Run the function make_rec_fun("Ricker")
The steepness of the slope of the catchability curve associated with NS_mixed_fish
.
NS_eta
NS_eta
A numeric value representing the steepness of the slope of the catchability curve.
Thorpe, R.B., Dolder, P.J. , Reeves, S., Robinson, P., Jennings, S. (2015). Assessing fishery and ecological consequences of alternative management options for multispecies fisheries ICES Journal of Marine Science, 73(6):1503-1512.
The length at 50% of the maximum catchability of the catchability curve associated with NS_mixed_fish
.
NS_L50
NS_L50
A numeric value representing the length at 50% of the maximum catchability of the catchability curve.
Thorpe, R.B., Dolder, P.J. , Reeves, S., Robinson, P., Jennings, S. (2015). Assessing fishery and ecological consequences of alternative management options for multispecies fisheries ICES Journal of Marine Science, 73(6):1503-1512.
A gear selectivity data frame for the 21 species in NS_par
.
NS_mixed_fish
NS_mixed_fish
A data frame with 21 rows and 4 variables, including:
catch_species
A character string describing the species to apply the catchability curve to.
curve
A character vector describing the type of curve to be used to determine the catchability of each species by the fishing gear.
gear_name
A character string describing the name of the gear.
max_catchability
A numeric vector describing the maximum catchability for each catchability curve.
Thorpe, R.B., Dolder, P.J. , Reeves, S., Robinson, P., Jennings, S. (2015). Assessing fishery and ecological consequences of alternative management options for multispecies fisheries ICES Journal of Marine Science, 73(6):1503-1512.
Other food for the North Sea dataset, NS_par
.
NS_other
NS_other
A numerical value representing other food. To be used with NS_par
.
Data for the 21 species in the North Sea version of the LeMans model.
NS_par
NS_par
A data frame with 21 rows and 8 variables, including:
species_names
A numeric or character vector of length nfish
that denotes the names of the species in the model.
Linf
A numeric vector of length nfish
representing the asymptotic length of each species (cm).
W_a
A numeric vector of length nfish
representing the parameter a
in the length-weight conversion.
W_b
A numeric vector of length nfish
representing the parameter b
in the length-weight conversion.
k
A numeric vector of length nfish
representing the von Bertalanffy growth parameter (1/yr)
for each species.
Lmat
A numeric vector of length nsc
representing the length at which 50% of the individuals are mature (cm).
a
A numeric value representing the density independent part of the hockey-stick recruitment curve.
b
A numeric value representing the density dependent part of the hockey-stick recruitment curve.
Thorpe, R.B., Le Quesne, W.J.F., Luxford, F., Collie, J.S., Jennings, S. (2015). Evaluation and management implications of uncertainty in a multispecies size-structured model of population and community responses to fishing. Methods in Ecology and Evolution, 6:49-58.
A predator-prey interaction matrix for the 21 species in NS_par
.
NS_tau
NS_tau
A matrix with 21 rows and 21 columns:
Row indices represent predators and column indices represent prey. A value of 1 at location i
, j
indicates prey j
is eaten by predator i
.
Thorpe, R.B., Le Quesne, W.J.F., Luxford, F., Collie, J.S., Jennings, S. (2015). Evaluation and management implications of uncertainty in a multispecies size-structured model of population and community responses to fishing. Methods in Ecology and Evolution, 6:49-58.
Plots Mean Maximum Length (MML), the Large Fish Indicator (LFI), Typical Length (TyL) and the Length Quantiles (LQ) of the whole community or a subset of the species.
plot_indicators(inputs, outputs, ...) ## S4 method for signature 'LeMans_param,LeMans_outputs' plot_indicators(inputs, outputs, species, time_steps, prob, length_LFI, ...) ## S4 method for signature 'LeMans_param,missing' plot_indicators(inputs, N, species, time_steps, prob, length_LFI, ...) ## S4 method for signature 'missing,LeMans_outputs' plot_indicators( wgt, mid, l_bound, u_bound, Linf, species, outputs, time_steps, species_names = NULL, prob, length_LFI, ... ) ## S4 method for signature 'missing,missing' plot_indicators( wgt, mid, l_bound, u_bound, Linf, N, species, time_steps, species_names = NULL, prob, length_LFI, MML, TyL, LFI, LQ, units = "cm", ... ) plot_LFI(inputs, outputs, ...) ## S4 method for signature 'LeMans_param,LeMans_outputs' plot_LFI( inputs, outputs, species, time_steps, species_names, length_LFI, LFI, ... ) ## S4 method for signature 'LeMans_param,missing' plot_LFI(inputs, N, species, time_steps, species_names, length_LFI, LFI, ...) ## S4 method for signature 'missing,LeMans_outputs' plot_LFI( wgt, l_bound, u_bound, outputs, species, time_steps, species_names, length_LFI, LFI, ... ) ## S4 method for signature 'missing,missing' plot_LFI( wgt, l_bound, u_bound, N, species, time_steps, species_names, length_LFI, LFI, units = "cm", ... ) plot_MML(inputs, outputs, ...) ## S4 method for signature 'LeMans_param,LeMans_outputs' plot_MML(inputs, outputs, species, species_names, time_steps, MML, ...) ## S4 method for signature 'LeMans_param,missing' plot_MML(inputs, N, species, time_steps, species_names, MML, ...) ## S4 method for signature 'missing,LeMans_outputs' plot_MML(wgt, Linf, outputs, species, time_steps, species_names, MML, ...) ## S4 method for signature 'missing,missing' plot_MML( wgt, Linf, N, species, time_steps, species_names, MML, units = "cm", ... ) plot_TyL(inputs, outputs, ...) ## S4 method for signature 'LeMans_param,LeMans_outputs' plot_TyL(inputs, outputs, species, time_steps, species_names, TyL, ...) ## S4 method for signature 'LeMans_param,missing' plot_TyL(inputs, N, species, time_steps, species_names, TyL, ...) ## S4 method for signature 'missing,LeMans_outputs' plot_TyL(wgt, mid, outputs, species, time_steps, species_names, TyL, ...) ## S4 method for signature 'missing,missing' plot_TyL( wgt, mid, N, species, time_steps, species_names, TyL, units = "cm", ... ) plot_LQ(inputs, outputs, ...) ## S4 method for signature 'LeMans_param,LeMans_outputs' plot_LQ(inputs, outputs, species, time_steps, species_names, LQ, prob, ...) ## S4 method for signature 'LeMans_param,missing' plot_LQ(inputs, N, species, species_names, time_steps, LQ, prob, ...) ## S4 method for signature 'missing,LeMans_outputs' plot_LQ( wgt, u_bound, outputs, species, time_steps, species_names, LQ, prob, ... ) ## S4 method for signature 'missing,missing' plot_LQ( wgt, u_bound, N, species, time_steps, species_names, LQ, prob, units = "cm", ... )
plot_indicators(inputs, outputs, ...) ## S4 method for signature 'LeMans_param,LeMans_outputs' plot_indicators(inputs, outputs, species, time_steps, prob, length_LFI, ...) ## S4 method for signature 'LeMans_param,missing' plot_indicators(inputs, N, species, time_steps, prob, length_LFI, ...) ## S4 method for signature 'missing,LeMans_outputs' plot_indicators( wgt, mid, l_bound, u_bound, Linf, species, outputs, time_steps, species_names = NULL, prob, length_LFI, ... ) ## S4 method for signature 'missing,missing' plot_indicators( wgt, mid, l_bound, u_bound, Linf, N, species, time_steps, species_names = NULL, prob, length_LFI, MML, TyL, LFI, LQ, units = "cm", ... ) plot_LFI(inputs, outputs, ...) ## S4 method for signature 'LeMans_param,LeMans_outputs' plot_LFI( inputs, outputs, species, time_steps, species_names, length_LFI, LFI, ... ) ## S4 method for signature 'LeMans_param,missing' plot_LFI(inputs, N, species, time_steps, species_names, length_LFI, LFI, ...) ## S4 method for signature 'missing,LeMans_outputs' plot_LFI( wgt, l_bound, u_bound, outputs, species, time_steps, species_names, length_LFI, LFI, ... ) ## S4 method for signature 'missing,missing' plot_LFI( wgt, l_bound, u_bound, N, species, time_steps, species_names, length_LFI, LFI, units = "cm", ... ) plot_MML(inputs, outputs, ...) ## S4 method for signature 'LeMans_param,LeMans_outputs' plot_MML(inputs, outputs, species, species_names, time_steps, MML, ...) ## S4 method for signature 'LeMans_param,missing' plot_MML(inputs, N, species, time_steps, species_names, MML, ...) ## S4 method for signature 'missing,LeMans_outputs' plot_MML(wgt, Linf, outputs, species, time_steps, species_names, MML, ...) ## S4 method for signature 'missing,missing' plot_MML( wgt, Linf, N, species, time_steps, species_names, MML, units = "cm", ... ) plot_TyL(inputs, outputs, ...) ## S4 method for signature 'LeMans_param,LeMans_outputs' plot_TyL(inputs, outputs, species, time_steps, species_names, TyL, ...) ## S4 method for signature 'LeMans_param,missing' plot_TyL(inputs, N, species, time_steps, species_names, TyL, ...) ## S4 method for signature 'missing,LeMans_outputs' plot_TyL(wgt, mid, outputs, species, time_steps, species_names, TyL, ...) ## S4 method for signature 'missing,missing' plot_TyL( wgt, mid, N, species, time_steps, species_names, TyL, units = "cm", ... ) plot_LQ(inputs, outputs, ...) ## S4 method for signature 'LeMans_param,LeMans_outputs' plot_LQ(inputs, outputs, species, time_steps, species_names, LQ, prob, ...) ## S4 method for signature 'LeMans_param,missing' plot_LQ(inputs, N, species, species_names, time_steps, LQ, prob, ...) ## S4 method for signature 'missing,LeMans_outputs' plot_LQ( wgt, u_bound, outputs, species, time_steps, species_names, LQ, prob, ... ) ## S4 method for signature 'missing,missing' plot_LQ( wgt, u_bound, N, species, time_steps, species_names, LQ, prob, units = "cm", ... )
inputs |
A |
outputs |
A |
... |
Additional arguments. |
species |
A numeric value or vector or a character string or vector denoting the species to be used to calculate the indicators. This option is only required if |
time_steps |
A numeric vector denoting the time steps to be used to calculate and/or plot the indicators. The default is |
prob |
A numeric value or vector between 0 and 1 denoting the LQ(s) to be calculated. This option is only required if |
length_LFI |
A numeric value or vector representing the threshold(s) to be used to calculate the LFI. This option is only required if |
N |
An array with dimensions |
wgt |
A matrix with dimensions |
mid |
A numeric vector of length |
l_bound |
A numeric vector of length |
u_bound |
A numeric vector of length |
Linf |
A numeric vector of length |
species_names |
A character vector of length |
MML |
A numeric vector representing the outputs of the function |
TyL |
A numeric vector representing the outputs of the function |
LFI |
A numeric vector or matrix representing the outputs of the function |
LQ |
A numeric vector or matrix representing the outputs of the function |
units |
A character string denoting the units of length used in the model. The default is |
plot_indicators
returns a set of four line plots depicting changes in the MML, LFI, TyL and LQ(s) of the community (including only the selected species) over time.
plot_LFI
returns a line plot depicting the LFI of the community (including only the selected species) over time.
plot_MML
returns a line plot depicting the MML of the community (including only the selected species) over time.
plot_TYL
returns a line plot depicting the TyL of the community (including only the selected species) over time.
plot_LQ
returns a line plot depicting the LQ(s) of the community (including only the selected species) over time.
# Set up and run the model NS_params <- LeMansParam(NS_par, tau=NS_tau, eta=rep(0.25, 21), L50=NS_par$Lmat, other=1e12) effort <- matrix(0.5, 10, dim(NS_params@Qs)[3]) model_run <- run_LeMans(NS_params, years=10, effort=effort) # Calculate the indicators tmp <- get_indicators(NS_params, model_run) MML <- tmp$MML LFI <- tmp$LFI TyL <- tmp$TYL LQ <- tmp$LQ # Plot the indicators plot_indicators(MML=MML, LFI=LFI, TyL=TyL, LQ=LQ) # Plot the LFI plot_LFI(LFI=LFI) # Plot MML plot_MML(MML=MML) # Plot the TyL plot_TyL(TyL=TyL) # Plot the LQs plot_LQ(LQ=LQ)
# Set up and run the model NS_params <- LeMansParam(NS_par, tau=NS_tau, eta=rep(0.25, 21), L50=NS_par$Lmat, other=1e12) effort <- matrix(0.5, 10, dim(NS_params@Qs)[3]) model_run <- run_LeMans(NS_params, years=10, effort=effort) # Calculate the indicators tmp <- get_indicators(NS_params, model_run) MML <- tmp$MML LFI <- tmp$LFI TyL <- tmp$TYL LQ <- tmp$LQ # Plot the indicators plot_indicators(MML=MML, LFI=LFI, TyL=TyL, LQ=LQ) # Plot the LFI plot_LFI(LFI=LFI) # Plot MML plot_MML(MML=MML) # Plot the TyL plot_TyL(TyL=TyL) # Plot the LQs plot_LQ(LQ=LQ)
Plots community and/or species-specific Spawning Stock Biomass (SSB) or total biomass.
plot_SSB(inputs, outputs, ...) ## S4 method for signature 'LeMans_param,LeMans_outputs' plot_SSB(inputs, outputs, species, time_steps, species_names, SSB, ...) ## S4 method for signature 'LeMans_param,missing' plot_SSB(inputs, N, species, time_steps, species_names, SSB, ...) ## S4 method for signature 'missing,LeMans_outputs' plot_SSB(wgt, mature, outputs, species, time_steps, species_names, SSB, ...) ## S4 method for signature 'missing,missing' plot_SSB( wgt, mature, N, species, species_names, time_steps, SSB, full_plot_only = TRUE, units = "g", ... ) plot_biomass(inputs, outputs, ...) ## S4 method for signature 'LeMans_param,LeMans_outputs' plot_biomass(inputs, outputs, species, time_steps, species_names, biomass, ...) ## S4 method for signature 'LeMans_param,missing' plot_biomass(inputs, N, species, time_steps, biomass, species_names, ...) ## S4 method for signature 'missing,LeMans_outputs' plot_biomass(wgt, outputs, species, time_steps, biomass, species_names, ...) ## S4 method for signature 'missing,missing' plot_biomass( wgt, N, species, time_steps, species_names, biomass, full_plot_only = TRUE, units = "g", ... )
plot_SSB(inputs, outputs, ...) ## S4 method for signature 'LeMans_param,LeMans_outputs' plot_SSB(inputs, outputs, species, time_steps, species_names, SSB, ...) ## S4 method for signature 'LeMans_param,missing' plot_SSB(inputs, N, species, time_steps, species_names, SSB, ...) ## S4 method for signature 'missing,LeMans_outputs' plot_SSB(wgt, mature, outputs, species, time_steps, species_names, SSB, ...) ## S4 method for signature 'missing,missing' plot_SSB( wgt, mature, N, species, species_names, time_steps, SSB, full_plot_only = TRUE, units = "g", ... ) plot_biomass(inputs, outputs, ...) ## S4 method for signature 'LeMans_param,LeMans_outputs' plot_biomass(inputs, outputs, species, time_steps, species_names, biomass, ...) ## S4 method for signature 'LeMans_param,missing' plot_biomass(inputs, N, species, time_steps, biomass, species_names, ...) ## S4 method for signature 'missing,LeMans_outputs' plot_biomass(wgt, outputs, species, time_steps, biomass, species_names, ...) ## S4 method for signature 'missing,missing' plot_biomass( wgt, N, species, time_steps, species_names, biomass, full_plot_only = TRUE, units = "g", ... )
inputs |
A |
outputs |
A |
... |
Additional arguments. |
species |
A numeric value or vector or a character string or vector denoting the species to be used in the plot(s). The default is |
time_steps |
A numeric vector denoting the time steps to be used to calculate and/or plot SSB. The default is |
species_names |
A character vector of length |
SSB |
A numeric vector or a matrix representing the outputs of the function |
N |
An array with dimensions |
wgt |
A matrix with dimensions |
mature |
A matrix with dimensions |
full_plot_only |
A logical statement indicating whether a single plot depicting the SSB of all of the selected species should be produced ( |
units |
A character string denoting the units of weight used in the model. The default is |
biomass |
A numeric vector or a matrix representing the outputs of the function |
plot_SSB
returns line plots of the in SSB of the selected species through time.
plot_biomass
returns line plots of the changes in biomass of the selected species through time.
# Set up and run the model NS_params <- LeMansParam(NS_par, tau=NS_tau, eta=rep(0.25, 21), L50=NS_par$Lmat, other=1e12) effort <- matrix(0.5, 10, dim(NS_params@Qs)[3]) model_run <- run_LeMans(NS_params, years=10, effort=effort) # Calculate SSB SSB <- get_SSB(NS_params, model_run) # Plot SSB plot_SSB(SSB=SSB) # Calculate biomass biomass <- get_biomass(NS_params, model_run) # Plot biomass plot_biomass(biomass=biomass)
# Set up and run the model NS_params <- LeMansParam(NS_par, tau=NS_tau, eta=rep(0.25, 21), L50=NS_par$Lmat, other=1e12) effort <- matrix(0.5, 10, dim(NS_params@Qs)[3]) model_run <- run_LeMans(NS_params, years=10, effort=effort) # Calculate SSB SSB <- get_SSB(NS_params, model_run) # Plot SSB plot_SSB(SSB=SSB) # Calculate biomass biomass <- get_biomass(NS_params, model_run) # Plot biomass plot_biomass(biomass=biomass)
Calculates the number of recruits as given by the Beverton-Holt stock recruitment function.
rec_BH(SSB, rec_args)
rec_BH(SSB, rec_args)
SSB |
A numeric value representing the Spawning Stock Biomass (SSB) of a given species (g). |
rec_args |
A list object of length |
The Beverton-Holt stock recruitment function is defined as a*(SSB/1e9))/(1+b*(SSB/1e9))
.
A numeric value representing the number of recruits of a given species.
Beverton, R.J.H., Holt, S.J. (1957). On the Dynamics of Exploited Fish Populations, volume 19 of Fisheries Investigations (Series 2). United Kingdom Ministry of Agriculture and Fisheries.
calc_recruits
, make_rec_fun
, get_rec_fun
, rec_Ricker
, rec_hockey
, rec_const
, rec_linear
and calc_SSB
# Set up the inputs to the function - species-independent parameters nfish <- nrow(NS_par) nsc <- 32 maxsize <- max(NS_par$Linf)*1.01 # the biggest size is 1% bigger than the largest Linf l_bound <- seq(0, maxsize, maxsize/nsc); l_bound <- l_bound[-length(l_bound)] u_bound <- seq(maxsize/nsc, maxsize, maxsize/nsc) mid <- l_bound+(u_bound-l_bound)/2 # Set up the inputs to the function - species-specific parameters Linf <- NS_par$Linf # the von-Bertalanffy asymptotic length of each species (cm). W_a <- NS_par$W_a # length-weight conversion parameter. W_b <- NS_par$W_b # length-weight conversion parameter. k <- NS_par$k # the von-Bertalnaffy growth parameter. Lmat <- NS_par$Lmat # the length at which 50\% of individuals are mature (cm). # Get phi_min tmp <- calc_phi(k, Linf, nsc, nfish, u_bound, l_bound, calc_phi_min=FALSE, phi_min=0.1) # fixed phi_min phi_min <- tmp$phi_min # Run calc_ration_growthfac() tmp <- calc_ration_growthfac(k, Linf, nsc, nfish, l_bound, u_bound, mid, W_a, W_b, phi_min) sc_Linf <- tmp$sc_Linf wgt <- tmp$wgt # Calculate maturity mature <- calc_mature(Lmat, nfish, mid, kappa=rep(10, nfish), sc_Linf) # Create recruitment functions stored_rec_funs <- get_rec_fun(rep("hockey-stick", nfish)) recruit_params <- do.call("Map", c(c, list(a=NS_par$a, b=NS_par$b))) # Get an initial population N0 <- get_N0(nsc, nfish, mid, wgt, sc_Linf, intercept=1e10, slope=-5) # Calculate the SSB SSB <- calc_SSB(mature, N0, wgt) # Run the function rec_BH(SSB[1], recruit_params[[1]])
# Set up the inputs to the function - species-independent parameters nfish <- nrow(NS_par) nsc <- 32 maxsize <- max(NS_par$Linf)*1.01 # the biggest size is 1% bigger than the largest Linf l_bound <- seq(0, maxsize, maxsize/nsc); l_bound <- l_bound[-length(l_bound)] u_bound <- seq(maxsize/nsc, maxsize, maxsize/nsc) mid <- l_bound+(u_bound-l_bound)/2 # Set up the inputs to the function - species-specific parameters Linf <- NS_par$Linf # the von-Bertalanffy asymptotic length of each species (cm). W_a <- NS_par$W_a # length-weight conversion parameter. W_b <- NS_par$W_b # length-weight conversion parameter. k <- NS_par$k # the von-Bertalnaffy growth parameter. Lmat <- NS_par$Lmat # the length at which 50\% of individuals are mature (cm). # Get phi_min tmp <- calc_phi(k, Linf, nsc, nfish, u_bound, l_bound, calc_phi_min=FALSE, phi_min=0.1) # fixed phi_min phi_min <- tmp$phi_min # Run calc_ration_growthfac() tmp <- calc_ration_growthfac(k, Linf, nsc, nfish, l_bound, u_bound, mid, W_a, W_b, phi_min) sc_Linf <- tmp$sc_Linf wgt <- tmp$wgt # Calculate maturity mature <- calc_mature(Lmat, nfish, mid, kappa=rep(10, nfish), sc_Linf) # Create recruitment functions stored_rec_funs <- get_rec_fun(rep("hockey-stick", nfish)) recruit_params <- do.call("Map", c(c, list(a=NS_par$a, b=NS_par$b))) # Get an initial population N0 <- get_N0(nsc, nfish, mid, wgt, sc_Linf, intercept=1e10, slope=-5) # Calculate the SSB SSB <- calc_SSB(mature, N0, wgt) # Run the function rec_BH(SSB[1], recruit_params[[1]])
Calculates the number of recruits as given by the constant stock recruitment function.
rec_const(SSB, rec_args)
rec_const(SSB, rec_args)
SSB |
A numeric value representing the Spawning Stock Biomass (SSB) of a given species (g). |
rec_args |
A list object of length |
The number of recruits is defined as the value of a
.
A numeric value representing the number of recruits of a given species.
calc_recruits
, make_rec_fun
, get_rec_fun
, rec_BH
, rec_Ricker
, rec_hockey
, rec_linear
and calc_SSB
# Set up the inputs to the function - species-independent parameters nfish <- nrow(NS_par) nsc <- 32 maxsize <- max(NS_par$Linf)*1.01 # the biggest size is 1% bigger than the largest Linf l_bound <- seq(0, maxsize, maxsize/nsc); l_bound <- l_bound[-length(l_bound)] u_bound <- seq(maxsize/nsc, maxsize, maxsize/nsc) mid <- l_bound+(u_bound-l_bound)/2 # Set up the inputs to the function - species-specific parameters Linf <- NS_par$Linf # the von-Bertalanffy asymptotic length of each species (cm). W_a <- NS_par$W_a # length-weight conversion parameter. W_b <- NS_par$W_b # length-weight conversion parameter. k <- NS_par$k # the von-Bertalnaffy growth parameter. Lmat <- NS_par$Lmat # the length at which 50\% of individuals are mature (cm). # Get phi_min tmp <- calc_phi(k, Linf, nsc, nfish, u_bound, l_bound, calc_phi_min=FALSE, phi_min=0.1) # fixed phi_min phi_min <- tmp$phi_min # Run calc_ration_growthfac() tmp <- calc_ration_growthfac(k, Linf, nsc, nfish, l_bound, u_bound, mid, W_a, W_b, phi_min) sc_Linf <- tmp$sc_Linf wgt <- tmp$wgt # Calculate maturity mature <- calc_mature(Lmat, nfish, mid, kappa=rep(10, nfish), sc_Linf) # Create recruitment functions stored_rec_funs <- get_rec_fun(rep("hockey-stick", nfish)) recruit_params <- do.call("Map", c(c, list(a=NS_par$a, b=NS_par$b))) # Get an initial population N0 <- get_N0(nsc, nfish, mid, wgt, sc_Linf, intercept=1e10, slope=-5) # Calculate the SSB SSB <- calc_SSB(mature, N0, wgt) rec_const(SSB[1], recruit_params[[1]])
# Set up the inputs to the function - species-independent parameters nfish <- nrow(NS_par) nsc <- 32 maxsize <- max(NS_par$Linf)*1.01 # the biggest size is 1% bigger than the largest Linf l_bound <- seq(0, maxsize, maxsize/nsc); l_bound <- l_bound[-length(l_bound)] u_bound <- seq(maxsize/nsc, maxsize, maxsize/nsc) mid <- l_bound+(u_bound-l_bound)/2 # Set up the inputs to the function - species-specific parameters Linf <- NS_par$Linf # the von-Bertalanffy asymptotic length of each species (cm). W_a <- NS_par$W_a # length-weight conversion parameter. W_b <- NS_par$W_b # length-weight conversion parameter. k <- NS_par$k # the von-Bertalnaffy growth parameter. Lmat <- NS_par$Lmat # the length at which 50\% of individuals are mature (cm). # Get phi_min tmp <- calc_phi(k, Linf, nsc, nfish, u_bound, l_bound, calc_phi_min=FALSE, phi_min=0.1) # fixed phi_min phi_min <- tmp$phi_min # Run calc_ration_growthfac() tmp <- calc_ration_growthfac(k, Linf, nsc, nfish, l_bound, u_bound, mid, W_a, W_b, phi_min) sc_Linf <- tmp$sc_Linf wgt <- tmp$wgt # Calculate maturity mature <- calc_mature(Lmat, nfish, mid, kappa=rep(10, nfish), sc_Linf) # Create recruitment functions stored_rec_funs <- get_rec_fun(rep("hockey-stick", nfish)) recruit_params <- do.call("Map", c(c, list(a=NS_par$a, b=NS_par$b))) # Get an initial population N0 <- get_N0(nsc, nfish, mid, wgt, sc_Linf, intercept=1e10, slope=-5) # Calculate the SSB SSB <- calc_SSB(mature, N0, wgt) rec_const(SSB[1], recruit_params[[1]])
Calculates the number of recruits as given by the hockey-stick stock recruitment function.
rec_hockey(SSB, rec_args)
rec_hockey(SSB, rec_args)
SSB |
A numeric value representing the Spawning Stock Biomass (SSB) of a given species (g). |
rec_args |
A list object of length |
The stock recruitment function is defined as min(a*(SSB/1e9), b)
.
A numeric value representing the number of recruits of a given species.
Barrowman, N.J., Myers, R.A. (2000). Still more spawner-recruit curves: the hockey stick and its generalisations. Canadian Journal of Fisheries and Aquatic Science, 57:665–676.
Thorpe, R.B., Le Quesne, W.J.F., Luxford, F., Collie, J.S., Jennings, S. (2015). Evaluation and management implications of uncertainty in a multispecies size-structured model of population and community responses to fishing. Methods in Ecology and Evolution, 6:49-58.
calc_recruits
, make_rec_fun
, get_rec_fun
, rec_BH
, rec_Ricker
, rec_const
, rec_linear
and calc_SSB
# Set up the inputs to the function - species-independent parameters nfish <- nrow(NS_par) nsc <- 32 maxsize <- max(NS_par$Linf)*1.01 # the biggest size is 1% bigger than the largest Linf l_bound <- seq(0, maxsize, maxsize/nsc); l_bound <- l_bound[-length(l_bound)] u_bound <- seq(maxsize/nsc, maxsize, maxsize/nsc) mid <- l_bound+(u_bound-l_bound)/2 # Set up the inputs to the function - species-specific parameters Linf <- NS_par$Linf # the von-Bertalanffy asymptotic length of each species (cm). W_a <- NS_par$W_a # length-weight conversion parameter. W_b <- NS_par$W_b # length-weight conversion parameter. k <- NS_par$k # the von-Bertalnaffy growth parameter. Lmat <- NS_par$Lmat # the length at which 50\% of individuals are mature (cm). # Get phi_min tmp <- calc_phi(k, Linf, nsc, nfish, u_bound, l_bound, calc_phi_min=FALSE, phi_min=0.1) # fixed phi_min phi_min <- tmp$phi_min # Run calc_ration_growthfac() tmp <- calc_ration_growthfac(k, Linf, nsc, nfish, l_bound, u_bound, mid, W_a, W_b, phi_min) sc_Linf <- tmp$sc_Linf wgt <- tmp$wgt # Calculate maturity mature <- calc_mature(Lmat, nfish, mid, kappa=rep(10, nfish), sc_Linf) # Create recruitment functions stored_rec_funs <- get_rec_fun(rep("hockey-stick", nfish)) recruit_params <- do.call("Map", c(c, list(a=NS_par$a, b=NS_par$b))) # Get an initial population N0 <- get_N0(nsc, nfish, mid, wgt, sc_Linf, intercept=1e10, slope=-5) # Calculate the SSB SSB <- calc_SSB(mature, N0, wgt) rec_hockey(SSB[1], recruit_params[[1]])
# Set up the inputs to the function - species-independent parameters nfish <- nrow(NS_par) nsc <- 32 maxsize <- max(NS_par$Linf)*1.01 # the biggest size is 1% bigger than the largest Linf l_bound <- seq(0, maxsize, maxsize/nsc); l_bound <- l_bound[-length(l_bound)] u_bound <- seq(maxsize/nsc, maxsize, maxsize/nsc) mid <- l_bound+(u_bound-l_bound)/2 # Set up the inputs to the function - species-specific parameters Linf <- NS_par$Linf # the von-Bertalanffy asymptotic length of each species (cm). W_a <- NS_par$W_a # length-weight conversion parameter. W_b <- NS_par$W_b # length-weight conversion parameter. k <- NS_par$k # the von-Bertalnaffy growth parameter. Lmat <- NS_par$Lmat # the length at which 50\% of individuals are mature (cm). # Get phi_min tmp <- calc_phi(k, Linf, nsc, nfish, u_bound, l_bound, calc_phi_min=FALSE, phi_min=0.1) # fixed phi_min phi_min <- tmp$phi_min # Run calc_ration_growthfac() tmp <- calc_ration_growthfac(k, Linf, nsc, nfish, l_bound, u_bound, mid, W_a, W_b, phi_min) sc_Linf <- tmp$sc_Linf wgt <- tmp$wgt # Calculate maturity mature <- calc_mature(Lmat, nfish, mid, kappa=rep(10, nfish), sc_Linf) # Create recruitment functions stored_rec_funs <- get_rec_fun(rep("hockey-stick", nfish)) recruit_params <- do.call("Map", c(c, list(a=NS_par$a, b=NS_par$b))) # Get an initial population N0 <- get_N0(nsc, nfish, mid, wgt, sc_Linf, intercept=1e10, slope=-5) # Calculate the SSB SSB <- calc_SSB(mature, N0, wgt) rec_hockey(SSB[1], recruit_params[[1]])
Calculates the number of recruits as given by the density-independent stock recruitment function.
rec_linear(SSB, rec_args)
rec_linear(SSB, rec_args)
SSB |
A numeric value representing the Spawning Stock Biomass (SSB) of a given species (g). |
rec_args |
A list object of length |
The number of recruits is defined as a*(SSB/1e9)
.
A numeric value representing the number of recruits of a given species.
Ogle, D.H. (2016). Introductory Fisheries Analyses with R. CRC Press.
calc_recruits
, make_rec_fun
, get_rec_fun
, rec_BH
, rec_Ricker
, rec_hockey
, rec_const
and calc_SSB
# Set up the inputs to the function - species-independent parameters nfish <- nrow(NS_par) nsc <- 32 maxsize <- max(NS_par$Linf)*1.01 # the biggest size is 1% bigger than the largest Linf l_bound <- seq(0, maxsize, maxsize/nsc); l_bound <- l_bound[-length(l_bound)] u_bound <- seq(maxsize/nsc, maxsize, maxsize/nsc) mid <- l_bound+(u_bound-l_bound)/2 # Set up the inputs to the function - species-specific parameters Linf <- NS_par$Linf # the von-Bertalanffy asymptotic length of each species (cm). W_a <- NS_par$W_a # length-weight conversion parameter. W_b <- NS_par$W_b # length-weight conversion parameter. k <- NS_par$k # the von-Bertalnaffy growth parameter. Lmat <- NS_par$Lmat # the length at which 50\% of individuals are mature (cm). # Get phi_min tmp <- calc_phi(k, Linf, nsc, nfish, u_bound, l_bound, calc_phi_min=FALSE, phi_min=0.1) # fixed phi_min phi_min <- tmp$phi_min # Run calc_ration_growthfac() tmp <- calc_ration_growthfac(k, Linf, nsc, nfish, l_bound, u_bound, mid, W_a, W_b, phi_min) sc_Linf <- tmp$sc_Linf wgt <- tmp$wgt # Calculate maturity mature <- calc_mature(Lmat, nfish, mid, kappa=rep(10, nfish), sc_Linf) # Create recruitment functions stored_rec_funs <- get_rec_fun(rep("hockey-stick", nfish)) recruit_params <- do.call("Map", c(c, list(a=NS_par$a, b=NS_par$b))) # Get an initial population N0 <- get_N0(nsc, nfish, mid, wgt, sc_Linf, intercept=1e10, slope=-5) # Calculate the SSB SSB <- calc_SSB(mature, N0, wgt) rec_linear(SSB[1], recruit_params[[1]])
# Set up the inputs to the function - species-independent parameters nfish <- nrow(NS_par) nsc <- 32 maxsize <- max(NS_par$Linf)*1.01 # the biggest size is 1% bigger than the largest Linf l_bound <- seq(0, maxsize, maxsize/nsc); l_bound <- l_bound[-length(l_bound)] u_bound <- seq(maxsize/nsc, maxsize, maxsize/nsc) mid <- l_bound+(u_bound-l_bound)/2 # Set up the inputs to the function - species-specific parameters Linf <- NS_par$Linf # the von-Bertalanffy asymptotic length of each species (cm). W_a <- NS_par$W_a # length-weight conversion parameter. W_b <- NS_par$W_b # length-weight conversion parameter. k <- NS_par$k # the von-Bertalnaffy growth parameter. Lmat <- NS_par$Lmat # the length at which 50\% of individuals are mature (cm). # Get phi_min tmp <- calc_phi(k, Linf, nsc, nfish, u_bound, l_bound, calc_phi_min=FALSE, phi_min=0.1) # fixed phi_min phi_min <- tmp$phi_min # Run calc_ration_growthfac() tmp <- calc_ration_growthfac(k, Linf, nsc, nfish, l_bound, u_bound, mid, W_a, W_b, phi_min) sc_Linf <- tmp$sc_Linf wgt <- tmp$wgt # Calculate maturity mature <- calc_mature(Lmat, nfish, mid, kappa=rep(10, nfish), sc_Linf) # Create recruitment functions stored_rec_funs <- get_rec_fun(rep("hockey-stick", nfish)) recruit_params <- do.call("Map", c(c, list(a=NS_par$a, b=NS_par$b))) # Get an initial population N0 <- get_N0(nsc, nfish, mid, wgt, sc_Linf, intercept=1e10, slope=-5) # Calculate the SSB SSB <- calc_SSB(mature, N0, wgt) rec_linear(SSB[1], recruit_params[[1]])
Calculates the number of recruits as given by the Ricker stock recruitment function.
rec_Ricker(SSB, rec_args)
rec_Ricker(SSB, rec_args)
SSB |
A numeric value representing the Spawning Stock Biomass (SSB) of a given species (g). |
rec_args |
A list object of length |
The Ricker stock recruitment function is defined as a*(SSB/1e9))*exp(-b*(SSB/1e9))
.
A numeric value representing the number of recruits of a given species.
Hall, S. J., Collie, J. S., Duplisea, D. E., Jennings, S., Bravington, M., & Link, J. (2006). A length-based multispecies model for evaluating community responses to fishing. Canadian Journal of Fisheries and Aquatic Sciences, 63(6):1344-1359.
Ricker, W.E. (1954). Stock and recruitment. Journal of the Fisheries Research Board of Canada, 11:559-623.
calc_recruits
, make_rec_fun
, get_rec_fun
, rec_BH
, rec_hockey
, rec_const
, rec_linear
and calc_SSB
# Set up the inputs to the function - species-independent parameters nfish <- nrow(NS_par) nsc <- 32 maxsize <- max(NS_par$Linf)*1.01 # the biggest size is 1% bigger than the largest Linf l_bound <- seq(0, maxsize, maxsize/nsc); l_bound <- l_bound[-length(l_bound)] u_bound <- seq(maxsize/nsc, maxsize, maxsize/nsc) mid <- l_bound+(u_bound-l_bound)/2 # Set up the inputs to the function - species-specific parameters Linf <- NS_par$Linf # the von-Bertalanffy asymptotic length of each species (cm). W_a <- NS_par$W_a # length-weight conversion parameter. W_b <- NS_par$W_b # length-weight conversion parameter. k <- NS_par$k # the von-Bertalnaffy growth parameter. Lmat <- NS_par$Lmat # the length at which 50\% of individuals are mature (cm). # Get phi_min tmp <- calc_phi(k, Linf, nsc, nfish, u_bound, l_bound, calc_phi_min=FALSE, phi_min=0.1) # fixed phi_min phi_min <- tmp$phi_min # Run calc_ration_growthfac() tmp <- calc_ration_growthfac(k, Linf, nsc, nfish, l_bound, u_bound, mid, W_a, W_b, phi_min) sc_Linf <- tmp$sc_Linf wgt <- tmp$wgt # Calculate maturity mature <- calc_mature(Lmat, nfish, mid, kappa=rep(10, nfish), sc_Linf) # Create recruitment functions stored_rec_funs <- get_rec_fun(rep("hockey-stick", nfish)) recruit_params <- do.call("Map", c(c, list(a=NS_par$a, b=NS_par$b))) # Get an initial population N0 <- get_N0(nsc, nfish, mid, wgt, sc_Linf, intercept=1e10, slope=-5) # Calculate the SSB SSB <- calc_SSB(mature, N0, wgt) rec_Ricker(SSB[1], recruit_params[[1]])
# Set up the inputs to the function - species-independent parameters nfish <- nrow(NS_par) nsc <- 32 maxsize <- max(NS_par$Linf)*1.01 # the biggest size is 1% bigger than the largest Linf l_bound <- seq(0, maxsize, maxsize/nsc); l_bound <- l_bound[-length(l_bound)] u_bound <- seq(maxsize/nsc, maxsize, maxsize/nsc) mid <- l_bound+(u_bound-l_bound)/2 # Set up the inputs to the function - species-specific parameters Linf <- NS_par$Linf # the von-Bertalanffy asymptotic length of each species (cm). W_a <- NS_par$W_a # length-weight conversion parameter. W_b <- NS_par$W_b # length-weight conversion parameter. k <- NS_par$k # the von-Bertalnaffy growth parameter. Lmat <- NS_par$Lmat # the length at which 50\% of individuals are mature (cm). # Get phi_min tmp <- calc_phi(k, Linf, nsc, nfish, u_bound, l_bound, calc_phi_min=FALSE, phi_min=0.1) # fixed phi_min phi_min <- tmp$phi_min # Run calc_ration_growthfac() tmp <- calc_ration_growthfac(k, Linf, nsc, nfish, l_bound, u_bound, mid, W_a, W_b, phi_min) sc_Linf <- tmp$sc_Linf wgt <- tmp$wgt # Calculate maturity mature <- calc_mature(Lmat, nfish, mid, kappa=rep(10, nfish), sc_Linf) # Create recruitment functions stored_rec_funs <- get_rec_fun(rep("hockey-stick", nfish)) recruit_params <- do.call("Map", c(c, list(a=NS_par$a, b=NS_par$b))) # Get an initial population N0 <- get_N0(nsc, nfish, mid, wgt, sc_Linf, intercept=1e10, slope=-5) # Calculate the SSB SSB <- calc_SSB(mature, N0, wgt) rec_Ricker(SSB[1], recruit_params[[1]])
Project the LeMans model forward in time.
run_LeMans(params, ...) ## S4 method for signature 'missing' run_LeMans( N0, Fs, tot_time, nsc, nfish, phi_min, mature, sc_Linf, wgt, phi, ration, other, M1, suit_M2, stored_rec_funs, recruit_params, eps = 1e-05 ) ## S4 method for signature 'LeMans_param' run_LeMans( params, years = 10, N0 = NULL, effort = matrix(0, years, dim(params@Qs)[3]), Fs, intercept = 1e+10, slope = -5, tot_time )
run_LeMans(params, ...) ## S4 method for signature 'missing' run_LeMans( N0, Fs, tot_time, nsc, nfish, phi_min, mature, sc_Linf, wgt, phi, ration, other, M1, suit_M2, stored_rec_funs, recruit_params, eps = 1e-05 ) ## S4 method for signature 'LeMans_param' run_LeMans( params, years = 10, N0 = NULL, effort = matrix(0, years, dim(params@Qs)[3]), Fs, intercept = 1e+10, slope = -5, tot_time )
params |
A LeMans_param object containing the parameter values of the current LeMans model. |
... |
Additional arguments. |
N0 |
A matrix with dimensions |
Fs |
An array with dimensions |
tot_time |
A numeric value representing the number of time steps to run the model for. |
nsc |
A numeric value representing the number of length classes in the model. |
nfish |
A numeric value representing the number of fish species in the model. |
phi_min |
A numeric value representing the time step of the model. |
mature |
A matrix with dimensions |
sc_Linf |
A numeric vector of length |
wgt |
A matrix with dimensions |
phi |
A matrix with dimensions |
ration |
A matrix with dimensions |
other |
A numeric value representing the amount of other food (g) available from prey that is not explicitly represented in the model. |
M1 |
A matrix of dimensions |
suit_M2 |
A list object of length |
stored_rec_funs |
A list object of length |
recruit_params |
A list object of length |
eps |
A numeric value specifying a numerical offset. The default value is |
years |
A numeric value representing the number of years that the model is run for. The default is 10. |
effort |
A matrix with dimensions |
intercept |
A numeric value representing the number of individuals in the first length class. This parameter is only required if |
slope |
A numeric value representing the slope of the community size spectrum. This parameter is only required if |
An object of class LeMans_outputs
.
LeMans_outputs
, LeMans_param
, LeMansParam
# Run the model with all inputs specified explicitly: # Set up the inputs to the function - species-independent parameters nfish <- nrow(NS_par) nsc <- 32 maxsize <- max(NS_par$Linf)*1.01 # the biggest size is 1% bigger than the largest Linf l_bound <- seq(0, maxsize, maxsize/nsc); l_bound <- l_bound[-length(l_bound)] u_bound <- seq(maxsize/nsc, maxsize, maxsize/nsc) mid <- l_bound+(u_bound-l_bound)/2 # Set up the inputs to the function - species-specific parameters Linf <- NS_par$Linf # the von-Bertalanffy asymptotic length of each species (cm). W_a <- NS_par$W_a # length-weight conversion parameter. W_b <- NS_par$W_b # length-weight conversion parameter. k <- NS_par$k # the von-Bertalnaffy growth parameter. Lmat <- NS_par$Lmat # the length at which 50\% of individuals are mature (cm). # Get phi_min tmp <- calc_phi(k, Linf, nsc, nfish, u_bound, l_bound, calc_phi_min=FALSE, phi_min=0.1) # fixed phi_min phi <- tmp$phi phi_min <- tmp$phi_min # Calculate growth increments tmp <- calc_ration_growthfac(k, Linf, nsc, nfish, l_bound, u_bound, mid, W_a, W_b, phi_min) ration <- tmp$ration sc_Linf <- tmp$sc_Linf wgt <- tmp$wgt g_eff <- tmp$g_eff # Calculate maturity mature <- calc_mature(Lmat, nfish, mid, kappa=rep(10, nfish), sc_Linf) # Create recruitment functions stored_rec_funs <- get_rec_fun(rep("hockey-stick", nfish)) recruit_params <- do.call("Map", c(c, list(a=NS_par$a, b=NS_par$b))) # Calculate background mortality M1 <- calc_M1(nsc, sc_Linf, phi_min) # Calculate predator-prey size preferences prefs <- calc_prefs(pred_mu=-2.25, pred_sigma=0.5, wgt, sc_Linf) # Calculate prey preference and prey suitability suit_M2 <- calc_suit_vect(nsc, nfish, sc_Linf, prefs, NS_tau) # Calculate catchability Qs <- calc_Q(curve=rep("logistic", nfish), species=NS_par$species_names, max_catchability=rep(1, nfish), gear_name=NS_par$species_names, nsc=nsc, nfish=nfish, mid=mid, l_bound=l_bound, u_bound=u_bound, species_names=NS_par$species_names, eta=rep(0.25, nfish), L50=Lmat) # Get an initial population N0 <- get_N0(nsc, nfish, mid, wgt, sc_Linf, intercept=1e10, slope=-5) years <- 10 # run the model for 10 years tot_time <- years*phi_min # total number of time steps # Define fishing effort to be 0.5 for all species effort <- matrix(0.5, tot_time, dim(Qs)[3]) # Calculate F Fs <- array(0, dim=c(nsc, nfish, tot_time)) for (j in 1:ncol(effort)) { for (ts in 1:tot_time) { Fs[,,ts] <- Fs[,,ts]+effort[ts, j]*Qs[,,j] } } # Run the model model_run <- run_LeMans(N0=N0, tot_time=tot_time, Fs=Fs, nsc=nsc, nfish=nfish, phi_min=phi_min, mature=mature, sc_Linf=sc_Linf, wgt=wgt, phi=phi, ration=ration, other=NS_other, M1=M1, suit_M2=suit_M2, stored_rec_funs=stored_rec_funs, recruit_params=recruit_params, eps=1e-05) ############################################## # Alternatively: NS_params <- LeMansParam(NS_par,tau=NS_tau,eta=rep(0.25,21),L50=NS_par$Lmat,other=NS_other) # Define fishing effort effort <- matrix(0.5, 10, dim(NS_params@Qs)[3]) # Run the model model_run <- run_LeMans(NS_params, years=10, effort=effort)
# Run the model with all inputs specified explicitly: # Set up the inputs to the function - species-independent parameters nfish <- nrow(NS_par) nsc <- 32 maxsize <- max(NS_par$Linf)*1.01 # the biggest size is 1% bigger than the largest Linf l_bound <- seq(0, maxsize, maxsize/nsc); l_bound <- l_bound[-length(l_bound)] u_bound <- seq(maxsize/nsc, maxsize, maxsize/nsc) mid <- l_bound+(u_bound-l_bound)/2 # Set up the inputs to the function - species-specific parameters Linf <- NS_par$Linf # the von-Bertalanffy asymptotic length of each species (cm). W_a <- NS_par$W_a # length-weight conversion parameter. W_b <- NS_par$W_b # length-weight conversion parameter. k <- NS_par$k # the von-Bertalnaffy growth parameter. Lmat <- NS_par$Lmat # the length at which 50\% of individuals are mature (cm). # Get phi_min tmp <- calc_phi(k, Linf, nsc, nfish, u_bound, l_bound, calc_phi_min=FALSE, phi_min=0.1) # fixed phi_min phi <- tmp$phi phi_min <- tmp$phi_min # Calculate growth increments tmp <- calc_ration_growthfac(k, Linf, nsc, nfish, l_bound, u_bound, mid, W_a, W_b, phi_min) ration <- tmp$ration sc_Linf <- tmp$sc_Linf wgt <- tmp$wgt g_eff <- tmp$g_eff # Calculate maturity mature <- calc_mature(Lmat, nfish, mid, kappa=rep(10, nfish), sc_Linf) # Create recruitment functions stored_rec_funs <- get_rec_fun(rep("hockey-stick", nfish)) recruit_params <- do.call("Map", c(c, list(a=NS_par$a, b=NS_par$b))) # Calculate background mortality M1 <- calc_M1(nsc, sc_Linf, phi_min) # Calculate predator-prey size preferences prefs <- calc_prefs(pred_mu=-2.25, pred_sigma=0.5, wgt, sc_Linf) # Calculate prey preference and prey suitability suit_M2 <- calc_suit_vect(nsc, nfish, sc_Linf, prefs, NS_tau) # Calculate catchability Qs <- calc_Q(curve=rep("logistic", nfish), species=NS_par$species_names, max_catchability=rep(1, nfish), gear_name=NS_par$species_names, nsc=nsc, nfish=nfish, mid=mid, l_bound=l_bound, u_bound=u_bound, species_names=NS_par$species_names, eta=rep(0.25, nfish), L50=Lmat) # Get an initial population N0 <- get_N0(nsc, nfish, mid, wgt, sc_Linf, intercept=1e10, slope=-5) years <- 10 # run the model for 10 years tot_time <- years*phi_min # total number of time steps # Define fishing effort to be 0.5 for all species effort <- matrix(0.5, tot_time, dim(Qs)[3]) # Calculate F Fs <- array(0, dim=c(nsc, nfish, tot_time)) for (j in 1:ncol(effort)) { for (ts in 1:tot_time) { Fs[,,ts] <- Fs[,,ts]+effort[ts, j]*Qs[,,j] } } # Run the model model_run <- run_LeMans(N0=N0, tot_time=tot_time, Fs=Fs, nsc=nsc, nfish=nfish, phi_min=phi_min, mature=mature, sc_Linf=sc_Linf, wgt=wgt, phi=phi, ration=ration, other=NS_other, M1=M1, suit_M2=suit_M2, stored_rec_funs=stored_rec_funs, recruit_params=recruit_params, eps=1e-05) ############################################## # Alternatively: NS_params <- LeMansParam(NS_par,tau=NS_tau,eta=rep(0.25,21),L50=NS_par$Lmat,other=NS_other) # Define fishing effort effort <- matrix(0.5, 10, dim(NS_params@Qs)[3]) # Run the model model_run <- run_LeMans(NS_params, years=10, effort=effort)