sample_mlacomp: [BETA VERSION] Sample mean length (size-)-at-age data and...

Description Usage Arguments Details Value Which arguments to specifiy in case files Author(s) See Also Examples

View source: R/sample_mlacomp.R

Description

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

Usage

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

Arguments

dat_list

An SS data list object as read in from SS_readdat in the r4ss package. Make sure you select option section=2.

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 NULL, which leads to increased speed because writing the file takes time and computing resources.

ctl_file_in

A path to the control file, output from an OM, containing the OM parameters for growth. These values are used to determine the uncertainty about size for fish sampled in each age bin.

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 fleets=NULL leads to zero samples for any fleet.

Nsamp

*A numeric list of the same length as fleets. Either single values or vectors of the same length as the number of years can be passed through. Single values are repeated for all years. If no fleet collected samples, keep the value to Nsamp=NULL.

years

*A list the same length as fleets giving the years as numeric vectors. If no fleet collected samples, keep the value to years=NULL.

mean_outfile

A path to write length and age data for external estimation of parametric growth. If NULL no file will be written. This file is used by change_e to externally estimate growth parameters. Filename must contain "vbgf" to be used by change_e. Also, if "remove" is included in the filename, the mean length at age data will be removed from the .dat file and not be available to the EM.

verbose

Logical value whether or not diagnostic information from r4ss functions should be printed to the screen. Default is FALSE.

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.

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.

Author(s)

Cole Monnahan, Kelli Johnson

See Also

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

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
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)

ss3sim documentation built on Nov. 9, 2019, 1:06 a.m.