Sample empirial weight-at-age data and write to file for use by the EM

Share:

Description

Take a data.SS_new file containing expected values and sample from true 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 converted to weight and averaged to get mean weight-at-age values. Missing ages and years are filled according to a specified function. These matrices are then written to file for the EM. By calling this function, ss3sim will turn on the empirical weight-at-age function (set maturity option to 5) automatically. See ss3sim_base for more details on how that is implemented. If used with run_ss3sim the case file should be named wtatage.

Usage

1
2
sample_wtatage(wta_file_in, outfile, dat_list, ctl_file_in, years,
  fill_fnc = fill_across, write_file = TRUE, fleets, cv_wtatage = NULL)

Arguments

wta_file_in

The file to read weight-at-age from. Specifically to get the age-0 weight-at-age. This is typically wtatage.ss_new.

outfile

A character string of the new file name to be created. Must end in .dat or equal wtatage.ss.

dat_list

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

ctl_file_in

A path to the control file, outputed from an OM, containing the OM parameters for growth and weight/length relationship. These values are used to determine the uncertainty about weight for fish sampled in each age bin. Commonly control.ss_new

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.

fill_fnc

*A function to fill in missing values (ages and years). The resulting weight-at-age file will have values for all years and ages.One function is fill_across.

write_file

A logical switch for whether to write outfile to disk. Can be turned off to speed up testing or exploration of the function. The new data are returned invisibly, as in the examples below.

fleets

*A numeric vector giving the fleets to be used. This order also pertains to other arguments. A missing value excludes that fleet from outfile (i.e. it turns it off so no samples are written). If none of the fleet collected samples, keep the value to fleets=NULL.

cv_wtatage

A user specified CV for growth. Default is NULL.

Value

A modified .wtatage.ss file if write_file = TRUE. A list object containing the modified .wtatage.ss 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, Allan Hicks, Peter Kuriyama

See Also

fill_across

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

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.