Learn R Programming

ss3sim (version 1.0.3)

sample_mlacomp: [BETA VERSION] Sample mean length (size-)-at-age data and write to file for use by the EM.

Description

[BETA VERSION] Sample mean length (size-)-at-age data and write to file for use by the EM.

Usage

sample_mlacomp(dat_list, outfile, ctl_file_in, fleets = 1, Nsamp, years,
  mean_outfile = NULL, verbose = TRUE)

Value

A modified .dat file if !is.null(outfile). A list object containing the modified .dat file is returned invisibly.

Which arguments to specifiy in case files

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.

Details

**This function is in beta and untested. Use with caution.** Take a data.SS_new file, read in by r4ss function SS_readdat containing observed values, and sample from the observed ages to get realistic proportions for the number of fish in each age bin, then use the mean size-at-age and CV for growth to generate random samples of size, which are then averaged to get mean length-at-age values. These values are then written to file for the EM.

See Also

Other sampling functions: clean_data, sample_agecomp, sample_calcomp, sample_index, sample_lcomp, sample_wtatage

Examples

Run this code
# NOT RUN {
d <- system.file(file.path("extdata", "models", "cod-om"),
  package = "ss3sim")
dat_in <- file.path(d, "codOM.dat")
dat_list <- r4ss::SS_readdat(dat_in, version = NULL, verbose = FALSE)
dat_list <- change_data(dat_list, outfile = NULL,
  fleets = 1, years = seq(dat_list$styr, dat_list$styr + 5),
  types = c("age", "mla"))
ctl_file_in <- file.path(d, "codOM.ctl")

out <- sample_mlacomp(dat_list, outfile = NULL, ctl_file_in = ctl_file_in,
  fleets = 1, Nsamp = 30, years = list(dat_list$styr + 5),
  verbose = FALSE, mean_outfile = NULL)

# }

Run the code above in your browser using DataLab