plot_hist: Plot historical dynamics of the operating model. See details...

plot_histR Documentation

Plot historical dynamics of the operating model. See details below.

Description

Various plots for plotting historical time series for the operating model.

Usage

hist_bio(x, figure = TRUE)

hist_future_recruit(x, figure = TRUE)

hist_bio_schedule(
  x,
  var = c("Len_age", "Wt_age", "Mat_age", "M_ageArray"),
  n_age_plot,
  yr_plot,
  sim,
  figure = TRUE
)

hist_bio_change(
  x,
  var = c("Wt_age", "M_ageArray"),
  change_mean = 0,
  change_slope = 0,
  n_age_plot = 10,
  sim = 1,
  figure = TRUE
)

hist_growth_I(x)

hist_growth_II(x)

hist_spatial(x, type = c("par", "matrix", "all"), ...)

hist_sel(x, yr, maturity = TRUE, figure = TRUE)

hist_YieldCurve(x, yr_bio, yr_sel, F_range, figure = TRUE, sims)

hist_resample_recruitment(
  x,
  dist = c("Lognormal", "Pareto"),
  mu = 1,
  LnSD = 0.7,
  LnAC = 0,
  Pshape = 1.1,
  figure = TRUE,
  nsim_plot = 5
)

hist_SRR_change(x, SR_new = 1, h_mult = 1, y_fit, figure = TRUE, sims = 1:25)

hist_phi0(x, figure = TRUE)

hist_per_recruit(x, yr_bio, yr_sel, F_range, figure = TRUE, sims)

Arguments

x

An object of class Hist, or a shiny reactivevalues object containing a slot named MSEhist which is the Hist object.

figure

Logical, whether to return a figure (TRUE) or the updated array (FALSE) for hist_bio_change.

var

A string to indicate which object to plot from OM@cpars.

n_age_plot

The number of ages to plot in the left figure.

yr_plot

The year (relative to OM@CurrentYr) to plot for the right figure.

sim

The individual simulation to plot for the left figure.

change_mean

The percent change in the mean of the new parameters relative to the old.

change_slope

The percent change year-over-year in the projection parameters relative to the last projection year.

type

Type of spatial plot

...

arguments to plot_mov

yr

A length-2 vector for the years (relative to OM@CurrentYr) to plot selectivity.

maturity

Logical, whether to plot maturity along with selectivity.

yr_bio

The year (relative to OM@CurrentYr) for the biological parameters (growth, M, maturity).

yr_sel

The year (relative to OM@CurrentYr) for the selectivity parameters.

F_range

Length two vector for the range of F to plot the yield curve. By default, c(1e-8, 3 * max(M)).

sims

A subset of simulations for plotting. Some functions have a low limit by default, i.e. 25, to reduce time to generate plots). Set to NULL to plot all simulations.

dist

Character to denote to sample either from a lognormal distribution or Pareto distribution.

mu

The mean of the distribution (default = 1).

LnSD

If Lognormal, the standard deviation.

LnAC

If Lognormal, the autocorrelation (in log-space).

Pshape

If Pareto, the shape parameter. See Pareto. The location parameter is calculated such that the mean = 1.

nsim_plot

The number of simulations to plot if figure is TRUE.

SR_new

A new stock-recruit relationship (1 = Beverton-Holt, 2 = Ricker)

h_mult

Scalar for the new steepness value (a multiple of the old steepness parameter).

y_fit

Length two vector for the range of years of SSB and recruit pairs used to fit the SR function.

Details

hist_bio returns time series of spawning biomass (SBiomass), total biomass (Biomass), abundance (Number), recruitment (Rec), and recruitment deviates (RecDev).

hist_future_recruit returns historical and future recruitment deviations.

hist_bio_schedule plots in biological at age parameters. The corresponding array is indexed by simulation, age, and year.

hist_bio_change plots alternative projection dynamics by changing either the mean or slope. Returns an updated array of parameters.

hist_growth_I plots histograms of von Bertalanffy parameters.

hist_growth_II plots histograms of von Bertalanffy parameters by year.

hist_spatial plots histograms of the parameters for spatial movement in a two-area model (set all to 0.5 to functionally create a single area model).

hist_sel plots selectivity/retention at age for two different years in the OM. Returns an array indexed by simulation, age, year.

hist_YieldCurve plots the yield curve as a function of F, SPR (spawning potential ratio), spawning biomass (SBiomass), and spawning depletion (SB_SB0). Matrices are indexed by simulation (rows) and F (columns).

hist_resample_recruit generates new recruitment deviations (with mean = 1) for the projection period. Returns a list with an updated matrix for OM@cpars$Perr_y.

hist_SRR_change re-fits stock recruit function and generates a list with new stock-recruitment parameters OM@SRrel, OM@cpars$R0, OM@cpars$hs, and historical recruitment deviations OM@cpars$Perr_y.

hist_phi0 returns a list containing a matrix (by simulation and year) of unfished spawning biomass per recruit (phi0).

hist_per_recruit returns a list containing a matrix (by simulation and F) of yield per recruit (YPR) and spawning potential ratio (SPR).

Value

Various plots using base graphics. Returns invisibly a named list, where each entry is usually a matrix with rows indexing simulation and columns indexing year.

Author(s)

Q. Huynh

Examples

library(MSEtool)
Hist <- MSEtool::runMSE(Hist = TRUE, silent = TRUE)
bio <- hist_bio(Hist)
bio$SBiomass

# Example of backend use of `hist_SRR_change`
OM <- SubCpars(RPC::DFO_4X5Y_Haddock_2015, 1:2)
Hist <- runMSE(OM, Hist = TRUE)
vars <- hist_SRR_change(Hist, h_mult = 0.6) # Steepness is sixty percent of whatever is in the OM

OM@cpars$R0 <- vars$R0
OM@cpars$hs <- vars$h
OM@SRrel <- vars$SRrel
OM@cpars$Perr_y <- Hist@SampPars$Stock$Perr_y
OM@cpars$Perr_y[, 1:(OM@maxage + OM@nyears)] <- vars$Perr_y
Hist_new <- runMSE(OM, Hist = TRUE)

Blue-Matter/RPC documentation built on Feb. 3, 2025, 11:20 a.m.