Learn R Programming

ss3sim (version 0.9.5)

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/" if there are nsim = 10 bias adjustment runs)

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 the r4ss package to read in output from n SS3 runs,

  • uses Ian Taylor's r4ss function 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.DAT and AvgBias.DAT, respectively) bias adjustment parameters to the dir folder

  • takes a control.ss_new file from one of the n SS runs, changes the n bias adjustment parameters, and writes the whole updated control.ss_new file with new bias adjustment parameters to an em.ctl file

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
# NOT RUN {
# 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