| Title: | R package interface for AGEPRO (Age Structured Projection Model) data |
|---|---|
| Description: | Object-oriented data structures based on the input file format defined in the Age Structured Projection Model Reference Manual. Includes support modules for AGEPRO input file support, and experimental JSON input file format. |
| Authors: | Eric Fletcher [aut, cre], Jon Brodziak [aut] |
| Maintainer: | Eric Fletcher <[email protected]> |
| License: | GPL (>= 3) |
| Version: | 0.9.1 |
| Built: | 2026-06-01 21:01:03 UTC |
| Source: | https://github.com/nmfs-ost/ageproR |
AGEPRO Input File Model
AGEPRO Input File Model
File Functionality is based on AGEPRO-CoreLib implementation
ageproR::agepro_model -> agepro_inp_model
nlinenlines
inp_filepathFilepath of AGEPRO input file
new()
Initializes an instance of the AGEPRO model with AGEPRO input file format functions. A default model can be initialized without setting general_params parameter values. The default values for the default model is:
Projection years: From yr_start 0 to yr_end 2
Ages: From age_begin 1 to age_end 6
1000 Population Simulations (num_pop_sims)
1 Fleet (num_fleets)
1 Recruit Model (num_rec_models)
Discards Present (discards_present): FALSE (or 0)
Pseudo-Randomly generated seed
agepro_inp_model$new( yr_start = 0, yr_end = 2, age_begin = 1, age_end = 6, num_pop_sims = 1000, num_fleets = 1, num_rec_models = 1, discards_present = 0, seed = sample.int(1e+08, 1), enable_cat_print = TRUE, show_general_params = TRUE, ... )
yr_startFirst Year of Projection
yr_endLast Year of Projection
age_beginAge begin
age_endAge end
num_pop_simsNumber of population simulations
num_fleetsNumber of fleets
num_rec_modelsNumber of Recruit Modules
discards_presentAre Discards present? FALSE by default
seedRandom Number seed. By Default, generates a pesdorandom number.
enable_cat_printLogical flag to show target function's cli cat_print
messages to be seen on console. In this instance, this is set to TRUE
show_general_paramsLogical flag to show AGEPRO model's general parameters on R console. TRUE, by default.
...further arguments passed to or from other methods
read_inp()
Read AGEPRO INP Input Files
agepro_inp_model$read_inp(inpfile)
inpfileinput file name
read_inpfile_values()
Read Input file Values
agepro_inp_model$read_inpfile_values(inp_con)
inp_conOpen file connection to AGEPRO Input File.
match_keyword()
Match Keyword
agepro_inp_model$match_keyword(inp_line, inp_con)
inp_lineLine read from the AGEPRO Input File
inp_conOpen file connection to AGEPRO Input File.
not_implemented()
Throws a Not Implemented exception message. Placeholder function.
agepro_inp_model$not_implemented(keyword = "")
keywordkeyword
write_inp()
Writes AGEPRO keyword parameter data as a AGEPRO input file (*.inp)
agepro_inp_model$write_inp( inpfile, delimiter = " ", overwrite_as_currentver = TRUE )
inpfileinput file path
delimiterCharacter string delimiter separating values of AGEPRO input file line.
overwrite_as_currentverAs default, overwrites version value to to the current version of the AGEPRO input file format.
clone()
The objects of this class are cloneable with this method.
agepro_inp_model$clone(deep = FALSE)
deepWhether to make a deep clone.
File Functionality on experimental JSON input file
ageproR::agepro_model -> agepro_json_model
new()
Initializes the instances of the AGEPRO Model
agepro_json_model$new(...)
...Parameters to initialize the parent
agepro_model class
get_json()
Return a json formatted object.
agepro_json_model$get_json()
See jsonlite::toJSON for more details.NA values in a list or
a multi-length vector will converted to JSON style NULL value, but
wrapped in a JSON array ([null, null]). Using the defaults in
jsonlite::fromJSON, the JSON null array can be is converted back to
NA. Single NA values will be reconverted to NULL.
write_json()
Write JSON file
agepro_json_model$write_json(file, show_dir = FALSE)
fileinput file path
show_dirOption to show directory after JSON file is written.
read_json()
Reads AGEPRO json experimental input file format.
agepro_json_model$read_json(file)
fileinput file path
import_agepro_inp_model()
Imports AGEPRO model data formatted for AGEPRO input files
(agepro_inp_model).
agepro_json_model$import_agepro_inp_model(inp_model)
inp_modelAGEPRO model with AGEPRO Input File (*.INP) functions
clone()
The objects of this class are cloneable with this method.
agepro_json_model$clone(deep = FALSE)
deepWhether to make a deep clone.
AGEPRO model contains the projection time horizon, age class range, number of fleets, recruitment, and uncertainties
AGEPRO performs stochastic projections on exploited fisheries stock to determine age-structured population over a time period. Brodziak, 2022
ver_inpfile_stringVersion string on AGEPRO input files (*.inp) for version compatibility with Jon Brodiak's AGEPRO calculation engine.
ver_json_formatJSON Input File Format version.
ver_rpackageReturns ageproR r package version.
projection_analyses_typeType of projection analyses: standard, rebuilding, pstar.
case_idTitle identifying AGEPRO model attributes
generalGeneral Options
bootstrapBootstrapping
natmortNatural Mortality
maturityMaturity Fraction
fishery
Fishery Selectivity
discard
Discard Fraction
stock_weightStock weight on January 1st at age
ssb_weightSpawning Stock Weight of Age
mean_weightMidyear mean population weight at age
catch_weightLanded catch weight at age by fleet
disc_weightDiscard weight of age by fleet
harvestHarvest intensity (of fishing mortality or landings quota) by fleet
recruitAGEPRO Recruitment Model information
percUser-selected percentile summary of the key results in the output file.
boundsBounds on simulated fish weights and natural mortality rates
refpointReference points for optional AGEPRO output threshold report.
scaleScaling factors for biomass, recruitment, and stock size
retroadjustRetrospective bias Adjustment
pstarCalculating Total Allowable Catch to produce , the
probability of overfishing in the target year.
rebuildcalculation of the constant total Fishing Mortality
calculated across all fleets with the rebuild spawning biomass.
biologicalSeasonal spawning timing for fishing mortality () and natural
mortality ()
optionsOptions for AGEPRO projection output
supported_inpfile_versionsSupported AGEPRO Input File formats
new()
Initializes the instance of the AGEPRO Model
agepro_model$new( yr_start, yr_end, age_begin, age_end, num_pop_sims, num_fleets, num_rec_models, discards_present = FALSE, seed = sample.int(1e+08, 1), show_general_params = TRUE, enable_cat_print = TRUE, ... )
yr_startFirst Year of Projection
yr_endLast Year of Projection
age_beginAge begin
age_endAge end
num_pop_simsNumber of population simulations
num_fleetsNumber of fleets
num_rec_modelsNumber of Recruit Modules
discards_presentAre Discards present? FALSE by default
seedRandom Number seed. By Default, generates a pesdorandom number.
show_general_paramsLogical flag to show AGEPRO model's general parameters on R console. TRUE, by default.
enable_cat_printLogical flag to show target function's cli
cat_print messages to be seen on console. This is
also used to print verbose information about the the initialized object.
By default, this is set to TRUE.
...further arguments passed to or from other methods
default_agepro_keyword_params()
This will create default values for each primary AGEPRO keyword
parameter based on the values passed by the general_params class.
Optional keyowrd parameters, such as as discard fraction or discard
weight may be created, if enabled.
agepro_model$default_agepro_keyword_params( x, projection_analyses_type = "standard", enable_cat_print = TRUE, ... )
xGeneral Params class object.
projection_analyses_typeType of projection analyses type.
Default is "standard".
enable_cat_printLogical flag to show target function's cli cat_print
messages to be seen on console.
...further arguments passed to or from other methods
set_recruit_model()
Setup recruitment with a recruitment model collection list with default data using current AGEPRO model's number of recruits and sequence of projection years.
To establish multiple recruit models, pass multiple valid AGERPRO
Recruitment Model numbers as vector to the model_num parameter. If
the vector length of model_num doesn't match current AGEPRO
general parameter's num_rec_models
value, it will throw an error.
agepro_model$set_recruit_model(..., enable_cat_print = TRUE)
...further arguments passed to or from other methods
enable_cat_printLogical flag to show target function's cli cat_print
messages to be seen on console.
set_bootstrap_filename()
Wrapper function to call bootstrap's set_bootstrap_filename
agepro_model$set_bootstrap_filename(bsnfile)
bsnfilebootstrap filename
setup_projection_analyses_values()
Helper Function to setup agepro model's projection analyses type. agepro models use standard projection analyses by default, and do not require additional keyword parameter setup. "pstar" and "rebuild" projection analyses types require their own keyword parameter classes to setup. However, they are not created during model initialization.
AGEPRO models must can not have both pstar and rebuilder projection analyses,
agepro_model$setup_projection_analyses_values(type, enable_cat_print = FALSE)
typeprojection_analyses_type
enable_cat_printLogical flag to show target function's cli cat_print
messages to be seen on console.
clone()
The objects of this class are cloneable with this method.
agepro_model$clone(deep = FALSE)
deepWhether to make a deep clone.
## Not run: # General parameters for 2019-2026 Uku Projections Base (Example 4) test <- agepro_model$new(2019,2026,1,32,1000,4,3,0,300) ## End(Not run)## Not run: # General parameters for 2019-2026 Uku Projections Base (Example 4) test <- agepro_model$new(2019,2026,1,32,1000,4,3,0,300) ## End(Not run)
Beverton-Holt w/ Lognormal Error (Model #5)
Beverton-Holt w/ Lognormal Error (Model #5)
ageproR::recruit_model -> ageproR::parametric_curve -> beverton_holt_curve_model
new()
Initializes the Beverton Holt Curve Model
beverton_holt_curve_model$new(alpha = 0, beta = 0, variance = 0)
alpha
Stock Recruitment Parameter, alpha
beta
Stock Recruitment Parameter, beta
variance
variance
clone()
The objects of this class are cloneable with this method.
beverton_holt_curve_model$clone(deep = FALSE)
deepWhether to make a deep clone.
-The Number of data values of each row must equal to the number of age classes. -The number of rows in a bootstrap file must be at least equal to the number of bootstrap iterations containing the population of the first year in the projection
num_bootstrapsNumber of bootstraps replicates of initial popualion size
pop_scale_factorPopulation Scale Factor, or BootFac, that represents the multiplicative factor to convert the relative bootstrap population numbers at age to absolute numbers at age.
bootstrap_fileBootstrap file path.
json_list_objectJSON list object for BOOTSTRAP keyword parameter
keyword_nameAGEPRO keyword parameter name
inp_keywordReturns AGEPRO input-file formatted Parameter
new()
Initializes the Bootstrap Class
bootstrap$new()
set_bootstrap_filename()
Uses file dialog interface to retrieve Bootstrap file name
bootstrap$set_bootstrap_filename(bsn_path)
bsn_pathBootstrap Filename (*.bsn) path
read_inp_lines()
Reads in BOOTSTRAP numbers and options from AGEPRO Input file
bootstrap$read_inp_lines(inp_con, nline)
inp_conOpen file connection to AGEPRO Input File.
nline
Location of the current line number being read when the file connection to
the AGEPRO input file is open.
get_inp_lines()
Returns BOOTSTRAP values AGEPRO input file format (*,inp)
bootstrap$get_inp_lines(delimiter = " ")
delimiterCharacter string delimiter separating values of AGEPRO input file line.
print()
Prints out BOOTSTRAP fields
bootstrap$print(...)
...further arguments passed to or from other methods
clone()
The objects of this class are cloneable with this method.
bootstrap$clone(deep = FALSE)
deepWhether to make a deep clone.
Helper function to format vector output, such as data.frames, matrices. or lists to message format.
capture_output_as_message(x)capture_output_as_message(x)
x |
Vector output object |
Input title identifying model attributes
model_nameString that describes the projection model run
keyword_nameAGEPRO keyword parameter name
inp_keywordReturns AGEPRO input-file formatted Parameter
new()
Initialize Class
case_id$new(model_name = NULL)
model_nameCharacter string that describes the projection model
print()
Prints out Model case id
case_id$print()
read_inp_lines()
Read AGEPRO Case ID from input data file
case_id$read_inp_lines(inp_con, nline)
inp_conOpen file connection to AGEPRO Input File.
nline
Location of the current line number being read when the file connection to
the AGEPRO input file is open.
get_inp_lines()
Returns the values for the CASEID keyword parameter formatted to the AGEPRO input file format.description
case_id$get_inp_lines()
clone()
The objects of this class are cloneable with this method.
case_id$clone(deep = FALSE)
deepWhether to make a deep clone.
Custom validation procedure to check if input value has the public methods and active bindings fields of the max_bounds R6Class.
check_bounds_active_binding(x) assert_bounds_active_binding(x, .var.name = checkmate::vname(x), add = NULL)check_bounds_active_binding(x) assert_bounds_active_binding(x, .var.name = checkmate::vname(x), add = NULL)
x |
Object to Check |
.var.name |
|
add |
|
Custom validation procedure to check if input value matches the structure of the case_id R6Class. It will also catch single character strings presuming that the input value was intended to set the model_name field.
check_case_id_active_binding(x) assert_case_id_active_binding(x, .var.name = checkmate::vname(x), add = NULL)check_case_id_active_binding(x) assert_case_id_active_binding(x, .var.name = checkmate::vname(x), add = NULL)
x |
Object to Check |
.var.name |
|
add |
|
Checks if input model number matches the number of recruitment models of the model.
check_model_num_vector_count(x, num_recruit_models) assert_model_num_vector_count( x, num_recruit_models, .var.name = checkmate::vname(x), add = NULL )check_model_num_vector_count(x, num_recruit_models) assert_model_num_vector_count( x, num_recruit_models, .var.name = checkmate::vname(x), add = NULL )
x |
Object to check |
num_recruit_models |
Number of recruitment models AGEPRO model at initialization |
.var.name |
|
add |
|
Custom validation to check
agepro_model$set_recruit_model()
arguments to see if multiple recruit numbers is passed as a single vector
or seen as a list of multiple arguments.
If the input value is passed as a list of multiple arguments, this function will "throw" a message of the issue and possible resolution.
assert_model_num_vector_format wraps check_model_num_vector_format as a custom checkmate assertion via checkmate::makeAssertion
check_model_num_vector_format(x) assert_model_num_vector_format(x, .var.name = checkmate::vname(x), add = NULL)check_model_num_vector_format(x) assert_model_num_vector_format(x, .var.name = checkmate::vname(x), add = NULL)
x |
object to check |
.var.name |
|
add |
|
Custom validation procedure to check if input value matches the structure of the percentile_summary R6Class. It will also catch single numeric input values presuming that the active binder sets the report_percentile.
check_perc_active_binding(x) assert_perc_active_binding(x, .var.name = checkmate::vname(x), add = NULL)check_perc_active_binding(x) assert_perc_active_binding(x, .var.name = checkmate::vname(x), add = NULL)
x |
Object to Check |
.var.name |
|
add |
|
Custom validation to check projection_years sequence vector is properly incremented by 1, Can be Wrapped as a custom checkmate assertion.
check_proj_years_sequence(x) assert_proj_years_sequence(x, .var.name = checkmate::vname(x), add = NULL)check_proj_years_sequence(x) assert_proj_years_sequence(x, .var.name = checkmate::vname(x), add = NULL)
x |
Object to check |
.var.name |
|
add |
|
NA valuesWrapper to Matrix function, that returns the object with
NA values. Uses the matrix dimnames argument to set row and column names.
See Matrix for more information.
create_blank_parameter_table(num_rows, num_cols, dimnames = NULL)create_blank_parameter_table(num_rows, num_cols, dimnames = NULL)
num_rows |
the desired number of rows |
num_cols |
the desired number of columns |
dimnames |
Matrix |
DEPRECATED Recruitment Model #9 (Time-Varying Empirical Recruitment Distribution)
DEPRECATED Recruitment Model #9 (Time-Varying Empirical Recruitment Distribution)
Handles an instance for deprecated recruitment model #9.
ageproR::recruit_model -> deprecated_recruit_model_9
json_recruit_dataFunction container to export recruitment model data to experimental jSon input model file. Because recruitment model #9 is DEPRECATED, and not used in the AGEPRO calculation engine, an error will thrown.
new()
Initializes the class
deprecated_recruit_model_9$new()
print()
Prints out the error
deprecated_recruit_model_9$print(...)
...further arguments passed to or from other methods
inp_lines_recruit_data()
Function container to export recruitment model data to AGEPRO input model file lines, but since this model is DEPRECATED; not a valid recruitment model type for the AGEPRO calculation engine, an error will thrown.
deprecated_recruit_model_9$inp_lines_recruit_data(delimiter = " ")
delimiterCharacter string delimiter separating values of AGEPRO input file line.
clone()
The objects of this class are cloneable with this method.
deprecated_recruit_model_9$clone(deep = FALSE)
deepWhether to make a deep clone.
Class Structure for discard faction at age AGEPRO Keyword parameter. AGEPRO model must indicate discards are present, enabled via general options discards_present field.
ageproR::process_error -> discard_fraction
new()
Initializes Class
discard_fraction$new( proj_years, num_ages, num_fleets, input_option = 0, time_varying = TRUE, enable_cat_print = TRUE )
proj_yearsProjection years: Input can be Sequence of years in from first to last year of projection or the number of years in the time projection.
num_agesNumber of Age classes
num_fleetsNumber of Fleets.
input_optionOption to indicate this parameter will be:
0 By default, done interactively via interface.
1 Imported via location of an existing data file.
time_varyingLogical flag that enables the stochastic parameter to use as a time-varying array if TRUE (or 1). Otherwise, FALSE the vector will cover "all years" of the projection. Default is TRUE.
enable_cat_printLogical flag to show target function's cli cat_print
messages to be seen on console.
clone()
The objects of this class are cloneable with this method.
discard_fraction$clone(deep = FALSE)
deepWhether to make a deep clone.
AGEPRO keyword parameter class Structure for this fishery process with multiplicative lognormal error distribution.
ageproR::process_error -> discard_weight_age
new()
Initializes class
discard_weight_age$new( proj_years, num_ages, num_fleets, input_option = 0, time_varying = TRUE, enable_cat_print = TRUE )
proj_yearsProjection years: Input can be Sequence of years in from first to last year of projection or the number of years in the time projection.
num_agesNumber of Age classes
num_fleetsNumber of Fleets.
input_optionOption to indicate this parameter will be:
0 By default, done interactively via interface.
1 Imported via location of an existing data file.
time_varyingLogical flag that enables the stochastic parameter to use as a time-varying array if TRUE (or 1). Otherwise, FALSE the vector will cover "all years" of the projection. Default is TRUE.
enable_cat_printLogical flag to show target function's cli cat_print
messages to be seen on console.
clone()
The objects of this class are cloneable with this method.
discard_weight_age$clone(deep = FALSE)
deepWhether to make a deep clone.
Empirical CDF of Recruitment (Model #14)
Empirical CDF of Recruitment (Model #14)
ageproR::recruit_model -> ageproR::empirical_recruit -> empirical_cdf_model
new()
Initialize the Empirical CDF Model
empirical_cdf_model$new(num_observations = 2, obs_table = NULL)
num_observations
Number of Empirical Observation Records
obs_tableData Frame containing empirical recruitment observation table. If NULL, set to default values.
clone()
The objects of this class are cloneable with this method.
empirical_cdf_model$clone(deep = FALSE)
deepWhether to make a deep clone.
Empirical Recruitment Distribution (Model #3)
Empirical Recruitment Distribution (Model #3)
ageproR::recruit_model -> ageproR::empirical_recruit -> empirical_distribution_model
new()
Initialize the Empirical Recruitment Distribution Model
empirical_distribution_model$new(num_observations, obs_table = NULL)
num_observations
Number of Empirical Observation Records
obs_tableData Frame containing empirical recruitment observation table. If NULL, set to default values.
clone()
The objects of this class are cloneable with this method.
empirical_distribution_model$clone(deep = FALSE)
deepWhether to make a deep clone.
Recruitment Model Description
ageproR::recruit_model -> empirical_recruit
with_ssbwith ssb
low_boundLowest significant number bound
json_recruit_datagets JSON-ready Recruit Model Data
observed_pointsGets/Sets the number of observations used of the model projection
observationsRecruitment Inupt Array (data)
super_Binds the super class with the empirical_recruit child classes
new()
Creates an Empirical Recruit instance
empirical_recruit$new(num_observations = 1, with_ssb = FALSE, obs_table = NULL)
num_observations
Number of Empirical Observation Records
with_ssbEmpirical Recruitment includes Spawning Stock Biomass (SSB)
obs_tableData Frame containing empirical recruitment observation table. If NULL, set to default values.
new_obs_table()
Create Obs table
empirical_recruit$new_obs_table()
set_obs_table_from_df()
Input data frame to set empirical recruitment observation data table. Typically used at initialization.
empirical_recruit$set_obs_table_from_df(df)
dfInput data frame
print()
Prints out Recruitment Model
empirical_recruit$print(...)
...further arguments passed to or from other methods
print_json()
Returns Recruit data as JSON
empirical_recruit$print_json()
read_inp_lines()
Read inp lines
empirical_recruit$read_inp_lines(inp_con, nline)
inp_conOpen file connection to AGEPRO Input File.
nline
Location of the current line number being read when the file connection to
the AGEPRO input file is open.
inp_lines_recruit_data()
Exports RECRUIT submodel data for empirical recruitment types to AGEPRO input file lines.
empirical_recruit$inp_lines_recruit_data(delimiter = " ")
delimiterCharacter string delimiter separating values of AGEPRO input file line.
clone()
The objects of this class are cloneable with this method.
empirical_recruit$clone(deep = FALSE)
deepWhether to make a deep clone.
Empirical Recruits Per Spawning Biomass Distribution (SSB) (Model #2)
Empirical Recruits Per Spawning Biomass Distribution (SSB) (Model #2)
The empirical recruits per spawning biomass distribution model depends on spawning biomass and is time-invariant.
ageproR::recruit_model -> ageproR::empirical_recruit -> empirical_ssb
new()
Initializes the Empirical Recruits Per Spawning Biomass Distribution Model
empirical_ssb$new(num_observations, obs_table = NULL)
num_observations
Number of Empirical Observation Records
obs_tableData Frame containing empirical recruitment observation table. If NULL, set to default values.
clone()
The objects of this class are cloneable with this method.
empirical_ssb$clone(deep = FALSE)
deepWhether to make a deep clone.
Class Structure for Fishery Selectivity at age by fleet AGEPRO Keyword parameter.
ageproR::process_error -> fishery_selectivity
new()
Initializes new instance
fishery_selectivity$new( proj_years, num_ages, num_fleets, input_option = 0, time_varying = TRUE, enable_cat_print = TRUE )
proj_yearsProjection years: Input can be Sequence of years in from first to last year of projection or the number of years in the time projection.
num_agesNumber of Age classes
num_fleetsNumber of Fleets.
input_optionOption to indicate this parameter will be:
0 By default, done interactively via interface.
1 Imported via location of an existing data file.
time_varyingLogical flag that enables the stochastic parameter to use as a time-varying array if TRUE (or 1). Otherwise, FALSE the vector will cover "all years" of the projection. Default is TRUE.
enable_cat_printLogical flag to show target function's cli cat_print
messages to be seen on console.
clone()
The objects of this class are cloneable with this method.
fishery_selectivity$clone(deep = FALSE)
deepWhether to make a deep clone.
Stores overall AGERPRO model project parameters including the projection time horizon, the target model's age class range, the quantity of recruitment models used, and fishery processes that affect projections.
yr_startFirst Year in Projection
yr_endLast Year in Projection
age_beginFirst Age Class
age_endLast Age Class
num_pop_simsNumber of Population Simulations
num_fleetsNumber of Fleets
num_rec_modelsNumber of Recruitment Models
discards_presentAre discards present?
seedPseudo Random Number seed
num_yearsDetermines the number of years in projection by the (absolute) difference of the last and first year of projection.
num_agesDetermines number of ages by the (absolute) difference of the first and last age class.
seq_yearsReturns a sequence of years from First year of projection
keyword_nameAGEPRO keyword parameter name
inp_keywordReturns AGEPRO input-file formatted Parameter
json_list_objectList of GENERAL keyword fields values, exportable to JSON.
new()
Starts an instances of the AGEPRO Model
general_params$new( yr_start = 0, yr_end = 2, age_begin = 1, age_end = 6, num_pop_sims = 1000, num_fleets = 1, num_rec_models = 1, discards_present = FALSE, seed = sample.int(1e+08, 1), enable_cat_print = TRUE )
yr_startFirst Year of Projection
yr_endLast Year of Projection
age_beginage begin
age_endage end
num_pop_simsNumber of population sims
num_fleetsNumber of fleets
num_rec_modelsNumber of Recruit Modeles
discards_presentdiscards_present
seedRandom Number seed
enable_cat_printLogical flag to show target function's messages on console. By Default, set to TRUE.
print()
Prints out General Parameters
general_params$print(...)
...further arguments passed to or from other methods
read_inp_lines()
Reads General AGEPRO parameters from AGEPRO INP Input File
general_params$read_inp_lines(inp_con, nline)
inp_conOpen file connection to AGEPRO Input File.
nline
Location of the current line number being read when the file connection to
the AGEPRO input file is open.
get_inp_lines()
Returns the values for the GENERAL keyword parameter formatted to the AGEPRO input file format.
general_params$get_inp_lines(delimiter = " ")
delimiterCharacter string delimiter separating values of AGEPRO input file line.
clone()
The objects of this class are cloneable with this method.
general_params$clone(deep = FALSE)
deepWhether to make a deep clone.
Class Structure containing the Harvest values and Harvest Specifications
harvest_specificationsContains values the Harvest Specification per projection year
F-MULT
LANDINGS
REMOVALS
harvest_valueContains the harvest Amount per projection year. Can be fleet specific if more than 2 fleets are specified.
harvest_scenario_tableCombines the Harvest specification and (fleet) harvest amount per projection year.
json_list_objectReturns JSON list object with Harvest Specification and Harvest Values
keyword_nameAGEPRO keyword parameter name
inp_keywordReturns AGEPRO input-file formatted Parameter
new()
Initializes Class
harvest_scenario$new(projection_years, num_fleets = 1, ...)
projection_yearsProjection years: Input can be Sequence of years in from first to last year of projection or the number of years in the time projection.
num_fleetsNumber of Fleets. Default is 1
...further arguments passed to or from other methods
print()
Formatted to print out the Harvest Scenario Table
harvest_scenario$print(enable_cat_print = TRUE)
enable_cat_printLogical flag to show target function's cli cat_print
messages to be seen on console.
setup_harvest_scenario_variables()
Helper function to setup harvest_scenario's variables harvest_specifications, harvest_value, harvest_scenario_table
harvest_scenario$setup_harvest_scenario_variables(proj_years, num_fleets = 1)
proj_yearsProjection years object
num_fleetsNumber of Fleets. Defaults to 1
read_inp_lines()
Reads in Harvest Scenario keyword parameter's values from the AGEPRO Input file
harvest_scenario$read_inp_lines(inp_con, nline, proj_years, num_fleets = 1)
inp_conOpen file connection to AGEPRO Input File.
nline
Location of the current line number being read when the file connection to
the AGEPRO input file is open.
proj_yearsProjection years: Input can be Sequence of years in from first to last year of projection or the number of years in the time projection.
num_fleetsNumber of Fleets. Default is 1
get_inp_lines()
Returns Harvest Specification and Harvest Values from the Harvest Scenario parameter formatted to the AGEPRO input file format.
harvest_scenario$get_inp_lines(delimiter = " ")
delimiterCharacter string delimiter separating values of AGEPRO input file line.
clone()
The objects of this class are cloneable with this method.
harvest_scenario$clone(deep = FALSE)
deepWhether to make a deep clone.
Returns a reusable invalid Path Message
invalid_path_message(x)invalid_path_message(x)
x |
Filepath string |
vscode uses/emulates rstudioapi but not all features rstudioapi are implemented. vscode's rstudio version information is set to '0'. For Rstudio specific code, check for mode "desktop", and version > '0'
is_rstudio_desktop()is_rstudio_desktop()
AGEPRO keyword parameter class Structure for this fishery process with multiplicative lognormal error distribution.
ageproR::process_error -> jan_stock_weight_age
new()
Initializes class
jan_stock_weight_age$new( proj_years, num_ages, input_option = 0, time_varying = TRUE, enable_cat_print = TRUE )
proj_yearsProjection years: Input can be Sequence of years in from first to last year of projection or the number of years in the time projection.
num_agesNumber of Age classes
input_optionOption to indicate this parameter will be:
0 By default, done interactively via interface.
1 Imported via location of an existing data file.
time_varyingLogical flag that enables the stochastic parameter to use as a time-varying array if TRUE (or 1). Otherwise, FALSE the vector will cover "all years" of the projection. Default is TRUE.
enable_cat_printLogical flag to show target function's cli cat_print
messages to be seen on console.
clone()
The objects of this class are cloneable with this method.
jan_stock_weight_age$clone(deep = FALSE)
deepWhether to make a deep clone.
AGEPRO keyword parameter class Structure for this fishery process with multiplicative lognormal error distribution.
ageproR::process_error -> landed_catch_weight_age
new()
Initializes class
landed_catch_weight_age$new( proj_years, num_ages, num_fleets, input_option = 0, time_varying = TRUE, enable_cat_print = TRUE )
proj_yearsProjection years: Input can be Sequence of years in from first to last year of projection or the number of years in the time projection.
num_agesNumber of Age classes
num_fleetsNumber of Fleets.
input_optionOption to indicate this parameter will be:
0 By default, done interactively via interface.
1 Imported via location of an existing data file.
time_varyingLogical flag that enables the stochastic parameter to use as a time-varying array if TRUE (or 1). Otherwise, FALSE the vector will cover "all years" of the projection. Default is TRUE.
enable_cat_printLogical flag to show target function's cli cat_print
messages to be seen on console.
clone()
The objects of this class are cloneable with this method.
landed_catch_weight_age$clone(deep = FALSE)
deepWhether to make a deep clone.
AGEPRO keyword parameter class Structure for this fishery process with multiplicative lognormal error distribution.
ageproR::process_error -> maturity_fraction
new()
Initializes Class
maturity_fraction$new( proj_years, num_ages, input_option = 0, time_varying = TRUE, enable_cat_print = TRUE )
proj_yearsProjection years: Input can be Sequence of years in from first to last year of projection or the number of years in the time projection.
num_agesNumber of Age classes
input_optionOption to indicate this parameter will be:
0 By default, done interactively via interface.
1 Imported via location of an existing data file.
time_varyingLogical flag that enables the stochastic parameter to use as a time-varying array if TRUE (or 1). Otherwise, FALSE the vector will cover "all years" of the projection. Default is TRUE.
enable_cat_printLogical flag to show target function's cli cat_print
messages to be seen on console.
clone()
The objects of this class are cloneable with this method.
maturity_fraction$clone(deep = FALSE)
deepWhether to make a deep clone.
Class Structure that defines maximum bound for weight and natural mortality. The values can be used to limit these values.
The logical flag enable_max_bounds allows the user to
set values to this class fields: max_weight, max_natural_mortality. The flag
will also notify agepro_model if this keyword parameter is allowed to be
written to input file.
Setting maximum bounds is an optional option for agepro models. It will check
if the max_bound class was initialized with values equal to the default
value for max_weight and max_nat_mort. If both values match the defaults,
then enable_max_bounds is flagged as FALSE; this keyword parameter is not
used in the agepro_model. Setting non-default values for all of its
parameters will set this flag to TRUE.
The max_bounds class (or BOUNDS) is recognized as a keyword parameter used in the AGEPRO input file format, but it is optional.
max_weightThe maximum value of fish weight, noting that there is lognormal sampling variation for weight at age values
max_natural_mortalityThe maximum natural mortality rate, noting that there is lognormal sampling variation for natural mortality at age values
json_list_objectReturns JSON list object of containing BOUNDS values
enable_max_boundsLogical field that flags if fields can be edited. To set
the value use set_enable_max_bounds or field
keyword_nameAGEPRO keyword parameter name
inp_keywordReturns AGEPRO input-file formatted Parameter
new()
Initializes the class
max_bounds$new(max_weight = 10, max_nat_mort = 1, bounds_flag = NULL)
max_weightMaximum bound weight (MT). Default is 10.0
max_nat_mortMaximum bound of natural mortality. Default is 1.0.
bounds_flagR6class containing option flags to allow max bounds to be used
print()
Formatted to print out max_bounds values
max_bounds$print()
read_inp_lines()
Reads in the values from the keyword parameter BOUNDS from the AGEPRO Input file
Note: enable_max_bounds must be set to TRUE.
max_bounds$read_inp_lines(inp_con, nline)
inp_conOpen file connection to AGEPRO Input File.
nline
Location of the current line number being read when the file connection to
the AGEPRO input file is open.
get_inp_lines()
Returns values from the class to the BOUNDS AGEPRO keyword parameter formatted as AGEPRO input file lines.
max_bounds$get_inp_lines(delimiter = " ")
delimiterCharacter string delimiter separating values of AGEPRO input file line.
clone()
The objects of this class are cloneable with this method.
max_bounds$clone(deep = FALSE)
deepWhether to make a deep clone.
AGEPRO keyword parameter class Structure for this population process with multiplicative lognormal error distribution.
ageproR::process_error -> mean_population_weight_age
new()
Initializes class
mean_population_weight_age$new( proj_years, num_ages, input_option = 0, time_varying = TRUE, enable_cat_print = TRUE )
proj_yearsProjection years: Input can be Sequence of years in from first to last year of projection or the number of years in the time projection.
num_agesNumber of Age classes
input_optionOption to indicate this parameter will be:
0 By default, done interactively via interface.
1 Imported via location of an existing data file.
time_varyingLogical flag that enables the stochastic parameter to use as a time-varying array if TRUE (or 1). Otherwise, FALSE the vector will cover "all years" of the projection. Default is TRUE.
enable_cat_printLogical flag to show target function's cli cat_print
messages to be seen on console.
clone()
The objects of this class are cloneable with this method.
mean_population_weight_age$clone(deep = FALSE)
deepWhether to make a deep clone.
Class Structure that includes proportion seasonal timing for fishing mortality & natural mortality prior to spawning season
time_varyingLogical flag to list fishing and natural mortality per observation year if TRUE or representative of the
proportion_total_mortality_matrixProportion of total mortality occurring prior to spawning
natural_mortality_prior_spawnReturns the proportions of Natural mortality (TM) that occurs from January 1st to Spawning Season.
fishing_mortality_prior_spawnReturns within-year fractions of fishing mortality (TF) that occurs from January 1st to Spawning Season.
json_list_objectReturns JSON list object of values from the mortality_fraction_prior_spawn class
keyword_nameAGEPRO keyword parameter name
inp_keywordReturns AGEPRO input-file formatted Parameter
new()
Initializes the class
mortality_fraction_prior_spawn$new( proj_years_vector, time_varying = FALSE, default_proportion = 0.5, enable_cat_print = TRUE )
proj_years_vectorInput can be Sequence of years in from first to last year of projection or the number of years in the time projection.
time_varyingLogical flag that enables the stochastic parameter to use as a time-varying array if TRUE (or 1). Otherwise, FALSE the vector will cover "all years" of the projection. Default is FALSE
default_proportionProportion default values. Time varying will adjust the values by number of projection years.
enable_cat_printLogical flag to show target function's cli cat_print
messages to be seen on console.
enable_cat_printLogical flag to show target function's cli cat_print
messages to be seen on console.
print()
Formatted to print out the values of the Fraction Mortality Parameter
mortality_fraction_prior_spawn$print(enable_cat_print = TRUE)
read_inp_lines()
Reads in the values from the keyword parameter BIOLOGICAL from the AGEPRO Input file
mortality_fraction_prior_spawn$read_inp_lines( inp_con, nline, proj_years_vector )
inp_conOpen file connection to AGEPRO Input File.
nline
Location of the current line number being read when the file connection to
the AGEPRO input file is open.
proj_years_vectorInput can be Sequence of years in from first to last year of projection or the number of years in the time projection.
get_inp_lines()
Returns values from the mortality_fraction_prior_spawn (BIOLOGICAL) AGEPRO keyword parameter formatted as AGEPRO input file lines.
mortality_fraction_prior_spawn$get_inp_lines(delimiter = " ")
delimiterCharacter string delimiter separating values of AGEPRO input file line.
clone()
The objects of this class are cloneable with this method.
mortality_fraction_prior_spawn$clone(deep = FALSE)
deepWhether to make a deep clone.
Generalized Class Structure for Natural Mortality rate of age AGEPRO Keyword parameter.
ageproR::process_error -> natural_mortality
new()
Initializes the class
natural_mortality$new( proj_years, num_ages, input_option = 0, time_varying = TRUE, enable_cat_print = TRUE )
proj_yearsProjection years: Input can be Sequence of years in from first to last year of projection or the number of years in the time projection.
num_agesNumber of Age classes
input_optionOption to indicate this parameter will be:
0 By default, done interactively via interface.
1 Imported via location of an existing data file.
time_varyingLogical flag that enables the stochastic parameter to use as a time-varying array if TRUE (or 1). Otherwise, FALSE the vector will cover "all years" of the projection. Default is TRUE.
enable_cat_printLogical flag to show target function's cli cat_print
messages to be seen on console.
clone()
The objects of this class are cloneable with this method.
natural_mortality$clone(deep = FALSE)
deepWhether to make a deep clone.
Recruitment Model Description
ageproR::recruit_model -> null_recruit_model
json_recruit_dataFunction container to export recruitment model data to experimental jSon input model file. However, NULL recruitment is not a valid recruitment model type, an error will thrown.
new()
Initialize
null_recruit_model$new()
print()
Prints out NULL Recruiment Model Data
null_recruit_model$print(...)
...further arguments passed to or from other methods
inp_lines_recruit_data()
Function container to export recruitment model data to AGEPRO input model file lines, but since NULL recruitment is not a valid recruitment model type for the AGEPRO calculation engine, an error will thrown to indicate NuLL recruitment
null_recruit_model$inp_lines_recruit_data(delimiter = " ")
delimiterCharacter string delimiter separating values of AGEPRO input file line.
clone()
The objects of this class are cloneable with this method.
null_recruit_model$clone(deep = FALSE)
deepWhether to make a deep clone.
Encapsulates logical flags indicating that an optional AGEPRO's option can be used: these options are percentile summary (PERC), scaling factors (SCALE), biological reference points (REFPOINT), maximum bounds (BOUNDS), and retrospective adjustment (RETROADJUST).
Associated with AGEPRO's output options (OPTIONS) are additional optional options:
PERC : percentile_summary
REFPOINT : reference_points
SCALE : scaling_factors
BOUNDS : max_bounds
RETROADJUST : retrospective_adjustment
The AGEPRO input file format recognizes these optional keyword parameters.
At initialization, all option flags will be set to FALSE. To "enable" an
optional option or set it to TRUE, assign a value to the optional option's
field. For example, if the flag to enable for percentile summary
is FALSE: set value report_percentile,
Then it will be TRUE
enable_percentile_summaryEnables output summary report of specific Percentile
enable_reference_pointsEnables biological reference points threshold report
enable_scaling_factorsEnables Scaling Factors
enable_max_boundsSets maximum bounds of Weight(MT) and natural mortality
enable_retrospective_adjustmentsAllows use of Retrospective Adjustment Factors by Age
clone()
The objects of this class are cloneable with this method.
options_flag_container$clone(deep = FALSE)
deepWhether to make a deep clone.
opClass container that encapsulates logical flags to enable AGEPRO user-defined options
new()
Initialize
options_flags$new()
clone()
The objects of this class are cloneable with this method.
options_flags$clone(deep = FALSE)
deepWhether to make a deep clone.
Class Structure that includes user-defined options to enable auxiliary or options to export AGEPRO output
auxfile_output_flagLogical flag to output stock summary information
process_error_datafilesLogical flag to output population and fishery processes simulated with lognormal process error (process_error parameters) to auxiliary output files
export_dfLogical flag to output AGEPRO calculation engine
projection results to R data.frame. Default is
1 (or TRUE) at initialization.
valid_aux_output_flagsReturns a list of valid numerical flags to enable _Stock of Age _ Distribution Summary and Auxiliary Files.
enable_agepro40_formatLogical flag to indicate model is using the
AGEPRO VERSION 4.0 format for setting auxiliary files.
json_list_objectReturns JSON list object of containing options_output values
keyword_nameAGEPRO keyword parameter name
inp_keywordReturns AGEPRO input-file formatted Parameter
new()
Initializes the class
options_output$new( auxiliary_flag = 0, process_error_datafiles = FALSE, export_df = TRUE, enable_agepro40_format = FALSE )
auxiliary_flagNumeric flag to enable Stock Distribution Summary file and auxiliary data. The following options allow the user to select which output from the AGEPRO calculation engine is returned:
Do not output Stock of Age Distribution Summary File, but output auxiliary data files EXCEPT the Stock Numbers of Age Auxiliary File.
Output Stock of Age Distribution Summary File and all auxiliary data files files.
Do not output Stock of Age Distribution Summary and Auxiliary files.
Output Stock of Age Distribution Summary, but do not output any auxiliary files.
Output Stock of Age Distribution Summary and Auxiliary files EXCEPT the Stock Numbers of Age Auxiliary File
process_error_datafilesLogical flag to enable output of population and fishery process error results as auxiliary files
export_dfLogical flag to enable AGEPRO output to data.frame
enable_agepro40_formatLogical flag to indicate model is using the
AGEPRO VERSION 4.0 format for setting auxiliary files.
print()
Formatted to print out output_option values
options_output$print()
read_inp_lines()
Reads in the values from the keyword parameter OPTIONS from the AGEPRO Input file
options_output$read_inp_lines(inp_con, nline)
inp_conOpen file connection to AGEPRO Input File.
nline
Location of the current line number being read when the file connection to
the AGEPRO input file is open.
get_inp_lines()
Returns values from the options_output (OPTIONS) AGEPRO keyword parameter formatted as AGEPRO input file lines.
options_output$get_inp_lines(delimiter = " ")
delimiterCharacter string delimiter separating values of AGEPRO input file line.
clone()
The objects of this class are cloneable with this method.
options_output$clone(deep = FALSE)
deepWhether to make a deep clone.
Recruitment Model Description
ageproR::recruit_model -> parametric_curve
json_recruit_dataReturns JSON-ready Recruit Model Data'
alphaSets the Parametric Curve Parameter, alpha. Returns the current value if no argument was passed
betaSets the Parametric Curve Parameter, beta. Returns the current value if no argument was passed
varianceSets the Parametric Curve Parameter, variance. Returns the current value if no argument was passed.
model_groupModel group Number
super_Binds the super class to parametric_curve child classes
new()
Instantiate Parametric Recruitment Curve Model
parametric_curve$new(alpha = 0, beta = 0, variance = 0)
alpha
Stock Recruitment Parameter, alpha
beta
Stock Recruitment Parameter, beta
variance
variance
inp_lines_recruit_data()
Exports RECRUIT submodel data for parametric curve recruitment to AGEPRO input file lines.
parametric_curve$inp_lines_recruit_data(delimiter = " ")
delimiterCharacter string delimiter separating values of AGEPRO input file line.
print()
Prints out Parametric Data
parametric_curve$print(...)
...further arguments passed to or from other methods
read_inp_lines()
Reads Parametric Curve model data from AGEPRO Input file
parametric_curve$read_inp_lines(inp_con, nline)
inp_conOpen file connection to AGEPRO Input File.
nline
Location of the current line number being read when the file connection to
the AGEPRO input file is open.
clone()
The objects of this class are cloneable with this method.
parametric_curve$clone(deep = FALSE)
deepWhether to make a deep clone.
Class Structure that includes user-defined options for setting a specific percentile for the distributions of outputs.
The logical flag enable_percentile_summary allows the user to
set values to this class field: report_percentile. The flag will also notify
agepro_model if this keyword parameter is allowed to be written to
input file.
If percentile_summary is initialized with default values, it is
presumed that this keyword parameter is not used in the agepro_model.
Therefore, enable_percentile_summary is flagged as FALSE. Valid non-
default values will set this flag to TRUE.#'
The percentile_summary class (or PERC) is an optional keyword
parameter used in the AGEPRO input file format.
report_percentileUser-defined percentile for reporting the percentile of the projected distribution of the following quantities of interest by year: spawning stock biomass, stock biomass on January 1st, mean biomass, combined catch biomass, landings, fishing mortality, and stock numbers at age
enable_percentile_summaryRead-only logical field that flags if fields can be edited. To set
the value use set_enable_percentile_summary or field
json_list_objectReturns JSON list object of containing options_output values
keyword_nameAGEPRO keyword parameter name
inp_keywordReturns AGEPRO input-file formatted Parameter
new()
Initializes the class
percentile_summary$new(perc = 0, perc_flag = NULL)
percUser-defined percentile of projected distributions
perc_flagR6class containing option flags to allow percentile summary to be used
print()
Formatted to print out output_option values
percentile_summary$print()
read_inp_lines()
Reads in the values from the keyword parameter PERC from the AGEPRO Input file
percentile_summary$read_inp_lines(inp_con, nline)
inp_conOpen file connection to AGEPRO Input File.
nline
Location of the current line number being read when the file connection to
the AGEPRO input file is open.
get_inp_lines()
Returns values from the class to the PERC AGEPRO keyword parameter formatted as AGEPRO input file lines.
percentile_summary$get_inp_lines(delimiter = " ")
delimiterCharacter string delimiter separating values of AGEPRO input file line.
clone()
The objects of this class are cloneable with this method.
percentile_summary$clone(deep = FALSE)
deepWhether to make a deep clone.
Helper function to print out AGEPRO keyword parameter's table-like matrix or vector variables to console. Includes an option to show the first few rows to the console.
print_parameter_table(tbl, omit_rows = FALSE)print_parameter_table(tbl, omit_rows = FALSE)
tbl |
AGEPRO Keyword Parameter matrix/vector variable |
omit_rows |
Logical flag, if |
Generalized Class Structure for AGEPRO Keyword parameters who have process errors that generate time-varying dynamics of population and fishery process.
input_optionOption to indicate this parameter will be read:
0 By default, done interactively via interface.
1 Imported via location of an existing data file.
time_varyingLogical flag to list parameter process data by observation year
parameter_tableThis is the logic for the fish population or fishery's processes by age (and by fleet if fleets are a factor).
cv_tableMatrix containing the vector of the lognormal process error of the average population or fishery process parameter's at age (and by fleet if fleets are a factor).
parameter_titleName of the population or fishery process
keyword_nameAGEPRO keyword parameter name
inp_keywordReturns AGEPRO input-file formatted Parameter name
json_list_objectReturns JSON list object with Process Error Parameter values
new()
Initializes the class
process_error$new( proj_years, num_ages, num_fleets = 1, input_option = 0, time_varying = TRUE, ... )
proj_yearsProjection years: Input can be Sequence of years in from first to last year of projection or the number of years in the time projection.
num_agesNumber of Age classes
num_fleetsNumber of Fleets. Default is 1
input_optionOption to indicate this parameter will be:
0 By default, done interactively via interface.
1 Imported via location of an existing data file.
time_varyingLogical flag that enables the stochastic parameter to use as a time-varying array if TRUE (or 1). Otherwise, FALSE the vector will cover "all years" of the projection. Default is TRUE.
...further arguments passed to or from other methods
create_parameter_table()
Creates an Population or Fishery process Parameter table
process_error$create_parameter_table(fleet_yr_rows, ages_cols)
fleet_yr_rows(Fleet-)Year Row
ages_colsAge Columns
print()
Formatted to print out the values of the Process Error Parameter
process_error$print(enable_cat_print = TRUE, ...)
enable_cat_printLogical flag to show target function's cli cat_print
messages to be seen on console.
...further arguments passed to or from other methods
read_inp_lines()
Reads in Process Error keyword parameter's values from AGEPRO Input file
process_error$read_inp_lines( inp_con, nline, proj_years, num_ages, num_fleets = 1 )
inp_conOpen file connection to AGEPRO Input File.
nline
Location of the current line number being read when the file connection to
the AGEPRO input file is open.
proj_yearsProjection years: Input can be Sequence of years in from first to last year of projection or the number of years in the time projection.
num_agesNumber of Age classes
num_fleetsNumber of Fleets. Default is 1
read_inp_lines_parameter_tables()
Helper function to set population or fishery process parameter
tables from AGEPRO input files. Reads in an additional line (or lines)
from the file connection to assign to the parameter_table
process_error$read_inp_lines_parameter_tables(inp_con, nline)
inp_conOpen file connection to AGEPRO Input File.
nline
Location of the current line number being read when the file connection to
the AGEPRO input file is open.
read_inp_lines_cv_table()
Internal helper function to set cv tables from
AGEPRO input files. Reads in an additional line (or lines) from the
file connection to assign to the cv_table
process_error$read_inp_lines_cv_table(inp_con, nline)
inp_conOpen file connection to AGEPRO Input File.
nline
Location of the current line number being read when the file connection to
the AGEPRO input file is open.
get_inp_lines()
Returns the values for the Process Error parameter formatted to the AGEPRO input file format.
process_error$get_inp_lines(delimiter = " ")
delimiterCharacter string delimiter separating values of AGEPRO input file line.
clone()
The objects of this class are cloneable with this method.
process_error$clone(deep = FALSE)
deepWhether to make a deep clone.
Generalized or common data structure for Standard (Harvest Table only), Rebuilding, and PStar projection analyses based AGEPRO Keyword parameters.
target_yearUser-Selected target year for rebuilder and pstar projection analyses
keyword_nameAGEPRO keyword parameter name
inp_keywordReturns AGEPRO input-file formatted Parameter
new()
Initializes class
projection_analyses$new(proj_years, target_year = NULL)
proj_yearsMay be a single numeric value: the number of years in the time projection; a vector of sequential values: Sequence of years in from first to last year of the time projection; or an instance of Projection years:
target_yearHarvest Scenario Target Year for Pstar or
Rebuild projections. The NULL default triggers the default to be
assigned to the last projection year from proj_years
clone()
The objects of this class are cloneable with this method.
projection_analyses$clone(deep = FALSE)
deepWhether to make a deep clone.
Projection Years
Projection Years
Handle the ambiguous use of "projection years" that can interpreted as a single int representing the count of projection years or a vector of sequential values representing a vector of "years" from first to last year of the AGEPRO model's time projection.
countThe count of projection_years
sequenceVector of years of time projection
new()
Initializes the class
projection_years$new(x)
xProjected year value or vector
print()
Prints out projection_years fields
projection_years$print()
clone()
The objects of this class are cloneable with this method.
projection_years$clone(deep = FALSE)
deepWhether to make a deep clone.
Input information for calculating Total Allowable Catch ()
to produce , which is the probability of overfishing in the target
projection year
Creating or importing pstar_projection object will overwrite the
any existing rebuild and pstar projection objects.
ageproR::projection_analyses -> pstar_projection
num_pstar_levelsNumber of pstar values to be evaluated
pstar_levels_tableThe vector of probabilities of overfishing or PStar values to be used
pstar_overfishing_fFishing mortality rate that defines the overfishing level
json_list_objectReturns JSON list object of PStar Projection values
new()
Initializes class
pstar_projection$new(proj_years, num_pstar_levels = 1, pstar_f = 0, ...)
proj_yearsMay be a single numeric value: the number of years in the time projection; a vector of sequential values: Sequence of years in from first to last year of the time projection; or an instance of Projection years
num_pstar_levelsNumber of Pstar levels. Default is 1
pstar_fFishing mortality rate . Default is 0.0
...Other parameters to pass to
projection_analyses
create_blank_pstar_levels_table()
Creates a blank table-like matrix of probabilities of overfishing, or PStar values, to be used.
pstar_projection$create_blank_pstar_levels_table(num_pstar_levels = 1)
num_pstar_levelsNumber of pstar values
read_inp_lines()
Reads in the values from the keyword parameter PSTAR from the AGEPRO Input file
pstar_projection$read_inp_lines(inp_con, nline)
inp_conOpen file connection to AGEPRO Input File.
nline
Location of the current line number being read when the file connection to
the AGEPRO input file is open.
get_inp_lines()
Returns PStar projection Values formatted as AGEPRO input file lines.
pstar_projection$get_inp_lines(delimiter = " ")
delimiterCharacter string delimiter separating values of AGEPRO input file line.
print()
Formatted to print out PStar values on Rconsole
pstar_projection$print(enable_cat_print = TRUE)
enable_cat_printLogical flag to show target function's cli cat_print
messages to be seen on console.
clone()
The objects of this class are cloneable with this method.
pstar_projection$clone(deep = FALSE)
deepWhether to make a deep clone.
Rebuilding projections is focused on the calculation of the constant
total fishing mortality calculated across all fleets that will rebuild the
population, denoted as .
Creating or importing rebuild_projection object will overwrite the
any existing rebuild and pstar projection objects.
ageproR::projection_analyses -> rebuild_projection
json_list_objectReturns JSON list object of rebuilder Projection values
target_biomass_valueRebuilding projection's target biomass value in units of thousands of metric tons (MT)
target_biomass_typeIndex for the type of population biomass as the target:
Spawning Stock Biomass
January 1st Stock Biomass
Mid-Year (Mean) Biomass
target_percentThe percent frequency of achieving the target value by the target year. The percent frequency is a value between 0 (a zero chance of achieving target) and 100 (indicating a 100 percent chance of achieving target).
new()
Initializes class
rebuild_projection$new( proj_years, target_biomass = 0, target_type = 0, target_percent = 0, ... )
proj_yearsMay be a single numeric value: the number of years in the time projection; a vector of sequential values: Sequence of years in from first to last year of the time projection; or an instance of Projection years
target_biomassTarget biomass value in units of thousands of metric tons (MT). Default set to 0.
target_typeTarget population biomass:
Spawning Stock Biomass. Set as Default
January 1st Stock Biomass
Mid-Year (Mean) Biomass
target_percentThe percent frequency that target_year reaches
target_biomass from 0 to 100. Default set to 0.
...Other parameters to pass to
projection_analyses
read_inp_lines()
Reads in the values from the keyword parameter REBUILD from the AGEPRO Input file
rebuild_projection$read_inp_lines(inp_con, nline)
inp_conOpen file connection to AGEPRO Input File.
nline
Location of the current line number being read when the file connection to
the AGEPRO input file is open.
get_inp_lines()
Returns rebuild projection Values formatted as AGEPRO input file lines.
rebuild_projection$get_inp_lines(delimiter)
delimiterCharacter string delimiter separating values of AGEPRO input file line.
print()
Prints out the rebuild projections fields to console
rebuild_projection$print(...)
...further arguments passed to or from other methods
clone()
The objects of this class are cloneable with this method.
rebuild_projection$clone(deep = FALSE)
deepWhether to make a deep clone.
Recruitment Model Description
model_numModel number
model_groupGroup type of Recruitment Model
model_nameName of Recruitment Model
projected_yearsTime Series of Projected Years
length_projected_yearsLength of projected_years counted as the the number of recruitment observations for some models.
new()
Creates a new instance of this class
recruit_model$new()
clone()
The objects of this class are cloneable with this method.
recruit_model$clone(deep = FALSE)
deepWhether to make a deep clone.
Recruitment is the primary stochastic element in the AGEPRO model (Brodziak, 2022). AGEPRO handles 21 Recruitment stochastic recruitment models for projections. Please refer to the AGEPRO reference Manual for more detail on these models.
recruit_scaling_factorThe multiplier to convert recruitment submodel's recruitment units to absolute numbers of fish
ssb_scaling_factorThe multiplier to convert recruitment submodel's SSB to absolute spawning weight of fish in kilograms (kg)
max_recruit_obsRecruitment submodel's maximum number of observations
recruit_model_num_listHelper Function To View Recruitment Model Collection Data
number_recruit_modelsReturns number of recruitment models
recruit_probabilityThe Recruitment Probabilities.
recruit_dataList containing data for each recruitment model in the recruitment model collection list. Use this field to access a specific recruitment models field.
json_list_objectList of RECRUIT keyword fields values, exportable to JSON.
keyword_nameAGEPRO keyword parameter name
inp_keywordReturns AGEPRO input-file formatted Parameter
valid_recruit_modelsReturns vector of valid Recruitment Model Numbers
new()
Initializes the Recruitment Class
recruitment$new( model_num, seq_years, num_recruit_models = 1, recruit_scaling_factor = 1000, ssb_scaling_factor = 1, max_recruit_obs = 10000, enable_cat_print = TRUE )
model_num
AGEPRO Recruitment Model Number
seq_years
Array representing the Projection Time Horizon
num_recruit_modelsNumber of Recruitment Models in AGEPRO model. Default is 1.
recruit_scaling_factorRecruit model's multiplier to convert units to absolute numbers of fish.
ssb_scaling_factorRecruit model's multiplier to convert SSB to absolute spawning weight of fish in kilograms (kg)
max_recruit_obsMax limit of recruitment observations. Default is 10000.
enable_cat_printFlag to print out cat based cli messages printed on console. Default
is TRUE.
print()
Prints out Recruitment
recruitment$print(enable_cat_print = TRUE, ...)
enable_cat_printFlag to allow cat based cli messages printed on
console. Default is TRUE
...further arguments passed to or from other methods
read_inp_lines()
Reads in Recruitment AGEPRO parameters from AGEPRO INP Input File
recruitment$read_inp_lines( inp_con, nline, seq_years = 1, num_recruit_models = 1 )
inp_conOpen file connection to AGEPRO Input File.
nline
Location of the current line number being read when the file connection to
the AGEPRO input file is open.
seq_years
Array representing the Projection Time Horizon
num_recruit_modelsNumber of Recruitment Models. Default is 1
get_inp_lines()
Returns the values for the RECRUIT keyword parameter formatted to the AGEPRO input file format.
recruitment$get_inp_lines(delimiter = " ")
delimiterCharacter string delimiter separating values of AGEPRO input file line.
clone()
The objects of this class are cloneable with this method.
recruitment$clone(deep = FALSE)
deepWhether to make a deep clone.
Class Structure that defines biomass thresholds for spawaning biomass
, mean biomass ,
and total stock biomass, including the threshold
rate for fishing mortality .
The logical flag enable_reference_points allows the user to
set values to this class fields. The flag will also notify agepro_model
if this keyword parameter is allowed to be written to input file.
If this class is initialized with default values, it is presumed that this
keyword parameter is not used in the agepro_model. Therefore,
enable_reference_points is flagged as FALSE. Valid non-default values will
set this flag to TRUE.
The reference_points class (REFPOINTS) is recognized as a keyword
parameter used in the AGEPRO input file format, but it is optional.
ssb_thresholdThreshold of spawning biomass
stock_biomass_thresholdThreshold of total stock biomass
mean_biomass_thresholdThreshold for mean biomass
fishing_mortality_thresholdThreshold for the fishing mortality rate for annual total fishing mortality calculated across all fleets.
json_list_objectReturns JSON list object of containing REFPOINT values
enable_reference_pointsLogical field that flags if fields can be edited. This class will not accept new values to its fields or allow it to be exported to input file until this option flag is TRUE.
keyword_nameAGEPRO keyword parameter name
inp_keywordReturns AGEPRO input-file formatted Parameter
new()
Initializes the class
reference_points$new( ssb_threshold = 0, stockbio_threshold = 0, meanbio_threshold = 0, fmort_threshold = 0, refpoint_flag = NULL )
ssb_thresholdSpawning Biomass threshold express in biomass output units (MT).
stockbio_thresholdStock biomass threshold expressed in biomass output units(MT).
meanbio_thresholdMean biomass threshold expressed in biomass output units (MT)
fmort_thresholdFishing mortality threshold
refpoint_flagR6class containing option flags to allow reference points to be used
print()
Formatted to print out reference_points values
reference_points$print()
read_inp_lines()
Reads in the values from the keyword parameter REFPOINT from the AGEPRO Input file
Note: enable_reference_points must be set to TRUE.
reference_points$read_inp_lines(inp_con, nline)
inp_conOpen file connection to AGEPRO Input File.
nline
Location of the current line number being read when the file connection to
the AGEPRO input file is open.
get_inp_lines()
Returns values from the class to the REFOPINTS AGEPRO keyword parameter formatted as AGEPRO input file lines.
reference_points$get_inp_lines(delimiter = " ")
delimiterCharacter string delimiter separating values of AGEPRO input file line.
clone()
The objects of this class are cloneable with this method.
reference_points$clone(deep = FALSE)
deepWhether to make a deep clone.
This is the vector of age-specific numbers at age multipliers for an initial population size at age vector if retrospective bias adjustment is applied.
The logical flag enable_retrospective_adjustments allows the user to
set values to this class fields. The flag will also notify agepro_model
if this keyword parameter is allowed to be written to input file.
If this class is initialized with default values, it is presumed that this
keyword parameter is not used in the agepro_model. Therefore,
enable_retrospective_adjustments is flagged as FALSE. Valid non-default
values will set this flag to TRUE.
The retrospective_adjustments class (RETROADJUST) is recognized as a keyword
parameter used in the AGEPRO input file format, but it is optional.
retro_adjustThis is the vector of age-specific numbers at age multipliers for an initial population size at age vector if retrospective bias adjustment is applied.
enable_retrospective_adjustmentsLogical field that flags if fields can be edited. This class will not accept new values to its fields or allow it to be exported to input file until this option flag is TRUE.
json_list_objectReturns JSON list object of containing SCALE values
keyword_nameAGEPRO keyword parameter name
inp_keywordReturns AGEPRO input-file formatted Parameter
new()
Initializes the class
retrospective_adjustments$new( retro_adjust, enable_cat_print = TRUE, retro_flag = NULL )
retro_adjustVector for retrospective bias adjustment
enable_cat_printLogical flag to show target function's cli cat_print
messages to be seen on console.
enable_cat_printLogical flag to show target function's cli cat_print
messages to be seen on console.
retro_flagR6class containing option flags to allow retrospective adjustments to be used
print()
Formatted to print out retrospective_adjustments values
retrospective_adjustments$print(enable_cat_print = TRUE, ...)
read_inp_lines()
Reads in the values from the keyword parameter RETROADJUST from the AGEPRO Input file
Note: enable_retrospective_adjustments must be set to TRUE.
retrospective_adjustments$read_inp_lines(inp_con, nline, num_ages)
inp_conOpen file connection to AGEPRO Input File.
nline
Location of the current line number being read when the file connection to
the AGEPRO input file is open.
num_agesModel's number of ages derived from general_params num_ages active binding.
get_inp_lines()
Returns values from the class to the RETROADJUST AGEPRO keyword parameter formatted as AGEPRO input file lines.
retrospective_adjustments$get_inp_lines(delimiter = " ")
delimiterCharacter string delimiter separating values of AGEPRO input file line.
clone()
The objects of this class are cloneable with this method.
retrospective_adjustments$clone(deep = FALSE)
deepWhether to make a deep clone.
Ricker Curve #/ Lognormal Error (Model #6)
Ricker Curve #/ Lognormal Error (Model #6)
ageproR::recruit_model -> ageproR::parametric_curve -> ricker_curve_model
new()
Initializes the Ricker Curve Model
ricker_curve_model$new(alpha = 0, beta = 0, variance = 0)
alpha
Stock Recruitment Parameter, alpha
beta
Stock Recruitment Parameter, beta
variance
variance
clone()
The objects of this class are cloneable with this method.
ricker_curve_model$clone(deep = FALSE)
deepWhether to make a deep clone.
Input information on scaling factors for biomass, recruitment, and stock size
The logical flag enable_scaling_factors allows the user to
set values to this class active binding fields: biomass_scale,
recruitment_scale, and stock_size_scale. The flag
will also notify agepro_model that this keyword parameter is allowed
to be written to input file.
If this class is initialized with default values, it is presumed that this
keyword parameter is not used in the agepro_model. Therefore,
enable_scaling_factors is flagged as FALSE. Valid non-default values will
set this flag to TRUE.
The scaling_factors class (or SCALE) is recognized as a keyword parameter used in the AGEPRO input file format, but it is optional.
biomass_scaleOutput units of biomass expressed in thousand metric tons
recruitment_scaleOutput units of recruitment numbers
stock_size_scaleOutput Units of stock size numbers
enable_scaling_factorsLogical field that flags if fields can be edited. This class will not accept new values to its fields or allow it to be exported to input file until this option flag is TRUE.
json_list_objectReturns JSON list object of containing SCALE values
keyword_nameAGEPRO keyword parameter name
inp_keywordReturns AGEPRO input-file formatted Parameter
new()
Initializes the class
scaling_factors$new( scale_bio = 0, scale_recruit = 0, scale_stock_size = 0, scale_flag = NULL )
scale_bioOutput units of biomass express in thousand metric units
scale_recruitOutput Units of Recruitment Numbers
scale_stock_sizeOutput Units of Stock Size Numbers
scale_flagR6class containing option flags to allow scaling factors to be used
print()
Formatted to print out scaling_factors values
scaling_factors$print()
read_inp_lines()
Reads in the values from the keyword parameter SCALE from the AGEPRO Input file
Note: enable_scaling_factors must be set to TRUE.
scaling_factors$read_inp_lines(inp_con, nline)
inp_conOpen file connection to AGEPRO Input File.
nline
Location of the current line number being read when the file connection to
the AGEPRO input file is open.
get_inp_lines()
Returns values from the class to the SCALE AGEPRO keyword parameter formatted as AGEPRO input file lines.
scaling_factors$get_inp_lines(delimiter = " ")
delimiterCharacter string delimiter separating values of AGEPRO input file line.
clone()
The objects of this class are cloneable with this method.
scaling_factors$clone(deep = FALSE)
deepWhether to make a deep clone.
Shepherd Curve with Lognormal Error (Model #7)
Shepherd Curve with Lognormal Error (Model #7)
ageproR::recruit_model -> ageproR::parametric_curve -> shepherd_curve_model
kpar
Sets the Parametric Curve Parameter, k. Returns the
current value if no argument was passed
json_recruit_dataReturns JSON-ready Recruit Model Data
new()
Initializes the Shepherd Curve Model
shepherd_curve_model$new(alpha = 0.1, beta = 0.1, kpar = 0.1, variance = 0.1)
alpha
Stock Recruitment Parameter, alpha
beta
Stock Recruitment Parameter, beta
kparkpar
variance
variance
print()
Prints out Parametric Curve Data
shepherd_curve_model$print(...)
...further arguments passed to or from other methods
read_inp_lines()
Reads Parametric Curve model data from AGEPRO Input file
shepherd_curve_model$read_inp_lines(inp_con, nline)
inp_conOpen file connection to AGEPRO Input File.
nline
Location of the current line number being read when the file connection to
the AGEPRO input file is open.
inp_lines_recruit_data()
Exports RECRUIT submodel data for shepherd curve recruitment to AGEPRO input file lines.
shepherd_curve_model$inp_lines_recruit_data(delimiter = " ")
delimiterCharacter string delimiter separating values of AGEPRO input file line.
clone()
The objects of this class are cloneable with this method.
shepherd_curve_model$clone(deep = FALSE)
deepWhether to make a deep clone.
AGEPRO keyword parameter class Structure for this population process with multiplicative lognormal error distribution.
ageproR::process_error -> spawning_stock_weight_age
new()
Initializes class
spawning_stock_weight_age$new( proj_years, num_ages, input_option = 0, time_varying = TRUE, enable_cat_print = TRUE )
proj_yearsProjection years: Input can be Sequence of years in from first to last year of projection or the number of years in the time projection.
num_agesNumber of Age classes
input_optionOption to indicate this parameter will be:
0 By default, done interactively via interface.
1 Imported via location of an existing data file.
time_varyingLogical flag that enables the stochastic parameter to use as a time-varying array if TRUE (or 1). Otherwise, FALSE the vector will cover "all years" of the projection. Default is TRUE.
enable_cat_printLogical flag to show target function's cli cat_print
messages to be seen on console.
clone()
The objects of this class are cloneable with this method.
spawning_stock_weight_age$clone(deep = FALSE)
deepWhether to make a deep clone.
Class Structure containing Standard Projection Analyses
ageproR::projection_analyses -> standard_projection
new()
Initializes class
standard_projection$new(proj_years)
proj_yearsMay be a single numeric value: the number of years in the time projection; a vector of sequential values: Sequence of years in from first to last year of the time projection; or an instance of Projection years
clone()
The objects of this class are cloneable with this method.
standard_projection$clone(deep = FALSE)
deepWhether to make a deep clone.
Two-Stage Empirical Cumulative Distribution Function of Recruitment (Recruit #15)
Two-Stage Empirical Cumulative Distribution Function of Recruitment (Recruit #15)
ageproR::recruit_model -> ageproR::empirical_recruit -> ageproR::two_stage_empirical_recruit -> two_stage_empirical_cdf
json_recruit_datagets JSON-ready Recruit Model Data
ageproR::empirical_recruit$new_obs_table()ageproR::empirical_recruit$print_json()ageproR::empirical_recruit$set_obs_table_from_df()ageproR::two_stage_empirical_recruit$inp_lines_recruit_data()ageproR::two_stage_empirical_recruit$new_recruitment_matrix()ageproR::two_stage_empirical_recruit$print()ageproR::two_stage_empirical_recruit$read_inp_lines()new()
Initialize the Empirical CDF Model
two_stage_empirical_cdf$new(low_recruits = 2, high_recruits = 2)
low_recruits
The number of low recruits per spawning stock biomass data points.
high_recruits
The number of high recruits per spawning stock biomass data points.
clone()
The objects of this class are cloneable with this method.
two_stage_empirical_cdf$clone(deep = FALSE)
deepWhether to make a deep clone.
Two-Stage Empirical Recruitment Base
Two-Stage Empirical Recruitment Base
ageproR::recruit_model -> ageproR::empirical_recruit -> two_stage_empirical_recruit
num_low_recruitsNumber of Low State Recruitments
num_high_recruitsNumber of high State Recruitments
ssb_cutoffCutoff level of spawning Biomass
low_recruitmentVector of Low State Recruitments per Spawning Biomass
high_recruitmentVector of High State Recruitments per Spawning Biomass
json_recruit_datagets JSON-ready Recruit Model Data
new()
Initialize the Empirical CDF Model
two_stage_empirical_recruit$new( low_recruits = 1, high_recruits = 1, with_ssb = FALSE )
low_recruits
The number of low recruits per spawning stock biomass data points.
high_recruits
The number of high recruits per spawning stock biomass data points.
with_ssbflag to include Spawning Stock Biomass in Observations
new_recruitment_matrix()
Creates a recruitment matrix
two_stage_empirical_recruit$new_recruitment_matrix(recruit_points)
recruit_pointsNumber of Empirical Observation Records
read_inp_lines()
Reads the two State Empirical model data from AGEPRO Input file
two_stage_empirical_recruit$read_inp_lines(inp_con, nline)
inp_conOpen file connection to AGEPRO Input File.
nline
Location of the current line number being read when the file connection to
the AGEPRO input file is open.
inp_lines_recruit_data()
Exports RECRUIT submodel data for two-stage empirical recruitment types to AGEPRO input file lines.
two_stage_empirical_recruit$inp_lines_recruit_data(delimiter = " ")
delimiterCharacter string delimiter separating values of AGEPRO input file line.
print()
Prints out Recruitment Model
two_stage_empirical_recruit$print(...)
...further arguments passed to or from other methods
clone()
The objects of this class are cloneable with this method.
two_stage_empirical_recruit$clone(deep = FALSE)
deepWhether to make a deep clone.
Two-Stage Empirical Recruits Per Spawning Biomass Distribution (Model #4)
Two-Stage Empirical Recruits Per Spawning Biomass Distribution (Model #4)
ageproR::recruit_model -> ageproR::empirical_recruit -> ageproR::two_stage_empirical_recruit -> two_stage_empirical_ssb
json_recruit_datagets JSON-ready Recruit Model Data
ageproR::empirical_recruit$new_obs_table()ageproR::empirical_recruit$print_json()ageproR::empirical_recruit$set_obs_table_from_df()ageproR::two_stage_empirical_recruit$inp_lines_recruit_data()ageproR::two_stage_empirical_recruit$new_recruitment_matrix()ageproR::two_stage_empirical_recruit$print()ageproR::two_stage_empirical_recruit$read_inp_lines()new()
Initialize the Empirical CDF Model
two_stage_empirical_ssb$new(low_recruits = 2, high_recruits = 2)
low_recruits
The number of low recruits per spawning stock biomass data points.
high_recruits
The number of high recruits per spawning stock biomass data points.
clone()
The objects of this class are cloneable with this method.
two_stage_empirical_ssb$clone(deep = FALSE)
deepWhether to make a deep clone.
Custom mapping function used for error handling. This is based on the rlang topic errors guide.
validate_map(.xs, .fn, ...)validate_map(.xs, .fn, ...)
.xs |
List r Atomic Vector |
.fn |
Function |
... |
further arguments passed to or from other methods |
If proj_years parameter is a
projection_years class, then it will return
that value. Otherwise, it will create a new projection_years class based
on the param value passed.
validate_proj_years_parameter(proj_years)validate_proj_years_parameter(proj_years)
proj_years |
Projection year parameter. May be a numeric vector or a
|