gadget_likelihood_component {mfdb} | R Documentation |
Gadget likelihood components
Description
Structures representing a component of a GADGET likelihood file.
Usage
gadget_likelihood_component(type, weight = 0, name = type,
likelihoodfile = 'likelihood', ...)
Arguments
type |
Type of group to create. One of penalty, understocking, catchstatistics, catchdistribution, stockdistribution. |
name |
A descriptive name for the component |
weight |
A numeric weighting |
likelihoodfile |
The likelihood file this component should end up in |
... |
Extra parameters for the group. See details. |
Details
In addition, penalty
understands:
- data
A
data.frame
with 2 columns, "switch" and "power"
catchstatistics
understands:
- data_function
The function Gadget should use, by default guesses based on the function that generated
data
- data
A
data.frame
probably generated bymfdb_sample_meanlength_stddev
- area
An
list
of areas, taken fromattr(data, "area")
if not supplied- age
An
list
of ages, taken fromattr(data, "age")
if not supplied- fleetnames
List of fleet names
- stocknames
List of stock names
catchdistribution
understands:
- data_function
The function Gadget should use, by default uses sumofsquares
- data_function_params
Extra parameters to supply to gadget, based on the function
- aggregationlevel
TRUE or FALSE, defaults to FALSE
- overconsumption
TRUE or FALSE, defaults to FALSE
- epsilon
Numeric, defaults to 10
- data
A
data.frame
probably generated bymfdb_sample_meanlength_stddev
- area
An
list
of areas, taken fromattr(data, "area")
if not supplied- age
An
list
of ages, taken fromattr(data, "age")
if not supplied- length
An
list
of lengths, taken fromattr(data, "length")
if not supplied- fleetnames
List of fleet names
- stocknames
List of stock names
stockdistribution
understands:
- data_function
The function Gadget should use, by default uses sumofsquares
- overconsumption
TRUE or FALSE, defaults to FALSE
- epsilon
Numeric, defaults to 10
- data
A
data.frame
probably generated bymfdb_sample_meanlength_stddev
- area
An
list
of areas, taken fromattr(data, "area")
if not supplied- age
An
list
of ages, taken fromattr(data, "age")
if not supplied- length
An
list
of lengths, taken fromattr(data, "length")
if not supplied- fleetnames
List of fleet names
- stocknames
List of stock names
surveydistribution
understands:
- data
A
data.frame
probably generated bymfdb_sample_meanlength_stddev
- area
An
list
of areas, taken fromattr(data, "area")
if not supplied- length
An
list
of lengths, taken fromattr(data, "length")
if not supplied- age
An
list
of ages, taken fromattr(data, "age")
if not supplied- stocknames
List of stock names
- fittype, slope, intercept
Fit options, see GADGET manual
- parameters
A vector of length 2
- suitability
A single suitability function
- epsilon
Numeric, defaults to 10
- likelihoodtype
String, see GADGET manual
surveyindices
understands:
- sitype
What data the component is based on, see GADGET manual
- biomass
0 or 1, defaults to 0
- data
A
data.frame
probably generated bymfdb_sample_meanlength_stddev
- area
An
list
of areas, taken fromattr(data, "area")
if not supplied- age
An
list
of ages, taken fromattr(data, "age")
if not supplied- length
An
list
of lengths, taken fromattr(data, "length")
if not supplied- fleetnames
List of fleet names
- stocknames
List of stock names
- surveynames
List of acoustic survey names
- fittype, slope, intercept
Fit options, see GADGET manual
stomachcontent
understands:
- data_function
Function GADGET will use
- epsilon
To be used when calculated probability is low
- prey_labels
Either a vector of stock names to be used for all preys, or a list to match preys, see below
- prey_digestion_coefficients
Optional. Either a vector of coefficients fo be used for all preys, or a list to match preys, see below
- predator_names
Vector of predator stock names
- data
A
data.frame
probably generated bymfdb_sample_meanlength_stddev
Both prey_labels
and prey_digestion_coefficients
allow you to
match parts of prey labels and use repetition. For instance,
list("cod.mat" = "mature_cod", "cod" = "cod", "other")
will give
"cod.mat" the label "mature_cod", "cod.imm" the label "cod", and anything
else will get "other". You can also use regular expression syntax, for example
"cod[0-9]".
migrationpenalty
understands:
- stockname
Stock name
- powercoeffs
2 power coefficients
Value
A gadget_likelihood_component object that can then be written to a likelihood
file with gadget_dir_write
Examples
# Create a penalty component
component <- gadget_likelihood_component("penalty",
name = "bounds",
weight = "0.5",
data = data.frame(
switch = c("default"),
power = c(2),
stringsAsFactors = FALSE))
component
# Create an understocking component
component <- gadget_likelihood_component("understocking", name ="understock")
component
# Any example could be added to a file with the following:-
gd <- gadget_directory(tempfile())
gadget_dir_write(gd, component)