Description Usage Arguments Author(s) Examples
View source: R/standardize_bounds.R
Function to standardize the bounds of the control file in the estimation
model. This function first checks to ensure the initial values in the
estimation model control file are set to the true values of the
om_ctl_file
and if not sets them for every parameter. Next, the
function adjusts the LO and HI values in the em_ctl_file
to
be a fixed percentage of the initial value for every parameter.
1 2 | standardize_bounds(percent_df, dir, em_ctl_file, om_ctl_file = "",
verbose = FALSE, estimate = NULL, ...)
|
percent_df |
A |
dir |
A path to the directory containing the model files. |
em_ctl_file |
A string with the name of the estimation model
control file. |
om_ctl_file |
A string with the name of the operating model
control file. If it is not given the part of the function which matches the
OM and EM INIT values is ignored. Default is |
verbose |
Detailed output to command line. Default is |
estimate |
A logical for which changed parameters are to be estimated.
Used by |
... |
Any other arguments to pass to |
Christine Stawitz
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 | ## Not run:
temp_path <- file.path(tempdir(), "standardize-bounds-example")
dir.create(temp_path, showWarnings = FALSE)
wd <- getwd()
setwd(temp_path)
on.exit(setwd(wd), add = TRUE)
## Set to the path and filename of the OM and EM control files
OM.ctl <- system.file("extdata", "models", "cod-om", "codOM.ctl",
package = "ss3sim")
EM.ctl <- system.file("extdata", "models", "cod-em", "codEM.ctl",
package = "ss3sim")
file.copy(OM.ctl, "om.ctl")
file.copy(EM.ctl, "em.ctl")
## Use SS_parlines to get the proper names for parameters for the data frame
em.pars <- r4ss::SS_parlines(ctlfile = "em.ctl")
## Set percentages to make lower and upper bounds
lo.percent<-rep(.5,11)
hi.percent<-c(500,1000,1000,rep(500,8))
##Populate data frame using EM parameter names and percentages
percent_df<-data.frame(Label=as.character(em.pars[c(1:6,17,27:30),"Label"]),
lo=lo.percent,hi=hi.percent)
##Run function
standardize_bounds(percent_df = percent_df, dir = ".",
em_ctl_file = "em.ctl",
om_ctl_file = "om.ctl")
unlink("om.ctl")
unlink("em.ctl")
unlink(temp_path, recursive = TRUE)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.