
Get a vector of data to be passed to a FIMS module from a FIMSFrame object
Source:R/fimsframe.R
model_.RdThere is an accessor function for each data type needed to run a FIMS model.
A FIMS model accepts vectors of data and thus each of the model_*()
functions, where the star can be replaced with the data type separated by
underscores, e.g., weight_at_age. These accessor functions are the preferred
way to pass data to a FIMS module because the data will have the appropriate
indexing.
Usage
model_catch(x, fleet)
# S4 method for class 'FIMSFrame'
model_catch(x, fleet)
# S4 method for class 'data.frame'
model_catch(x, fleet)
model_index(x, fleet)
# S4 method for class 'FIMSFrame'
model_index(x, fleet)
# S4 method for class 'data.frame'
model_index(x, fleet)
model_age_comp(x, fleet)
# S4 method for class 'FIMSFrame'
model_age_comp(x, fleet)
# S4 method for class 'data.frame'
model_age_comp(x, fleet)
model_length_comp(x, fleet)
# S4 method for class 'FIMSFrame'
model_length_comp(x, fleet)
# S4 method for class 'data.frame'
model_length_comp(x, fleet)
model_weight_at_age(x, fleet = NA_character_)
# S4 method for class 'FIMSFrame'
model_weight_at_age(x, fleet = NA_character_)
# S4 method for class 'data.frame'
model_weight_at_age(x, fleet = NA_character_)
model_age_to_length_conversion(x)
# S4 method for class 'FIMSFrame'
model_age_to_length_conversion(x)
# S4 method for class 'data.frame'
model_age_to_length_conversion(x)Arguments
- x
An object returned from
FIMSFrame().- fleet
A string, or vector of strings, specifying the name of the fleet(s) of interest that you want data for. The strings must exactly match strings in the
"fleet"column ofget_data(x).
Value
All of the model_*() functions return vectors of data. Currently, the
order of the data is the same order as the data frame because no arranging
is done in FIMSFrame() and the function just extracts the appropriate
column.
Details
Age_to_length_conversion data, i.e., the proportion of age "a" that are
length "l", are used to convert lengths (input data) to ages (modeled) as
a way to fit length data without estimating growth.
model_age_comp()
Returns a numeric vector of age-composition data (type "age_comp") for the
specified fleet(s).
model_length_comp()
Returns a numeric vector of length-composition data (type "length_comp")
for the specified fleet(s). This accessor requires that age-to-length
conversion data are present in the FIMSFrame object.
model_weight_at_age()
Returns a numeric vector of weight at age (type "weight_at_age"), ordered
by year and then age. Rows with timing = NA apply to every year and rows
with a timing replace that default for that year. With the default fleet = NA, the function returns the population weight at age from fleet = NA
rows, including the year after the last modeled year. For the population,
this additional year is needed to calculate biomass after all fishing for
the terminal year has occurred. When users specify fleet = NA but no
population-level information exists and information is only supplied for a
single fleet, then this fleet-level information will be used for both the
population and the fleet. The function will error though if population-level
information is absent and information for more than one fleet exists. When a
fleet name is specified, the function returns that fleet's weight at age for
the model years if available. For years without fleet- and year-specific
information, then the fleet-specific information without any timing attached
to it is returned. If no fleet-specific information is available for the
missing years, then the population's rows for that year will be returned;
and, finally population-level information with timing = NA rows is
returned for all other missing rows.
model_age_to_length_conversion()
Returns a numeric vector of age-to-length conversion observations.
Observations are ordered by age and length in the order defined by
FIMSFrame(). When multiple observations are present across a single age
and length, they are averaged because age_to_length_conversion data cannot
vary across fleets or time. The values for each age are then rescaled to sum
to 1.