Description Usage Arguments Details Value Which arguments to specifiy in case files Author(s) See Also Examples
change_data
alters the data structure for a data list as read in by
SS_readdat
, for use in preparing the data file for an SS
operating model. Original data is removed and dummy data is added, as
specified, to the SS .dat
file. This causes SS to produce expected
values (OM "truth") when the operating model is run, from which data can be
sampled. For each data type altered, change_data
will add data for
the fleets and years given; potentially adding many rows of redundant data.
Currently, .dat
files with multiple sexes cannot be manipulated with
change_data
. calculate_data_units
is used internally in
ss3sim_base
to create a superset of fleets and years from
sample arguments, and clean_data
to strip out unused data after
change_data
is called (see examples below). change_data
is
called internally automatically, but can also be used by an ss3sim user
to manipulate data as a case, or to prepare a new OM for use in a simulation.
See the vignette for more details.
1 2 3 4 |
dat_list |
An SS data list object as read in from
|
outfile |
A character string specifying the file name to use
when writing the information to the disk. The string must include
the proper file extension. No file is written using the default value
of |
fleets |
A numeric vector of fleets |
years |
A numeric vector of years |
types |
A vector that can take combinations of the following entries:
|
age_bins |
*A numeric vector of age bins to use. If left as |
len_bins |
*A numeric vector of length bins to use. If left as
|
pop_binwidth |
*Population length bin width. Note that this value must
be smaller than the bin width specified in length composition data
|
pop_minimum_size |
*Population minimum length bin value. |
pop_maximum_size |
*Population maximum length bin value. |
lcomp_constant |
*A new robustification constant for length composition
data to be used. Must be a numeric value, as a proportion. For example 0.1
means 10 percent. See the SS manual for further information. A |
tail_compression |
*A new tail compression value to be used in SS. Must
be a numeric value, as a proportion. For example 0.1 means 10 percent. See
the SS manual for further information. A |
nsex |
An integer value of 1 or 2 specifying the number of sexes in the model. If 1, then females are the only included sex. This information can be found in the data file for a given model and dictates how the composition data are structured. |
The robustification constant is added to both the observed and expected proportions of length composition data, before being normalized internally. It is designed to help stabilize the model, but is unclear how and when to use it for optimal effect. The same value is used for all length data.
An invisible data list, and a file is written to the disk if an
entry other than NULL
is provided for outfile
.
All function argument descriptions that start with an asterisk (*) will be passed
through the case files to run_ss3sim
. If one of these arguments
is not specified in a case file, then a value of NULL
will be passed,
which may or may not be an appropriate value. Other arguments will be ignored
if specified.
Cole Monnahan, Ian Taylor, Sean Anderson, Kelli Johnson
Other change functions: change_em_binning
,
change_e
, change_f_par
,
change_f
, change_o
,
change_retro
, change_tv
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 | d <- system.file("extdata", package = "ss3sim")
fleets <- 1:2
years <- c(5, 10, 15)
types <- c("len", "age")
file_in <- r4ss::SS_readdat(file.path(d, "models", "cod-om", "codOM.dat"),
version = NULL, verbose = FALSE)
# Basic test with just length data, default bins:
out <- change_data(file_in, outfile = NULL, types = "len",
years = years, fleets = fleets)
print(out$lbin_vector)
print(out$lencomp)
# Change the length bins:
out <- change_data(file_in, outfile = NULL, types = "len",
years = years, fleets = fleets, len_bins = 3:6)
out$lbin_vector
out$lencomp
# Change the population length bins:
out <- change_data(file_in, outfile = NULL, types = "len",
years = years, fleets = fleets, pop_binwidth = 1, pop_minimum_size = 5,
pop_maximum_size = 210)
out$binwidth
out$maximum_size
out$minimum_size
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.