R/rerun_profile_vals.R
rerun_profile_vals.Rd
To be called after run_diagnostics()
in the instance when a model within a
profile has bad dynamics and could benefit from attempting the run with
different starting values. The jitter fraction will be turned on and the
model will be reran in hopes that a better likelihood can be found. The
summary diagnostics will be recreated as well.
rerun_profile_vals(mydir, para_name, model_settings, run_num, data_file_nm)
Directory where model files are located.
There is no default entry for mydir
.
An example of user input could be
mydir = file.path("C:/my_models", "base_model")
.
SS parameter name that the profile was run across. This is
used to located the correct folder combined with the mydir function input
(e.g., paste0(mydir, "/", model_settings[["base_name"]], "_profile_", para_name)
).
A list of all model settings. Typically, created using get_settings but users can create their own list, as long as it has all of the necessary components for the function at hand.
An integer vector specifying the run numbers that you would like to rerun for convergence. This input needs to match the run number for the original profile (e.g., Report6.sso) that you would like to rerun.
A character string specifying the name of the SS3 data
file. This is more than likely "data.ss"
.
if (FALSE) { # \dontrun{
model_settings <- get_settings()
temp_profile_dir <- file.path(tempdir(), "profile")
r4ss::copy_SS_inputs(
recursive = TRUE,
verbose = FALSE,
dir.old = system.file(package = "r4ss", "extdata", "simple_small"),
dir.new = file.path(temp_profile_dir, "simple_small"),
overwrite = TRUE
)
ss3_path <- r4ss::get_ss3_exe(
dir = file.path(temp_profile_dir, "simple_small")
)
model_settings <- get_settings(
settings = list(
base_name = "simple_small",
exe = gsub("\\.exe", "", basename(ss3_path)),
run = c("profile"),
profile_details = get_settings_profile(
parameters = c("NatM_uniform_Fem_GP_1"),
low = c(0.20),
high = c(0.25),
step_size = c(0.02),
param_space = c("multiplier")
)
)
)
run_diagnostics(
mydir = temp_profile_dir,
model_settings = model_settings
)
rerun_profile_vals(
mydir = temp_profile_dir,
model_settings = model_settings,
para_name = "NatM_uniform_Fem_GP_1",
run_num = c(1),
data_file_nm = "data.ss"
)
} # }