LeMansParam
classA constructor for the LeMansParam
class.
LeMansParam(df, gdf, ...)# S4 method for 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 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 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,
...
)
A data frame with nfish
rows and the following columns: Linf
, W_a
, W_b
, k
and Lmat
. See below for definitions of each of these parameters.
A data frame with nfish
rows and the following columns: curve
, catch_species
, max_catchability
, k
and gear_name
. See below for definitions of each of these parameters.
Additional arguments for calculating catchability curves. See calc_Q
for more details.
A numeric value representing the number of fish species in the model.
A numeric value representing the number of length classes in the model.
A numeric value representing the preferred predator-prey mass ratio.
A numeric value representing the width of the weight preference function.
A numeric value representing the amount of other food (g) available from prey that is not explicitly represented in the model. The default is 1e12
.
An optional argument specifying the bounds of the length classes.
A logical statement indicating whether phi_min
should be calculated within the function. The default is FALSE
.
A fixed numeric value of phi_min
, which represents the time step of the model. This parameter is only required if calc_phi_min=FALSE
. The default is 0.1
.
A logical statement indicating whether growth efficiency should vary for each species (vary_growth=TRUE
) or be fixed at the value given by fixed_growth
(vary_growth=FALSE
). The default is TRUE
.
If vary_growth==TRUE
, growth_eff
is a numeric representing the growth efficiencies of a fish of length 0. If vary_growth==FALSE
, growth_eff
is a numeric value of length 1
representing a fixed growth efficiency for all fish. The default is 0.5.
A numeric value specifying the rate at which growth efficiency decreases as length increases to Linf
. The default is 0.11.
A numeric value specifying a numerical offset. The default value is 1e-5
.
A logical statement indicating whether to force maturity for all fish in the largest length class. The default is TRUE
.
A numeric or character vector of length nfish
that denotes the names of the species in the model.
A numeric vector of length nfish
representing the rate of change from immature to mature fish.
A matrix with dimensions nfish
and nsc
. 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
.
A character vector representing the stock recruitment function to be applied to each species. The default value is "hockey-stick"
but rec_fun
can take a value of "Ricker"
, "Beverton-Holt"
, "constant"
, or "linear"
for each species.
A list object of length nfish
specifying the parameters for the recruitment function.
A character vector of length 1
describing the mortality function to be used for the species. The default value is "std_RNM"
but can take a value of "constant"
or "linear"
. See calc_M1
for more information.
A numeric vector of length nfish
representing the maximum background mortality of each species. The default is 0.8
for all species.
A numeric vector of length nfish
representing the proportion of length classes that have a non-zero background mortality. This is required only when the natmort_opt
mortality function is used. The default is 3/4
.
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, curve
is a character vector of length nfish
that takes the value "logistic"
in each element, but it can also take a value of "log-gaussian"
or "knife-edge"
. If a custom curve is required for a particular species and/or fishing gear, the curve must be specified in custom
.
A numeric value or character string describing the species to apply the catchability curve to.
A numeric vector of length curve
describing the maximum catchability for each catchability curve.
A character vector of the same length as curve
and species
describing the fishing gear that each element of curve
and species
relates to. By default, gear_name
is a character vector of length curve
that takes the value paste("gear_", 1:length(curve), sep = "")
.
An array with dimensions nsc
, nfish
and the number of custom catchability curves that are required. custom
represents the catchability of each species by the gears specified using custom catchability curves. By default, custom
is set to NULL
.
A numeric vector of length nfish
representing the mid-point of the length classes.
k A numeric vector of length nfish
representing the von Bertalanffy growth parameter (1/yr)
for each species.
A numeric vector representing the parameter a
in the length-weight conversion.
A numeric vector representing the parameter b
in the length-weight conversion.
A numeric vector of length nsc
representing the length at which 50% of the individuals are mature.
An object of class LeMansParam
for use in the LeMans model.
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.
run_LeMans
, '>LeMans_param
# NOT RUN {
# 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)
# }
Run the code above in your browser using DataLab