# NOT RUN {
# 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)
# }
Run the code above in your browser using DataLab