Description Usage Arguments Value Which arguments to specifiy in case files Author(s) See Also Examples
Extract length-composition data from a .ss_new
data file and sample
the data. It is assumed that the composition data will be expected values
as written by Stock Synthesis in the second section of the data file, but
one can also sample input data. The resulting length-composition
data are assumed to represent observed length composition and will overwrite
the length data in dat_list
, which is returned invisibly.
The data file can also be written to the disk, if a file path is provided to
outfile
, and used as simulated data by an estimation model.
If used with run_ss3sim
, the case file should be named
agecomp
. A suggested (default) case letter is D
for data.
1 2 | sample_lcomp(dat_list, outfile, fleets, Nsamp, years, cpar = 1,
ESS = NULL)
|
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 vector of integers specifying which fleets to include.
The order of the fleets pertains to the input order of other arguments.
An entry of |
Nsamp |
*A numeric list of the same length as |
years |
*A list the same length as |
cpar |
A numeric value or vector the same length as
|
ESS |
The final effective sample size (ESS) associated with the
simulated data. The ESS is not used to generate the simulated data
but can be used as an input sample size in subsequent models that estimate
population parameters or status.
The default, |
A modified .dat
file if !is.null(outfile)
. A list object
containing the modified .dat
file is returned invisibly.
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 and Kotaro Ono
sample_agecomp
for more examples
Other sampling functions: clean_data
,
sample_agecomp
,
sample_calcomp
, sample_index
,
sample_mlacomp
,
sample_wtatage
1 2 3 4 5 6 7 | dat_list <- r4ss::SS_readdat(verbose = FALSE,
file = system.file(file.path("extdata", "models", "cod-om", "codOM.dat"),
package="ss3sim"))
## Generate with constant sample size across years
ex1 <- sample_lcomp(dat_list=dat_list, outfile = NULL,
fleets = 1:2, Nsamp = list(100, 50),
years=list(seq(26, 100, by = 2), 80:100))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.