Description Usage Arguments Value See Also Examples

Project the LeMans model forward in time.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | ```
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`

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 | ```
# 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)
``` |

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.