gadget_likelihood_comps: Create various Gadget likelihood components

Description Usage Arguments Value Examples

Description

These functions will create the various likelihood components used by Gadget in an optimizing run. There is a function for each specific likelihood component. These then get fed into make_gadget_likelihood, which will assemble them altogether into the Gadget likelihood file.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33

Arguments

...

Named elements corresponding to the arguments needed for each respective likelihood component (see Gadget User Guide)

areaagg

List with names corresponding to the aggregation and values to the areas to be included in those aggregations

ageagg

List with names corresponding to the aggregation and values to the ages to be included in those aggregations

lenagg

List with names corresponding to the aggregation and values to the lengths to be included in those aggreations

preyagg

List with names corresponding the the aggregated prey names and values to the prey to be included in those aggregations

label

Character. The label for each length group

min

Numeric. The minimum length or age value for each label

max

Numeric. The maximum length or age value for each label

Value

A list of class gadget_*_likelihood, with * corresponding to the approprate likelihood type

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# read in the data
path <- system.file(gad_mod_dir, package = "gadgetSim")
stock_std <- get_stock_std(path = path)

# sample the data
lengrps <- seq(0.5, 150.5, 1)
suit <- logistic_selectivity(lengrps, alpha = 0.25, l50 = 30)
cod_lengrps <- add_lengthgroups(stock_std$cod, lengrps)
cod_survey <- survey_gadget(cod_lengrps, lengrps, suit, 0)
cod_al_data <- strip_age_length_data(cod_survey, 0.5, 0.5)
spr_ldist <-
  subset(cod_al_data$length_data, step == 1)
spr_ldist$age <- "all"
spr_ldist <- subset(spr_ldist,
                    select = c("year", "step", "area",
                               "age", "length", "number"))

spr_aldist <-
  subset(cod_al_data$age_data, step == 1)

# make the components
spr_ldist_comp <-
  make_gadget_catchdistribution(name = "spr.ldist",
                                data = spr_ldist,
                                fleetnames = "spr",
                                stocknames = "cod",
                                ageagg = list(all = 1:20))
spr_aldist_comp <-
  make_gadget_catchdistribution(name = "spr.aldist",
                                data = spr_aldist,
                                fleetnames = "spr",
                                stocknames = "cod")

inspktrgadget/gadgetSim documentation built on May 10, 2019, 9:51 a.m.