Description Usage Arguments Details Value Examples
These functions create length distributions from Gadget StockStdPrinter
output and sample that output to simulate surveys. Error can be added to
simulated surveys in survey_gadget
and age and length subsamples can
be taken with strip_age_length_data
to more closely mimic real world
surveys
1 2 3 4 5 6 7 8 9 | survey_gadget(stock_data, length_groups, survey_suitability, survey_sigma,
variable = "number", keep_zero_counts = FALSE)
strip_age_length_data(stock_data, length_samples = 1, age_samples = 1,
quiet = FALSE)
replicate_datasets(stock_data, length_groups, survey_suitability, survey_sigma,
length_samples = 1, age_samples = NULL, quiet = FALSE, n = 10,
keep_zero_counts = FALSE)
|
stock_data |
A |
length_groups |
Numeric vector of length groups to distribute by. The difference in values probably should be the same as dl in Gadget model |
survey_suitability |
Numeric vector the same length as
|
survey_sigma |
Numeric value of multiplicative error to place on samples |
variable |
Character vector of the variable on which to distribute length groups. Default is "number". Can be "number.consumed" or "biomass.consumed" |
keep_zero_counts |
Logical. Keep year/step/area/age combinations with no individuals |
length_samples |
Numeric. If |
age_samples |
Numeric. If |
quiet |
Logical. If either |
n |
Integer. The number of times to replicate the sampling procedure |
Length-structured population information from Gadget is output as
mean length and standard deviation for each year, step, area, and age
combination. survey_gadget
takes output from
get_stock_std
(or read_gadget_stock_std
) and
distributes the number for each respective combination into numbers at each
length specified by length_groups
, simulates
surveys given the selectivity provided in survey_suitability
and
error given by survey_sigma
. If it is desired to have a subsample of
length and age data to more closely mimic real world scenarios, then the
output from survey_gadget
can be fed into strip_age_length_data
and subsamples of length and age data will be returned according to the given
proportions. The entire process can be replicated n number of times
using replicate_datasets
survey_gadget
returns a data.frame
similar to
stock_data
, but disaggregated by length based on the std. dev. found
in the StockStdPrinter.
strip_age_length_data
returns a named list of two
data.frame
s. One for length data and one for age data.
replicate_datasets
returns a names list of length 3, each element
containing a data.frame
with nrows the number of replications times
the nrow of stock_data
. The first of these data.frame
s is for
survey indices, the second for length data, and the third for age data.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | path <- system.file(gad_mod_dir, package = "gadgetSim")
cod_stock_std <- get_stock_std(main = "main",
path = path)
lengrps <- seq(0.5, 150.5, by = 1)
suitability <- logistic_selectivity(lengrps, 0.15, 20, 0.1)
cod_samples <- survey_gadget(cod_stock_std$cod, lengrps, suitability, 0.1)
cod_comp_data <-
strip_age_length_data(cod_samples, length_samples = 0.2, age_samples = 0.2)
# the above process can be automated n number of times
cod_comp_data <-
replicate_datasets(cod_stock_std$cod, lengrps, suitability,
survey_sigma = 0.1, length_samples = 0.2,
age_samples = 0.2, n = 10)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.