Description Usage Arguments Details Value Author(s) See Also Examples
This function is a wrapper function that can call run_ss3model
for the operating model, sample the output (add recruitment deviations,
survey the data, etc.), and run the estimation model. ss3sim_base
is
the main internal function for ss3sim. It is intended to be used
through run_ss3sim
, but can also be used directly.
1 2 3 4 5 6 7 8 | ss3sim_base(iterations, scenarios, f_params, index_params, lcomp_params,
agecomp_params, calcomp_params = NULL, wtatage_params = NULL,
mlacomp_params = NULL, em_binning_params = NULL,
estim_params = NULL, tv_params = NULL, operat_params = NULL,
om_dir, em_dir, retro_params = NULL, data_params = NULL,
user_recdevs = NULL, user_recdevs_warn = TRUE, bias_adjust = FALSE,
hess_always = FALSE, print_logfile = TRUE, sleep = 0, seed = 21,
...)
|
iterations |
Which iterations to run. A numeric vector. |
scenarios |
Which scenarios to run. |
f_params |
A named list containing arguments for |
index_params |
A named list containing arguments for
|
lcomp_params |
A named list containing arguments for
|
agecomp_params |
A named list containing arguments for
|
calcomp_params |
A named list containing arguments for
|
wtatage_params |
A named list containing arguments for
|
mlacomp_params |
A named list containing arguments for
|
em_binning_params |
A named list containing arguments for
|
estim_params |
A named list containing arguments for
|
tv_params |
A named list containing arguments for
|
operat_params |
A named list containing arguments for |
om_dir |
The directory with the operating model you want to copy and use for the specified simulations. |
em_dir |
The directory with the estimation model you want to copy and use for the specified simulations. |
retro_params |
A named list containing arguments for
|
data_params |
A named list containing arguments for
|
user_recdevs |
An optional matrix of recruitment deviations to replace
the recruitment deviations built into the package. The columns represent
run iterations and the rows represent years. |
user_recdevs_warn |
A logical argument allowing users to turn the
warning regarding biased recruitment deviations off when |
bias_adjust |
Run bias adjustment first?. |
hess_always |
If |
print_logfile |
Logical. Print a log file? |
sleep |
A time interval (in seconds) to pause on each iteration. Useful if you want to reduce average CPU time – perhaps because you're working on a shared server. |
seed |
The seed value to pass to |
... |
Anything extra to pass to |
This function is written to be flexible. You can specify the fishing
mortality, survey index, length composition, age composition, and
time-varying parameters in the function call as list objects (see the
example below). For a generic higher-level function, see
run_ss3sim
.
The output will appear in whatever your current R working directory is. There will be folders named after your scenarios. They will look like this:
D0-F0-cod/1/om
D0-F0-cod/1/em
D0-F0-cod/2/om
...
Sean Anderson with contributions from many others as listed in the DESCRIPTION file.
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 | ## Not run:
# Create a temporary folder for the output and set the working directory:
# Create a temporary folder for the output and set the working directory:
temp_path <- file.path(tempdir(), "ss3sim-base-example")
dir.create(temp_path, showWarnings = FALSE)
wd <- getwd()
setwd(temp_path)
on.exit(setwd(wd), add = TRUE)
# Find the data in the ss3sim package:
d <- system.file("extdata", package = "ss3sim")
om <- file.path(d, "models", "cod-om")
em <- file.path(d, "models", "cod-em")
case_folder <- file.path(d, "eg-cases")
# Pull in file paths from the package example data:
d <- system.file("extdata", package = "ss3sim")
om_dir <- file.path(d, "models", "cod-om")
em_dir <- file.path(d, "models", "cod-em")
a <- get_caseargs(folder = file.path(d, "eg-cases"),
case_files = list(F = "F",
D = c("index", "lcomp", "agecomp"),
E = "E"),
scenario = "F0-D0-E0-cod")
ss3sim_base(iterations = 1,
scenarios = "F0-D0-E0-cod",
f_params = a$F,
index_params = a$index,
lcomp_params = a$lcomp,
agecomp_params = a$agecomp,
tv_params = a$tv_params,
estim_params = a$E,
om_dir = om_dir,
em_dir = em_dir)
unlink("F0-D0-E0-cod", recursive = TRUE) # clean up
# Or, create the argument lists directly in R and skip the case file setup:
F0 <- list(years = 1:100,
fisheries = 1,
fvals = c(rep(0, 25), rep(0.114, 75)))
index1 <- list(fleets = 2, years = list(seq(62, 100, by = 2)),
sds_obs = list(0.1))
lcomp1 <- list(fleets = c(1, 2), Nsamp = list(100, 100),
years = list(26:100, seq(62, 100, by = 2)),
lengthbin_vector = NULL, cpar = c(1, 1))
agecomp1 <- list(fleets = c(1, 2), Nsamp = list(100, 100),
years = list(26:100, seq(62, 100, by = 2)),
agebin_vector = NULL, cpar = c(1, 1))
E0 <- list(natM_type = NULL, natM_n_breakpoints = NULL, natM_lorenzen = NULL,
natM_val = NULL,
par_name = c("LnQ_base_Fishery", "NatM_p_1_Fem_GP_1"),
par_int = c(NA, NA), par_phase = c(-1, -1), forecast_num = 0)
ss3sim_base(iterations = 1,
scenarios = "D1-E0-F0-cod", #name as desired
f_params = F0,
index_params = index1,
lcomp_params = lcomp1,
agecomp_params = agecomp1,
estim_params = E0,
om_dir = om,
em_dir = em)
unlink("D1-E0-F0-cod", recursive = TRUE) # clean up
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.