Learn R Programming

ss3sim (version 0.9.0)

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,
  write_file = TRUE, mean_outfile = NULL, verbose = TRUE)

Value

  • A modified .dat file if write_file=TRUE. 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
temp_path <- file.path(tempdir(), "ss3sim-test")
dir.create(temp_path, showWarnings = FALSE)
wd <- getwd()
setwd(temp_path)
d <- system.file("extdata/models/cod-om", package = "ss3sim")
dat_in <- file.path(d, "codOM.dat")
dat_list <- r4ss::SS_readdat(dat_in, verbose = FALSE)
dat_list <- change_fltname(dat_list)
dat_list <- change_data(dat_list, outfile = NULL, write_file = FALSE,
  fleets = 1, years = 1990:2010, types = c("age", "mla"))
dat_list <- change_fltname(dat_list)
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(1992),
                      verbose = FALSE, mean_outfile = "test.csv", write_file = FALSE)

setwd("..")
unlink("ss3sim-test", recursive = TRUE)
setwd(wd)

Run the code above in your browser using DataLab