| Stock | R Documentation |
A stock object has life history parameters, fields and methods for a biomass dynamic model.
A stock has biomass, effort, catch and hcr_ip and hcr_op fields as well as the life history parameters. The population dynamics are a simple biomass dynamic model. The Stock class is used for the Shiny apps in the AMPLE package.
biomassArray of biomass
catchArray of catches
effortArray of fishing effort
hcr_ipArray of HCR input signals
hcr_opArray of HCR output signals
msyMSY (default = 100).
rGrowth rate (default = 0.6). Set by the user in the app.
kCarrying capacity (default = NULL - set by msy and r when object is initialised).
pShape of the production curve (default = 1).
qCatchability (default = 1).
lrpLimit reference point, expressed as depletion (default = 0.2).
trpTarget reference point, expressed as depletion (default = 0.5).
b0Virgin biomass (default = NULL - set by msy and r when object is initialised).
current_corrnoiseStores the current values of the correlated noise (by iteration).
biol_sigmaStandard deviation of biological variability (default = 0).
last_historical_timestepThe last historical timestep of catch and effort data.
new()Create a new stock object, with fields of the right dimension and NA values (by calling the reset() method.
See the reset() method for more details.
Stock$new(stock_params, mp_params, niters = 1)
stock_paramsA list of stock parameters with essential elements: r (growth rate, numeric), stock_history (string: "fully", "over", "under") initial_year (integer), last_historical_timestep (integer), nyears (integer), biol_sigma (numeric).
mp_paramsA list of the MP parameters. Used to fill HCR ip and op.
nitersThe number of iters in the stock (default = 1).
A new Stock object.
reset()Resets an existing stock object, by remaking all fields (possibly with different dimensions for the array fields) .
Fills up the catch, effort and biomass fields in the historical period based on the stock history and
life history parameters in the stock_params argument.
This is a reactive method which invalidates a reactive instance of this class after it is called.
Stock$reset(stock_params, mp_params, niters)
stock_paramsA list with essential elements: r (growth rate, numeric, default=6), stock_history (string: "fully", "over", "under", default="fully") initial_year (integer, default=2000), last_historical_timestep (integer, default=10), nyears (integer, default=30), biol_sigma (numeric, default = 0).
mp_paramsA list of the MP parameters. Used to fill HCR ip and op.
nitersThe number of iters in the stock (default = 1).
A new Stock object.
reactive()Method to create a reactive instance of a Stock.
Stock$reactive()
a reactiveExpr.
fill_history()Fills the historical period of the stock
Stock$fill_history(stock_params, mp_params)
stock_paramsNamed list with last_historical_timestep and stock_history elements.
mp_paramsA list of the MP parameters. Used to fill HCR ip and op.
fill_catch_history()Fill up the historical period of catches with random values to simulate a catch history
Stock$fill_catch_history(stock_params)
stock_paramsA list with essential elements: r (growth rate, numeric), stock_history (string: "fully", "over", "under") initial_year (integer), last_historical_timestep (integer), nyears (integer).
stock_historyCharacter string of the exploitation history (default = "fully", alternatives are "under" or "over").
fill_biomass()Fills the biomass in the next timestep based on current biomass and catches
The surplus production model has the general form:
Bt+1 = Bt + f(Bt) - Ct
Where the production function f() is a Pella & Tomlinson model with shape
f(Bt) = r/p Bt * (1 - (Bt/k)^p)
Here p is fixed at 1 to give a Schaefer model
cpue = Ct / Et = qBt
Stock$fill_biomass(ts, iters = 1:dim(self$biomass)[1])
tsThe biomass time step to be filled (required catch etc in ts - 1).
itersThe iterations to calculate the biomass for (optional - default is all of them).
as_data_frame()Produces a data.frame of some of the array-based fields, like biomass. Just used for testing purposes.
Stock$as_data_frame()
project()Projects the stock over the time steps given and updates the biomass, HCR ip / op and catches It uses a simple biomass dynamic model where the catches or fishing effort are set every time step by the harvest control rule.
Stock$project(timesteps, mp_params, iters = 1:dim(self$biomass)[1])
timestepsThe timesteps to project over. A vector of length 2 (start and end).
mp_paramsA vector of management procedure parameters.
itersA vector of iterations to be projected. Default is all the iterations in the stock
A stock object (a reactiveValues object with bits for the stock)
relative_cpue()The catch per unit effort (CPUE, or catch rate) relative to the CPUE in the last historical period.
Stock$relative_cpue()
An array of same dims as the catch and effort fields.
relative_effort()The effort relative to the effort in the last historical period.
Stock$relative_effort()
An array of same dims as the effort field.
replicate_table()Summarises the final year of each iteration. Only used for the Measuring Performance app.
Stock$replicate_table(iters = 1, quantiles = c(0.05, 0.95))
itersThe iterations to calculate the table values for (default is iteration 1).
quantilesNumeric vector of the quantile range. Default values are 0.05 and 0.95.
time_periods()Calculates the short, medium and long term periods to calculate the performance indicators over, based on the last historic year of data and the number of years in the projection.
Stock$time_periods()
performance_indicators()Gets the performance indicators across all indicators, for three time periods. Used in the Measuring Performance and Comparing Performance apps.
Stock$performance_indicators( iters = 1:dim(self$biomass)[1], quantiles = c(0.05, 0.95) )
itersThe iterations to calculate the table values for (default is all of them).
quantilesNumeric vector of the quantile range. Default values are 0.05 and 0.95.
A data.frame
pi_table()Makes a table of the performance indicators.
Stock$pi_table(iters = 1:dim(self$biomass)[1], quantiles = c(0.05, 0.95))
itersThe iterations to calculate the table values for (default is all of them).
quantilesNumeric vector, length 2, of the low and high quantiles.
clone()The objects of this class are cloneable with this method.
Stock$clone(deep = FALSE)
deepWhether to make a deep clone.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.