Learn R Programming

ss3sim (version 0.9.0)

run_bias_ss3: Determine level of bias adjustment for SS3 runs

Description

Determine level of bias adjustment from multiple SS3 runs. IMPORTANT: The Hessian must be calculated for the SS3 runs that this function uses.

Usage

run_bias_ss3(dir, outdir, nsim, conv_crit = 0.2)

Arguments

dir
Folder for all of the bias adjustment runs (e.g. "F1-D1-cod/bias" which must contain numbered folders for the nsim runs, e.g. "F1-D1-cod/bias/1/", "F1-D1-cod/bias/2/", ..., "F1-D1-cod/bias/10/"
outdir
Folder containing the run folders for a given scenario (e.g. "F1-D1-cod" that contains "F1-D1-cod/1/" "F1-D1-cod/2/", etc.)
nsim
number of bias adjustment runs conducted for a particular scenario (e.g. 10)
conv_crit
The maximum percentage of bias iterations that can produce a non-invertible Hessian before a warning will be produced. If this percentage is exceeded then a file WARNINGS.txt will be produced. Currently, the simulations will continue to run.

Details

This function:
  • uses ther4sspackage to read in output from n SS3 runs,
  • uses Ian Taylor'sr4ssfunction to find values for the n bias adjustment parameters for each run,
  • takes the average over runs for each bias adjustment parameter
  • writes out the unaveraged and averaged (AdjustBias.DATandAvgBias.DAT, respectively) bias adjustment parameters to thedirfolder
  • takes acontrol.ss_newfile from one of the n SS runs, changes the n bias adjustment parameters, and writes the whole updatedcontrol.ss_newfile with new bias adjustment parameters to anem.ctlfile

References

Methot, R. D. and Taylor, I. G. (2011). Adjusting for bias due to variability of estimated recruitments in fishery assessment models. Can. J. Fish. Aquat. Sci., 68(10):1744-1760.

See Also

run_ss3sim, ss3sim_base, run_ss3model, bias_ss3

Examples

Run this code
# Create a temporary folder for the output:
temp_path <- file.path(tempdir(), "ss3sim-bias-example")
dir.create(temp_path, showWarnings = FALSE)

d <- system.file("extdata", package = "ss3sim")
case_folder <- paste0(d, "/eg-cases")
om <- paste0(d, "/models/cod-om")
em <- paste0(d, "/models/cod-em")
wd <- getwd()
setwd(temp_path)
# (Note that bias_nsim should be bigger, say 10, but it is set to 2
# here so the example runs faster.)
run_ss3sim(iterations = 1:1, scenarios = "D1-F0-cod",
  case_folder = case_folder, om_dir = om, em_dir = em,
  bias_adjust = TRUE, bias_nsim = 2)
setwd(wd)

Run the code above in your browser using DataLab