run_retro | R Documentation |
Simulate bam models for running retrospective analysis
run_retro(
CommonName = NULL,
fileName = "bam",
dir_bam_sim = "sim",
dir_bam_base = "base",
bam = NULL,
dat_file = NULL,
tpl_file = NULL,
cxx_file = NULL,
dat_obj = NULL,
tpl_obj = NULL,
cxx_obj = NULL,
standardize = FALSE,
nyr_remove = 1:5,
endyr_reduce_always = c("endyr", "endyr_dev_rec", "endyr_rec_dev", "endyr_rec_phase2",
"endyr_rec_spr"),
ncores = NULL,
ndigits = 4,
unlink_dir_bam_base = FALSE,
run_bam_base = TRUE,
overwrite_bam_base = TRUE,
admb_options_base = "-nox",
run_sim = TRUE,
admb_options_sim = "-est -nox",
prompt_me = FALSE,
subset_rdat = list(eq.series = 101, pr.series = 101, t.series = styr:endyr),
random_seed = 12345,
admb2r_obj = admb2r.cpp,
cleanup = list(del = c("*.r0*", "*.p0*", "*.b0*", "*.log", "*.rpt", "*.obj", "*.htp",
"*.eva", "*.bar", "*.tds", "*.o", "tmp_admb", "variance", "*.dep", "*.hes", "*.tmp"))
)
CommonName |
Common name of species associated with dat, tpl, and cxx files |
fileName |
Name given to BAM files, not including file extensions. |
dir_bam_sim |
Name of directory to write retrospective analysis files to, relative to the working directory. |
dir_bam_base |
Name of directory to write bam base model files to, relative to the working directory. |
bam |
Output of |
dat_file |
dat file path |
tpl_file |
tpl file path |
cxx_file |
cxx file path |
dat_obj |
dat file read in as a character vector with readLines(con=dat_file) |
tpl_obj |
tpl file read in as a character vector with readLines(con=tpl_file) |
cxx_obj |
cxx file read in as a character vector with readLines(con=cxx_file) |
standardize |
Should |
nyr_remove |
number of years to remove in the retrospective analysis |
endyr_reduce_always |
Names of endyr variables that should always be reduced as years are removed from each retrospective run. These names will be searched in among all init variable names starting with endyr and must match exactly. Other endyr variables will only be reduced if they are greater than the terminal year of a particular retrospective run. |
ncores |
number of cores to use for parallel processing |
ndigits |
number of digits to round simulated values to |
unlink_dir_bam_base |
Should dir_bam_base be deleted after this function is run? |
run_bam_base |
If FALSE, the function will look for an executable named fileName.exe in dir_bam_base and use it as the base model. |
overwrite_bam_base |
If FALSE, the files in dir_bam_base will not be overwritten if run_bam_base=TRUE |
admb_options_base |
Character string pasted to fileName to build |
run_sim |
If FALSE, the simulated data will be generated but won't be used in new BAM runs |
admb_options_sim |
ADMB code snippet used in shell script when running bam |
prompt_me |
Turn on/off prompts that ask for user input before deleting files. |
subset_rdat |
list of rdat objects to subset in different ways. For eq.series and pr.series specify number of evenly spaced values to retain. For t.series specify a series of years to retain. When subsetting eq.series or pr.series, this option can substantially decrease rdat file size, without affecting precision of reference point calculations. |
random_seed |
random seed value. If NULL, random seed is not set within the function. |
admb2r_obj |
Character string containing admb2r C++ code, which is written with |
cleanup |
List object written to |
Invisibly returns a data frame, sim_out, containing basic results of sim runs, including total likelihood and maximum gradient values. This data frame is also written to a csv file in dir_bam_sim
.
## Not run:
Run retrospective analysis, writing files to dir_bam_sim
run_retro("AtlanticMenhaden", dir_bam_base="AtMe_base", dir_bam_sim="AtMe_sim")
run_retro("BlackSeaBass", dir_bam_base="BlSB_base", dir_bam_sim="BlSB_sim",nyr_remove=1:4) # removing 5 years results in an error likely due to closed season commercial pot discards running out of data
run_retro("BluelineTilefish", dir_bam_base="BlTi_base", dir_bam_sim="BlTi_sim")
run_retro("Cobia", dir_bam_base="Cobi_base", dir_bam_sim="Cobi_sim")
run_retro("GagGrouper", dir_bam_base="GaGr_base", dir_bam_sim="GaGr_sim")
run_retro("GrayTriggerfish", dir_bam_base="GrTr_base", dir_bam_sim="GrTr_sim")
run_retro("GreaterAmberjack", dir_bam_base="GrAm_base", dir_bam_sim="GrAm_sim",nyr_remove=1:4) # removing 5 years results in an error because you run out of rGN discard length comps which start in 2013
run_retro("RedGrouper", dir_bam_base="ReGr_base", dir_bam_sim="ReGr_sim")
run_retro("RedPorgy", dir_bam_base="RePo_base", dir_bam_sim="RePo_sim")
run_retro("RedSnapper", dir_bam_base="ReSn_base", dir_bam_sim="ReSn_sim")
run_retro("ScampGrouper", dir_bam_base="ScGr_base", dir_bam_sim="ScGr_sim")
run_retro("SnowyGrouper", dir_bam_base="SnGr_base", dir_bam_sim="SnGr_sim")
run_retro("Tilefish", dir_bam_base="Tile_base", dir_bam_sim="Tile_sim")
run_retro("VermilionSnapper", dir_bam_base="VeSn_base", dir_bam_sim="VeSn_sim")
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.