| Title: | Graphics and diagnostics tools for SPRFMO's Joint Jack Mackerel model |
|---|---|
| Description: | Graphics and diagnostics tools for SPRFMO's Joint Jack Mackerel model. |
| Authors: | Ricardo Oliveros-Ramos [cre, aut], Wencheng Lau-Medrano [aut], Giancarlo Moron [aut], Josymar Torrejon-Magallanes [aut], Niels Hintzen [aut], Enrique Ramos-Vasquez [ctb], Jim Ianelli [aut] |
| Maintainer: | Ricardo Oliveros-Ramos <[email protected]> |
| License: | GPL-2 |
| Version: | 1.2020.1 |
| Built: | 2026-10-11 10:41:45 UTC |
| Source: | https://github.com/SPRFMO/jjmr |
Construct a jjm.config object from data and control lists.
.getJjmConfig(data, control, ...).getJjmConfig(data, control, ...)
data |
List of raw data elements for the JJM model. |
control |
List of control parameters, including |
... |
Unused. |
An object of class jjm.config.
Helpers for building benchmark annex diagnostic figures from JJM model outputs, including input metadata, composition fits, index diagnostics, retrospective plots, selectivity, stock status, stock-recruitment, Kobe plots, and historical retrospectives.
jjm_label(nm, stock_name = NULL) jjm_pfa_palette(type = c("pfa", "fleet", "survey", "peel")) extr_catch(mod, stock = 1) extr_wtat_fsh(mod, stock = 1) extr_wtat_srv(mod, stock = 1) extr_agefits_fsh(mod, stock = 1) extr_lenfits_fsh(mod, stock = 1) extr_agefits_srv(mod, stock = 1) extr_indices(mod, stock = 1) extr_meanage_fsh(mod, stock = 1) extr_meanage_srv(mod, stock = 1) extr_meanlen_fsh(mod, stock = 1) extr_effn(mod, stock = 1) extr_catch_cv(mod, stock = 1) extr_fished_unfished(mod, stock = 1) extr_retro(retro, var = "SSB", stock = 1) extr_q_breaks(mod) extr_cv(mod, stock = 1) extr_sel_fsh(mod, stock = 1) extr_sel_srv(mod, stock = 1) extr_sel_breaks(mod, type = c("fsh", "srv")) extr_sr(mod, stock = 1) extr_kobe(mod, stock = 1) extr_francis(agefits, effn_df, grp_var = "fleet") extr_q_trajectory(mod, stock = 1) extr_survey_skill(mod, stock = 1) has_comp(df, grp_var = NULL, grp_filter = NULL) comp_fig_height(df, grp_var = NULL, grp_filter = NULL, ncol = 5, panel_h = 2.2, row2_h = 2.5, row3_h = 2.2) facet_fig_height(n_panels, ncol = 2, panel_h = 3.5, min_h = 4) plot_catch_fleet(mod, stock = 1, title = NULL) calc_mohn_rho(df, n_peel = 5) plot_retro(retro, var = "SSB", stock = 1, title = NULL) plot_wtat(df, facet_var, title = NULL, years = NULL) plot_wtat_cohort(df, facet_var, title = NULL, years = NULL) plot_comp_fits(df, x_var, grp_var, grp_filter = NULL, x_lab = "Age", title = NULL) plot_indices_v2(mod, stock = 1, title = NULL) plot_comp_ridge(df, x_var = "age", facet_var = "fleet", x_lab = "Age", title = NULL) plot_sel_ridge(df, facet_var, title = NULL, breaks_df = NULL) plot_fit_diagnostics(df, title = NULL) plot_effn(mod, stock = 1, title = NULL) plot_meanstat(df, facet_var, y_lab = "Mean age (years)", title = NULL) plot_fished_unfished(mod, stock = 1, title = NULL) plot_summary_sheet(mod, stock = 1, title = NULL) plot_sr(mod, stock = 1, title = NULL) plot_kobe(mod, stock = 1, title = NULL) strong_cohorts(mod, stock = 1, n = 3) annotate_cohorts(years, colour = PFA_GREEN, label_size = 3) plot_francis(mod, stock = 1, title = NULL) plot_q_trajectory(mod, stock = 1, title = NULL) plot_survey_skill(mod, stock = 1, title = NULL) plot_metadata_overview(mod, title = NULL) read_historic_retro(file, exclude_assessment_types = c("benchmark", "mod1.4")) plot_historic_retro(data, quantity = c("stock", "reference"), title = NULL)jjm_label(nm, stock_name = NULL) jjm_pfa_palette(type = c("pfa", "fleet", "survey", "peel")) extr_catch(mod, stock = 1) extr_wtat_fsh(mod, stock = 1) extr_wtat_srv(mod, stock = 1) extr_agefits_fsh(mod, stock = 1) extr_lenfits_fsh(mod, stock = 1) extr_agefits_srv(mod, stock = 1) extr_indices(mod, stock = 1) extr_meanage_fsh(mod, stock = 1) extr_meanage_srv(mod, stock = 1) extr_meanlen_fsh(mod, stock = 1) extr_effn(mod, stock = 1) extr_catch_cv(mod, stock = 1) extr_fished_unfished(mod, stock = 1) extr_retro(retro, var = "SSB", stock = 1) extr_q_breaks(mod) extr_cv(mod, stock = 1) extr_sel_fsh(mod, stock = 1) extr_sel_srv(mod, stock = 1) extr_sel_breaks(mod, type = c("fsh", "srv")) extr_sr(mod, stock = 1) extr_kobe(mod, stock = 1) extr_francis(agefits, effn_df, grp_var = "fleet") extr_q_trajectory(mod, stock = 1) extr_survey_skill(mod, stock = 1) has_comp(df, grp_var = NULL, grp_filter = NULL) comp_fig_height(df, grp_var = NULL, grp_filter = NULL, ncol = 5, panel_h = 2.2, row2_h = 2.5, row3_h = 2.2) facet_fig_height(n_panels, ncol = 2, panel_h = 3.5, min_h = 4) plot_catch_fleet(mod, stock = 1, title = NULL) calc_mohn_rho(df, n_peel = 5) plot_retro(retro, var = "SSB", stock = 1, title = NULL) plot_wtat(df, facet_var, title = NULL, years = NULL) plot_wtat_cohort(df, facet_var, title = NULL, years = NULL) plot_comp_fits(df, x_var, grp_var, grp_filter = NULL, x_lab = "Age", title = NULL) plot_indices_v2(mod, stock = 1, title = NULL) plot_comp_ridge(df, x_var = "age", facet_var = "fleet", x_lab = "Age", title = NULL) plot_sel_ridge(df, facet_var, title = NULL, breaks_df = NULL) plot_fit_diagnostics(df, title = NULL) plot_effn(mod, stock = 1, title = NULL) plot_meanstat(df, facet_var, y_lab = "Mean age (years)", title = NULL) plot_fished_unfished(mod, stock = 1, title = NULL) plot_summary_sheet(mod, stock = 1, title = NULL) plot_sr(mod, stock = 1, title = NULL) plot_kobe(mod, stock = 1, title = NULL) strong_cohorts(mod, stock = 1, n = 3) annotate_cohorts(years, colour = PFA_GREEN, label_size = 3) plot_francis(mod, stock = 1, title = NULL) plot_q_trajectory(mod, stock = 1, title = NULL) plot_survey_skill(mod, stock = 1, title = NULL) plot_metadata_overview(mod, title = NULL) read_historic_retro(file, exclude_assessment_types = c("benchmark", "mod1.4")) plot_historic_retro(data, quantity = c("stock", "reference"), title = NULL)
mod |
A |
stock |
Stock index. |
retro |
A retrospective object loaded from a JJM retrospective RData file. |
df, agefits, effn_df, data
|
Data frames or tibbles returned by the corresponding extractor functions. |
title |
Optional plot title. |
var |
Retrospective variable, such as |
type, quantity
|
Character option selecting a palette, selectivity type, or historical retrospective plot group. |
grp_var |
Grouping variable name. |
grp_filter |
Optional group value to filter. |
ncol |
Number of panels per row. |
panel_h |
Height per panel row. |
row2_h |
Height for the bubble residual row. |
row3_h |
Height for the marginal residual row. |
n_panels |
Number of panels. |
min_h |
Minimum figure height. |
n_peel |
Number of retrospective peels to include. |
facet_var |
Facet variable name. |
x_var |
X variable name. |
x_lab |
X-axis label. |
breaks_df |
Optional selectivity break-year data. |
y_lab |
Y-axis label. |
n |
Number of cohort years to return. |
colour |
Annotation colour. |
label_size |
Annotation label size. |
exclude_assessment_types |
Assessment types to remove before plotting historical retrospectives. |
nm, stock_name
|
Model name and optional stock label used to construct a display label. |
file |
Path to a historical retrospective CSV file. |
years |
Years to annotate or plot. |
Extractor functions return tibbles or lists. Plot functions return ggplot2 or patchwork objects.
## Not run: mod <- readJJM("h1_1.14", path = "assessment/config", input = "assessment/input", output = "assessment/results") plot_metadata_overview(mod) plot_catch_fleet(mod, title = jjm_label("h1_1.14")) plot_indices_v2(mod) ## End(Not run)## Not run: mod <- readJJM("h1_1.14", path = "assessment/config", input = "assessment/input", output = "assessment/results") plot_metadata_overview(mod) plot_catch_fleet(mod, title = jjm_label("h1_1.14")) plot_indices_v2(mod) ## End(Not run)
Annotate strong cohort years on a ggplot
annotate_cohorts(years, colour = PFA_GREEN, label_size = 3)annotate_cohorts(years, colour = PFA_GREEN, label_size = 3)
years |
Cohort years. |
colour |
Annotation colour. |
label_size |
Text size. |
A list of ggplot layers.
Calculate Mohn's rho
calc_mohn_rho(df, n_peel = 5)calc_mohn_rho(df, n_peel = 5)
df |
Retrospective tibble from [extr_retro()]. |
n_peel |
Number of peels to include. |
Numeric Mohn's rho.
This function internally replaces the name of a JJM output object with a user-specified string. Mostly useful for plots.
changeNameModel(modList, nameVector)changeNameModel(modList, nameVector)
modList |
A list of JJM model output objects. |
nameVector |
Character vector of replacement model names. |
## Not run: recmods <- compareModels(c("mod1.00.hl","mod1.00.ll","mod1.00.hs","mod1.00.ls")) changeNameModel(recmods,c( "h=0.8, full series","h=0.8, short series","h=0.65, full series","h=0.65, short series" )) ## End(Not run)## Not run: recmods <- compareModels(c("mod1.00.hl","mod1.00.ll","mod1.00.hs","mod1.00.ls")) changeNameModel(recmods,c( "h=0.8, full series","h=0.8, short series","h=0.65, full series","h=0.65, short series" )) ## End(Not run)
Coerce a vector to character or numeric
coerce(x, to = c("chr", "num", "num_chr"))coerce(x, to = c("chr", "num", "num_chr"))
x |
Vector to coerce |
to |
One of "chr", "num", "num_chr" |
This function takes model objects (class outputs) of JJM and generate an object
with combined models.
combineModels(...)combineModels(...)
... |
One or more output objects, to be combined to list of models. |
## Not run: mod1 <- runJJM(modelName = "mod2.1") mod2 <- runJJM(modelName = "mod2.2") mod3 <- runJJM(modelName = "mod2.3") mod_123 = combineModels(mod1, mod2, mod3) ## End(Not run)## Not run: mod1 <- runJJM(modelName = "mod2.1") mod2 <- runJJM(modelName = "mod2.2") mod3 <- runJJM(modelName = "mod2.3") mod_123 = combineModels(mod1, mod2, mod3) ## End(Not run)
Calculate figure height for composition fits
comp_fig_height( df, grp_var = NULL, grp_filter = NULL, ncol = 5, panel_h = 2.2, row2_h = 2.5, row3_h = 2.2 )comp_fig_height( df, grp_var = NULL, grp_filter = NULL, ncol = 5, panel_h = 2.2, row2_h = 2.5, row3_h = 2.2 )
df |
Composition fit tibble. |
grp_var |
Optional grouping variable name. |
grp_filter |
Optional group value to filter. |
ncol |
Number of panels per row. |
panel_h |
Height per row of year panels. |
row2_h |
Height for the bubble residual row. |
row3_h |
Height for the marginal residual row. |
Numeric figure height.
This function takes a vector of model names, reads in the JJM runs, and combines them.
Basically a wrapper function for combineModels.
Assumes model runs are in the same folder.
compareModels(mods)compareModels(mods)
mods |
Character vector of model names to compare. |
## Not run: mod_123 = compareModels(c("h1_0.00", "h1_0.01", "h1_0.02") ## End(Not run)## Not run: mod_123 = compareModels(c("h1_0.00", "h1_0.01", "h1_0.02") ## End(Not run)
Function to generate plots from results of readJJM function
diagnostics(object, ...)diagnostics(object, ...)
object |
Object ob class outputs. |
... |
Extra arguments |
## Not run: model = readJJM(modelName = "mod2.4") diagnostics(object = model) ## End(Not run)## Not run: model = readJJM(modelName = "mod2.4") diagnostics(object = model) ## End(Not run)
Extract fishery age-composition fits
extr_agefits_fsh(mod, stock = 1)extr_agefits_fsh(mod, stock = 1)
mod |
A 'jjm.output' object from [readJJM()]. |
stock |
Stock index. |
A tibble with observed and predicted fishery age compositions.
Extract survey age-composition fits
extr_agefits_srv(mod, stock = 1)extr_agefits_srv(mod, stock = 1)
mod |
A 'jjm.output' object from [readJJM()]. |
stock |
Stock index. |
A tibble with observed and predicted survey age compositions.
Extract observed catch by fleet
extr_catch(mod, stock = 1)extr_catch(mod, stock = 1)
mod |
A 'jjm.output' object from [readJJM()]. |
stock |
Stock index. |
A tibble with 'year', 'catch', and 'fleet'.
Extract catch observation CVs
extr_catch_cv(mod, stock = 1)extr_catch_cv(mod, stock = 1)
mod |
A 'jjm.output' object from [readJJM()]. |
stock |
Stock index. |
A tibble with catch CVs by fleet and year.
Extract index CVs
extr_cv(mod, stock = 1)extr_cv(mod, stock = 1)
mod |
A 'jjm.output' object from [readJJM()]. |
stock |
Stock index. |
A tibble with survey index CVs.
Extract input composition sample sizes
extr_effn(mod, stock = 1)extr_effn(mod, stock = 1)
mod |
A 'jjm.output' object from [readJJM()]. |
stock |
Stock index. |
A tibble with composition input sample sizes.
Extract fished and unfished total biomass
extr_fished_unfished(mod, stock = 1)extr_fished_unfished(mod, stock = 1)
mod |
A 'jjm.output' object from [readJJM()]. |
stock |
Stock index. |
A tibble with total biomass by scenario.
Calculate Francis T1.8 effective sample sizes
extr_francis(agefits, effn_df, grp_var = "fleet")extr_francis(agefits, effn_df, grp_var = "fleet")
agefits |
Age-composition fit data. |
effn_df |
Input sample-size data from [extr_effn()]. |
grp_var |
Group variable, '"fleet"' or '"survey"'. |
A tibble with input and Francis effective sample sizes.
Extract standardised survey index fits
extr_indices(mod, stock = 1)extr_indices(mod, stock = 1)
mod |
A 'jjm.output' object from [readJJM()]. |
stock |
Stock index. |
A tibble with standardised observed and modelled index values.
Extract Kobe phase-plot data
extr_kobe(mod, stock = 1)extr_kobe(mod, stock = 1)
mod |
A 'jjm.output' object from [readJJM()]. |
stock |
Stock index. |
A tibble with 'year', 'bbmsy', and 'ffmsy'.
Extract fishery length-composition fits
extr_lenfits_fsh(mod, stock = 1)extr_lenfits_fsh(mod, stock = 1)
mod |
A 'jjm.output' object from [readJJM()]. |
stock |
Stock index. |
A tibble with observed and predicted fishery length compositions.
Extract fishery mean age fits
extr_meanage_fsh(mod, stock = 1)extr_meanage_fsh(mod, stock = 1)
mod |
A 'jjm.output' object from [readJJM()]. |
stock |
Stock index. |
A tibble with fishery mean-age observations and fits.
Extract survey mean age fits
extr_meanage_srv(mod, stock = 1)extr_meanage_srv(mod, stock = 1)
mod |
A 'jjm.output' object from [readJJM()]. |
stock |
Stock index. |
A tibble with survey mean-age observations and fits.
Extract fishery mean length fits
extr_meanlen_fsh(mod, stock = 1)extr_meanlen_fsh(mod, stock = 1)
mod |
A 'jjm.output' object from [readJJM()]. |
stock |
Stock index. |
A tibble with fishery mean-length observations and fits.
Extract q break years
extr_q_breaks(mod)extr_q_breaks(mod)
mod |
A 'jjm.output' object from [readJJM()]. |
A tibble with survey names and q break years.
Extract q trajectories
extr_q_trajectory(mod, stock = 1)extr_q_trajectory(mod, stock = 1)
mod |
A 'jjm.output' object from [readJJM()]. |
stock |
Stock index. |
A tibble with catchability by survey and year.
Extract retrospective data
extr_retro(retro, var = "SSB", stock = 1)extr_retro(retro, var = "SSB", stock = 1)
retro |
A retrospective object loaded from a JJM retrospective RData file. |
var |
Variable to extract. '"SSB"' and '"R"' use direct retrospective entries. '"F"' averages the first column of all 'F_fsh_*' entries. |
stock |
Stock index. |
A tibble with 'year', 'est', optional confidence limits, and 'peel'.
Extract selectivity block break years
extr_sel_breaks(mod, type = c("fsh", "srv"))extr_sel_breaks(mod, type = c("fsh", "srv"))
mod |
A 'jjm.output' object from [readJJM()]. |
type |
'"fsh"' for fisheries or '"srv"' for surveys. |
A tibble of break years.
Extract fishery selectivity-at-age
extr_sel_fsh(mod, stock = 1)extr_sel_fsh(mod, stock = 1)
mod |
A 'jjm.output' object from [readJJM()]. |
stock |
Stock index. |
A tibble with fishery selectivity-at-age.
Extract survey selectivity-at-age
extr_sel_srv(mod, stock = 1)extr_sel_srv(mod, stock = 1)
mod |
A 'jjm.output' object from [readJJM()]. |
stock |
Stock index. |
A tibble with survey selectivity-at-age.
Extract stock-recruitment pairs and curve
extr_sr(mod, stock = 1)extr_sr(mod, stock = 1)
mod |
A 'jjm.output' object from [readJJM()]. |
stock |
Stock index. |
A list with 'pairs', 'curve', and 'steepness'.
Extract survey skill data
extr_survey_skill(mod, stock = 1)extr_survey_skill(mod, stock = 1)
mod |
A 'jjm.output' object from [readJJM()]. |
stock |
Stock index. |
A tibble with survey log-ratios and model SSB direction.
Extract fishery weight-at-age data
extr_wtat_fsh(mod, stock = 1)extr_wtat_fsh(mod, stock = 1)
mod |
A 'jjm.output' object from [readJJM()]. |
stock |
Stock index. |
A tibble with 'year', 'fleet', 'age', and 'weight'.
Extract survey weight-at-age data
extr_wtat_srv(mod, stock = 1)extr_wtat_srv(mod, stock = 1)
mod |
A 'jjm.output' object from [readJJM()]. |
stock |
Stock index. |
A tibble with 'year', 'survey', 'age', and 'weight'.
Calculate figure height for faceted plots
facet_fig_height(n_panels, ncol = 2, panel_h = 3.5, min_h = 4)facet_fig_height(n_panels, ncol = 2, panel_h = 3.5, min_h = 4)
n_panels |
Number of panels. |
ncol |
Number of panels per row. |
panel_h |
Height per panel row. |
min_h |
Minimum height. |
Numeric figure height.
Calculate or input a fixed Bmsy value for the jjm model Updates the msy_mt table in the jjm output with new B/Bmsy ratios.
fixed_bmsy(mod, bmsy_in = NULL, dyn = FALSE)fixed_bmsy(mod, bmsy_in = NULL, dyn = FALSE)
mod |
jjm object that is a list of lists |
bmsy_in |
A number (or vector of numbers if multiple stocks) to input as Bmsy. If not filled, calculated as the average of the Bmsy estimated for the last ten years (as determined in SCW14 benchmark 2022) |
dyn |
Logical value to indicate whether a dynamic Bmsy should be calculated |
A model
# fixed_bmsy(mod_h1_1.00, bmsy_in=5500) # To input a fixed Bmsy # fixed_bmsy(mod_h1_1.00) # To calculate the Bmsy# fixed_bmsy(mod_h1_1.00, bmsy_in=5500) # To input a fixed Bmsy # fixed_bmsy(mod_h1_1.00) # To calculate the Bmsy
Get fits to indices
get_age_fits(models)get_age_fits(models)
models |
an object of class jjm.output |
a tidy dataframe of age fits
Get estimated catchability coefficients
get_catchabilities(models)get_catchabilities(models)
models |
an object of class jjm.output |
a data frame of estimated catchabilities
Get fishing mortality at age
get_fishing_mortality(models)get_fishing_mortality(models)
models |
an object of class jjm.output |
a tidy dataframe of fishing mortality at age
Get fits to indices
get_index_fits(models)get_index_fits(models)
models |
an object of class jjm.output |
a tidy dataframe of index fits
Get fits to length compositions
get_len_fits(models)get_len_fits(models)
models |
an object of class jjm.output |
a tidy dataframe of length composition fits
Get and tidy msy_my table
get_msy_mt(models)get_msy_mt(models)
models |
series of class jjm.output |
a tidy msy_mt
## Not run: mod0.00 <- readJJM("h2_0.00", path = "config", input = "input") get_msy_mt(mod0.00) ## End(Not run)## Not run: mod0.00 <- readJJM("h2_0.00", path = "config", input = "input") get_msy_mt(mod0.00) ## End(Not run)
Get estimated recruits
get_recruits(models)get_recruits(models)
models |
an object of class jjm.output |
a tidy dataframe of recruits
Get and tidy selectivity-at-age ogives over time by model and fleet
get_selectivities(models)get_selectivities(models)
models |
an object of class jjm.output |
a tidy data frame of selectivity estimates
## Not run: h1.mod <- jjmR::readJJM("h2_0.02", path = "config", input = "input") selectivities <- get_selectivities(h1.mod) ## End(Not run)## Not run: h1.mod <- jjmR::readJJM("h2_0.02", path = "config", input = "input") selectivities <- get_selectivities(h1.mod) ## End(Not run)
Get total metrics (biomass, spawning biomass, and recruitment)
get_totals(models)get_totals(models)
models |
an object of class jjm.output |
a dataframe of total values
Add hypothesis number to a model name
geth(mod, h = hyp)geth(mod, h = hyp)
mod |
A character string of a model name. |
h |
A character string containing the hypothesis to use. |
A character string containing the hypothesis name and the model name.
geth("1.00", "h1")geth("1.00", "h1")
Get elements of a list by string matching on name
getter(x, pattern = "^sel_", things = NA)getter(x, pattern = "^sel_", things = NA)
x |
the object |
pattern |
the string pattern (regex supported) to search for |
things |
Optional preselected object list; defaults to |
an object subset to matches in names with strings
Compute a gray color ramp
gray_ramp(n)gray_ramp(n)
n |
Number of shades |
Character vector of hex grays
Check whether composition data are available
has_comp(df, grp_var = NULL, grp_filter = NULL)has_comp(df, grp_var = NULL, grp_filter = NULL)
df |
Composition fit tibble. |
grp_var |
Optional grouping variable name. |
grp_filter |
Optional group value to filter. |
'TRUE' when observed composition rows exist.
Build a publication label from a JJM model name
jjm_label(nm, stock_name = NULL)jjm_label(nm, stock_name = NULL)
nm |
Model name, such as '"h1_1.14"' or '"h2_1.14"'. |
stock_name |
Optional stock label to append. |
A character label.
JJM annex diagnostic palettes
jjm_pfa_palette(type = c("pfa", "fleet", "survey", "peel"))jjm_pfa_palette(type = c("pfa", "fleet", "survey", "peel"))
type |
Palette to return: '"pfa"', '"fleet"', '"survey"', or '"peel"'. |
A named character vector of hex colours.
This function create a kobe plot from JJM model outputs
kobe( obj, add = FALSE, col = "black", stock = 1, Bref = 1, Fref = 1, Blim = Bref, Flim = Fref, xlim = NULL, ylim = NULL, engine = "ggplot", ... )kobe( obj, add = FALSE, col = "black", stock = 1, Bref = 1, Fref = 1, Blim = Bref, Flim = Fref, xlim = NULL, ylim = NULL, engine = "ggplot", ... )
obj |
a jjm model outputs object. |
add |
boolean, add to an existing kobe plot? |
col |
color for the lines and points. |
stock |
Number of the stock chosen for the kobe plot. |
Bref |
Reference point for B/B_MSY, default=1. |
Fref |
Reference point for F/F_MSY, default=1. |
Blim |
Limit reference point for B/B_MSY, default=0.5. |
Flim |
Limit reference point for F/F_MSY, default=1.5. |
xlim |
'x' axis limits. |
ylim |
'y' axis limits. |
engine |
Plotting engine, either |
... |
Additional parameters passed to plot. |
## Not run: kobe(model) ## End(Not run)## Not run: kobe(model) ## End(Not run)
Melt an age-or-length matrix into a long tibble
melt_matrix(mat, years = NULL, ages = NULL, class = "age")melt_matrix(mat, years = NULL, ages = NULL, class = "age")
mat |
A matrix with years in column 1 and data in subsequent columns |
years |
Vector of years (if not the first column) |
ages |
Ages or lengths |
class |
Name of the grouping variable (e.g. "age" or "length") |
A tibble with columns 'year', 'value', and '<class>'
Bar+line plot of observed vs predicted catch-at-age
plot_catch_age_fits(out, ages, fleets = NULL)plot_catch_age_fits(out, ages, fleets = NULL)
out |
jjm.out list from runJJM() |
ages |
integer vector of ages |
fleets |
optional character vector; default = all fleets |
Bubble plot of catch-at-age residuals
plot_catch_age_residuals(out, ages, fleets = NULL)plot_catch_age_residuals(out, ages, fleets = NULL)
out |
jjm.out list from runJJM() |
ages |
integer vector of ages |
fleets |
optional character vector; default = all fleets |
Plot catch by fleet
plot_catch_fleet(mod, stock = 1, title = NULL)plot_catch_fleet(mod, stock = 1, title = NULL)
mod |
A 'jjm.output' object from [readJJM()]. |
stock |
Stock index. |
title |
Optional plot title. |
A ggplot or patchwork object.
Plot composition fits and residuals
plot_comp_fits( df, x_var, grp_var, grp_filter = NULL, x_lab = "Age", title = NULL )plot_comp_fits( df, x_var, grp_var, grp_filter = NULL, x_lab = "Age", title = NULL )
df |
Composition fit data from an 'extr_*fits_*()' function. |
x_var |
X variable, usually '"age"' or '"length_bin"'. |
grp_var |
Grouping variable, usually '"fleet"' or '"survey"'. |
grp_filter |
Optional group value. |
x_lab |
X-axis label. |
title |
Optional plot title. |
A patchwork object.
Plot observed composition ridges
plot_comp_ridge( df, x_var = "age", facet_var = "fleet", x_lab = "Age", title = NULL )plot_comp_ridge( df, x_var = "age", facet_var = "fleet", x_lab = "Age", title = NULL )
df |
Composition fit data. |
x_var |
X variable, usually '"age"' or '"length_bin"'. |
facet_var |
Facet variable, usually '"fleet"' or '"survey"'. |
x_lab |
X-axis label. |
title |
Optional plot title. |
A ggplot object.
Plot input composition sample sizes
plot_effn(mod, stock = 1, title = NULL)plot_effn(mod, stock = 1, title = NULL)
mod |
A 'jjm.output' object from [readJJM()]. |
stock |
Stock index. |
title |
Optional plot title. |
A ggplot object.
Plot fished and unfished biomass
plot_fished_unfished(mod, stock = 1, title = NULL)plot_fished_unfished(mod, stock = 1, title = NULL)
mod |
A 'jjm.output' object from [readJJM()]. |
stock |
Stock index. |
title |
Optional plot title. |
A ggplot object.
Plot weight at age in the fishery
plot_fishery_weight(out, ages)plot_fishery_weight(out, ages)
out |
A jjm output list |
ages |
Vector of ages |
Plot standard index fit diagnostics
plot_fit_diagnostics(df, title = NULL)plot_fit_diagnostics(df, title = NULL)
df |
Index fit data, usually one survey from [extr_indices()]. |
title |
Optional plot title. |
A patchwork object.
Plot Francis T1.8 reweighting diagnostics
plot_francis(mod, stock = 1, title = NULL)plot_francis(mod, stock = 1, title = NULL)
mod |
A 'jjm.output' object from [readJJM()]. |
stock |
Stock index. |
title |
Optional plot title. |
A ggplot object.
Plot historical retrospective diagnostics
plot_historic_retro(data, quantity = c("stock", "reference"), title = NULL)plot_historic_retro(data, quantity = c("stock", "reference"), title = NULL)
data |
A prepared data frame from [read_historic_retro()] or a CSV file path. |
quantity |
Plot group: '"stock"' for SSB/F/recruitment or '"reference"' for reference points. |
title |
Optional patchwork title. |
A patchwork object.
Plot index fits with input CVs
plot_indices_v2(mod, stock = 1, title = NULL)plot_indices_v2(mod, stock = 1, title = NULL)
mod |
A 'jjm.output' object from [readJJM()]. |
stock |
Stock index. |
title |
Optional plot title. |
A ggplot or patchwork object.
Plot Kobe phase plot
plot_kobe(mod, stock = 1, title = NULL)plot_kobe(mod, stock = 1, title = NULL)
mod |
A 'jjm.output' object from [readJJM()]. |
stock |
Stock index. |
title |
Optional plot title. |
A ggplot object.
Plot mean age or mean length fits
plot_meanstat(df, facet_var, y_lab = "Mean age (years)", title = NULL)plot_meanstat(df, facet_var, y_lab = "Mean age (years)", title = NULL)
df |
Data from 'extr_mean*()' functions. |
facet_var |
Facet variable. |
y_lab |
Y-axis label. |
title |
Optional plot title. |
A ggplot object.
Plot metadata overview
plot_metadata_overview(mod, title = NULL)plot_metadata_overview(mod, title = NULL)
mod |
A 'jjm.output' object from [readJJM()]. |
title |
Optional plot title. |
A ggplot object showing index, age-composition, and length-composition years by data source.
Plot q trajectories
plot_q_trajectory(mod, stock = 1, title = NULL)plot_q_trajectory(mod, stock = 1, title = NULL)
mod |
A 'jjm.output' object from [readJJM()]. |
stock |
Stock index. |
title |
Optional plot title. |
A ggplot object.
Plot retrospective peels
plot_retro(retro, var = "SSB", stock = 1, title = NULL)plot_retro(retro, var = "SSB", stock = 1, title = NULL)
retro |
A retrospective object loaded from a JJM retrospective RData file. |
var |
Variable to extract. '"SSB"' and '"R"' use direct retrospective entries. '"F"' averages the first column of all 'F_fsh_*' entries. |
stock |
Stock index. |
title |
Optional plot title. |
A ggplot object.
Plot selectivity ridges
plot_sel_ridge(df, facet_var, title = NULL, breaks_df = NULL)plot_sel_ridge(df, facet_var, title = NULL, breaks_df = NULL)
df |
Selectivity data from [extr_sel_fsh()] or [extr_sel_srv()]. |
facet_var |
Facet variable. |
title |
Optional plot title. |
breaks_df |
Optional break-year data from [extr_sel_breaks()]. |
A ggplot object.
Plot selectivities by age, year, fleet, and model
plot_selectivities( sels, fleet = "fsh", alpha = 0.4, scale = 4, size = 0.5, years = "all" )plot_selectivities( sels, fleet = "fsh", alpha = 0.4, scale = 4, size = 0.5, years = "all" )
sels |
selectivity data frame generated by |
fleet |
fleets to plot: "fsh" (fishery), "ind" (survey), or "all" (both) |
alpha |
Line opacity. |
scale |
Scaling factor for the panel strip color gradient. |
size |
Line width. |
years |
Years to plot, or |
a ggplot2 plot object
## Not run: oldnewMods <- combineModels(mod0.00,mod_prev) selectivities <- get_selectivities(oldnewMods) plot_selectivities(selectivities) ## End(Not run)## Not run: oldnewMods <- combineModels(mod0.00,mod_prev) selectivities <- get_selectivities(oldnewMods) plot_selectivities(selectivities) ## End(Not run)
Plot stock-recruitment relationship
plot_sr(mod, stock = 1, title = NULL)plot_sr(mod, stock = 1, title = NULL)
mod |
A 'jjm.output' object from [readJJM()]. |
stock |
Stock index. |
title |
Optional plot title. |
A ggplot object.
Plot a summary diagnostics sheet
plot_summary_sheet(mod, stock = 1, title = NULL)plot_summary_sheet(mod, stock = 1, title = NULL)
mod |
A 'jjm.output' object from [readJJM()]. |
stock |
Stock index. |
title |
Optional plot title. |
A patchwork object.
Plot survey skill ROC curves
plot_survey_skill(mod, stock = 1, title = NULL)plot_survey_skill(mod, stock = 1, title = NULL)
mod |
A 'jjm.output' object from [readJJM()]. |
stock |
Stock index. |
title |
Optional plot title. |
A ggplot object.
Plot weight-at-age over time
plot_wtat(df, facet_var, title = NULL, years = NULL)plot_wtat(df, facet_var, title = NULL, years = NULL)
df |
Data from [extr_wtat_fsh()] or [extr_wtat_srv()]. |
facet_var |
Facet variable, usually '"fleet"' or '"survey"'. |
title |
Optional plot title. |
years |
Optional vector of years to plot. |
A ggplot object.
Plot weight-at-age by cohort
plot_wtat_cohort(df, facet_var, title = NULL, years = NULL)plot_wtat_cohort(df, facet_var, title = NULL, years = NULL)
df |
Data from [extr_wtat_fsh()] or [extr_wtat_srv()]. |
facet_var |
Facet variable, usually '"fleet"' or '"survey"'. |
title |
Optional plot title. |
years |
Optional vector of years to plot. |
A ggplot object.
Creates diagnostic plots from the JJM model diagnostics based on specified parameters. Can generate plots for model inputs (data) or outputs across different models and stocks.
## S3 method for class 'jjm.diag' plot( x, what = c("data", "output"), model = NULL, stock = NULL, var = NULL, fleet = NULL, plot = TRUE, ... )## S3 method for class 'jjm.diag' plot( x, what = c("data", "output"), model = NULL, stock = NULL, var = NULL, fleet = NULL, plot = TRUE, ... )
x |
An object of class 'jjm.diag' |
what |
Character vector specifying which type of diagnostics to plot. Options are "data" (or deprecated "input") and "output". Default is c("data", "output"). |
model |
Character vector of model names to include. If NULL (default), all models are used. |
stock |
Character vector of stock names to include. If NULL (default), all stocks are used. |
var |
Character vector of variable names to include. If NULL (default), all variables are used. |
fleet |
Character vector or numeric vector of fleet indices to include. If NULL (default), all fleets are used. |
plot |
Logical. If TRUE (default), plots are displayed. If FALSE, plot objects are returned. |
... |
Additional arguments passed to internal plotting functions |
If plot=TRUE, returns invisibly. If plot=FALSE, returns a list of plot objects.
## Not run: diagnostics <- diag.jjm("path/to/model") # Plot all diagnostics plot(diagnostics) # Plot only data diagnostics for a specific model and stock plot(diagnostics, what = "data", model = "Model1", stock = "Stock1") # Return plot objects without displaying plot_objects <- plot(diagnostics, plot = FALSE) ## End(Not run)## Not run: diagnostics <- diag.jjm("path/to/model") # Plot all diagnostics plot(diagnostics) # Plot only data diagnostics for a specific model and stock plot(diagnostics, what = "data", model = "Model1", stock = "Stock1") # Return plot objects without displaying plot_objects <- plot(diagnostics, plot = FALSE) ## End(Not run)
Plot diagnostics
## S3 method for class 'jjm.diagnostics' plot(x, which = names(x), ...)## S3 method for class 'jjm.diagnostics' plot(x, which = names(x), ...)
x |
A summary.jjm.diagnostics |
which |
Vector of named diagnostics to render |
... |
Additional arguments. Currently ignored. |
Creates various plots from the JJM model output based on the specified type.
## S3 method for class 'jjm.output' plot( x, what = "biomass", stack = TRUE, endvalue = FALSE, total = FALSE, combine = FALSE, cols = NULL, poslegend = "right", scen = 1, ... )## S3 method for class 'jjm.output' plot( x, what = "biomass", stack = TRUE, endvalue = FALSE, total = FALSE, combine = FALSE, cols = NULL, poslegend = "right", scen = 1, ... )
x |
An object of class 'jjm.output' |
what |
Character string specifying the type of plot. Options include:
|
stack |
Logical. If TRUE, stack multiple series in one plot. Default is TRUE. |
endvalue |
Logical. If TRUE, display end values on plot. Default is FALSE. |
total |
Logical. If TRUE, include total values. Default is FALSE. |
combine |
Logical. If TRUE, combine multiple plots. Default is FALSE. |
cols |
Optional vector of colors for plotting |
poslegend |
Position of the legend. Default is "right". |
scen |
Integer. Scenario number for projection plots. Default is 1. |
... |
Additional arguments passed to plotting functions |
A plot object (typically a grid or ggplot object)
## Not run: model <- read.jjm("path/to/model") plot(model, what = "biomass") plot(model, what = "ssb", stack = FALSE) plot(model, what = "kobe") ## End(Not run)## Not run: model <- read.jjm("path/to/model") plot(model, what = "biomass") plot(model, what = "ssb", stack = FALSE) plot(model, what = "kobe") ## End(Not run)
Print a jjm.config object
## S3 method for class 'jjm.config' print(x, ...)## S3 method for class 'jjm.config' print(x, ...)
x |
A |
... |
Additional arguments (ignored). |
Invisibly returns x.
Prints a summary of the JJM diagnostic object, displaying information about available input and output plots for each model and stock.
## S3 method for class 'jjm.diag' print(x, ...)## S3 method for class 'jjm.diag' print(x, ...)
x |
An object of class 'jjm.diag' |
... |
Additional arguments passed to print methods |
Invisibly returns the input object (for use in pipelines)
## Not run: diagnostics <- diag.jjm("path/to/model") print(diagnostics) ## End(Not run)## Not run: diagnostics <- diag.jjm("path/to/model") print(diagnostics) ## End(Not run)
Prints a summary of the JJM model output object, displaying basic information about the model, stocks, and data sources.
## S3 method for class 'jjm.output' print(x, ...)## S3 method for class 'jjm.output' print(x, ...)
x |
An object of class 'jjm.output' |
... |
Additional arguments passed to print methods |
Invisibly returns the input object (for use in pipelines)
## Not run: model <- read.jjm("path/to/model") print(model) ## End(Not run)## Not run: model <- read.jjm("path/to/model") print(model) ## End(Not run)
Print a summary of jjm.config
## S3 method for class 'summary.jjm.config' print(x, ...)## S3 method for class 'summary.jjm.config' print(x, ...)
x |
A |
... |
Additional arguments (ignored). |
Invisibly returns x.
Prints the detailed diagnostics information from a summary.jjm.diag object, showing both input and output plot details.
## S3 method for class 'summary.jjm.diag' print(x, ...)## S3 method for class 'summary.jjm.diag' print(x, ...)
x |
An object of class 'summary.jjm.diag' |
... |
Additional arguments passed to print methods |
Invisibly returns the input object (for use in pipelines)
Prints the tables and plots generated by the summary method for jjm.output objects.
## S3 method for class 'summary.jjm.output' print(x, ...)## S3 method for class 'summary.jjm.output' print(x, ...)
x |
An object of class 'summary.jjm.output' |
... |
Additional arguments passed to print methods |
Invisibly returns the input object (for use in pipelines)
Read historical retrospective CSV data
read_historic_retro(file, exclude_assessment_types = c("benchmark", "mod1.4"))read_historic_retro(file, exclude_assessment_types = c("benchmark", "mod1.4"))
file |
CSV file path. |
exclude_assessment_types |
Assessment types to remove before plotting. |
A prepared data frame.
Read external files
readExFiles( fileName, type, path = NULL, version = "2015MS", parameters = FALSE, parData, nameFishery, nameIndex, nAges, nStock = NULL )readExFiles( fileName, type, path = NULL, version = "2015MS", parameters = FALSE, parData, nameFishery, nameIndex, nAges, nStock = NULL )
fileName |
filename |
type |
type |
path |
path |
version |
version of JJM, default to "2015MS" (2015 SC multi-stock). |
parameters |
parameters |
parData |
parData |
nameFishery |
nameFishery |
nameIndex |
nameIndex |
nAges |
nAges |
nStock |
nStock |
Function to read models and list if models and generate results
readJJM( model, path = NULL, output = "results", input = NULL, version = "2015MS", ... )readJJM( model, path = NULL, output = "results", input = NULL, version = "2015MS", ... )
model |
String with the name of model that will be readed or run. |
path |
Directory where the 'admb' folder is located. |
output |
Path to the model outputs directory. |
input |
Path to model inputs directory. |
version |
version of JJM, default to "2015MS" (2015 SC multi-stock). |
... |
Extra arguments |
## Not run: readJJM(model = "mod2.4") ## End(Not run)## Not run: readJJM(model = "mod2.4") ## End(Not run)
Store in an R object (of class jjm.config) the dat and ctl files needed to run a model.
readJJMConfig(model, path, input = NULL, ...)readJJMConfig(model, path, input = NULL, ...)
model |
Model object or outputs |
path |
Path to the ctl file |
input |
Path to the input files |
... |
Additional arguments passed to other functions. |
## Not run: readJJMConfig(mod1) ## End(Not run)## Not run: readJJMConfig(mod1) ## End(Not run)
Function to create and save reports in PDF and MS Word formats.
report(object, format, output, tangle = FALSE, tidy = TRUE, ...)report(object, format, output, tangle = FALSE, tidy = TRUE, ...)
object |
The object to create the report with, can be of classes
'jjm.output' or 'jjm.diag' as created with |
format |
Format for the report: either "pdf", "html" or "word". |
output |
Path to save the report, by default the working directory. |
tangle |
Boolean, if TRUE the R script to create the report is produced. |
tidy |
Boolean, if TRUE the intermediate files (Rmd, tex) are deleted. |
... |
Extra arguments |
## Not run: report(mod0.0) ## End(Not run)## Not run: report(mod0.0) ## End(Not run)
Run a retrospective analysis for a model
retro( model, n = 5, output = "results", exec = NULL, parallel = FALSE, temp = NULL, wait = TRUE, iprint = 100, ... )retro( model, n = 5, output = "results", exec = NULL, parallel = FALSE, temp = NULL, wait = TRUE, iprint = 100, ... )
model |
An object of class jjm.output |
n |
Number of years to run a retrospective analysis. |
output |
Path to save results. |
exec |
Path to JJM executable file. |
parallel |
Boolean flag to run models in parallel. |
temp |
Folder to run retrospective analysis. If NULL, a temporal folder is used. |
wait |
Boolean, passed to runJJM, should we wait for the parameter estimation? |
iprint |
Command line argument passed to jjm. |
... |
Additional arguments passed to other functions. |
## Not run: retro(mod1) ## End(Not run)## Not run: retro(mod1) ## End(Not run)
Shortcut to fit, run, read and plot a JJM model
runit( mod, est = FALSE, exec = NULL, path = "config", input = "input", output = "results", version = "2015MS", pdf = FALSE, portrait = TRUE, ... )runit( mod, est = FALSE, exec = NULL, path = "config", input = "input", output = "results", version = "2015MS", pdf = FALSE, portrait = TRUE, ... )
mod |
A character specifying the name of a model (by it's ctl filename). |
est |
Boolean, should we run the parameter estimation for a model? |
exec |
Path to the JJM executable file. By default, 'jjms' will be used. |
path |
Directory where the configuration files will be written. |
input |
Input |
output |
Folder to save the outputs, 'arc' by default. |
version |
version of JJM, default to "2015MS" (2015 SC multi-stock). |
pdf |
Produce outputs in a pdf file? |
portrait |
Orientation of the pdf output, default TRUE. |
... |
Additional arguments passed to |
## Not run: writeJJM(mod1) ## End(Not run)## Not run: writeJJM(mod1) ## End(Not run)
Function to run one or several JJM models
runJJM( models, path = NULL, output = "results", input = NULL, exec = NULL, version = NULL, useGuess = FALSE, guess = NULL, piner = NULL, iprint = 100, wait = TRUE, parallel = FALSE, temp = NULL, ... )runJJM( models, path = NULL, output = "results", input = NULL, exec = NULL, version = NULL, useGuess = FALSE, guess = NULL, piner = NULL, iprint = 100, wait = TRUE, parallel = FALSE, temp = NULL, ... )
models |
String with the name of the models to be run. |
path |
Directory where the 'admb' folder is located. |
output |
Folder to save the outputs, 'arc' by default. |
input |
Input |
exec |
Path to the jjm executable |
version |
version of JJM, default to "2015MS" (2015 SC multi-stock). |
useGuess |
boolean, to use an initial guess for the parameters? |
guess |
File with the initial guess for the parameters. If |
piner |
A number to start the profiling on the meanlogrec |
iprint |
iprint parameter for the JJM model, 100 by default. |
wait |
boolean, wait for the model to finish? Forced to be TRUE. |
parallel |
Should model run in parallel? A cluster need to be setup to be used with foreach. |
temp |
character, path for a temporal directory to run models, if |
... |
Arguments passed from |
## Not run: model = runJJM(models = "mod2.4") ## End(Not run)## Not run: model = runJJM(models = "mod2.4") ## End(Not run)
Executes one or more JJM model runs, optionally in parallel.
## Default S3 method: runJJM( models, path = NULL, output = "results", input = NULL, exec = NULL, version = NULL, useGuess = FALSE, guess = NULL, piner = NULL, iprint = 100, wait = TRUE, parallel = FALSE, temp = NULL, ... )## Default S3 method: runJJM( models, path = NULL, output = "results", input = NULL, exec = NULL, version = NULL, useGuess = FALSE, guess = NULL, piner = NULL, iprint = 100, wait = TRUE, parallel = FALSE, temp = NULL, ... )
models |
Character vector of model filenames. |
path |
Optional directory containing model files. |
output |
Directory for model results (created if missing). |
input |
Directory for input files (default = model directory). |
exec |
Path to JJM executable. |
version |
Executable version (ignored if |
useGuess |
Logical; whether to use starting parameter guesses. |
guess |
Vector of guess filenames or logical. |
piner |
Additional runner parameters. |
iprint |
Printing control for JJM output. |
wait |
Logical; whether to wait for completion before returning. |
parallel |
Logical; whether to run models in parallel. |
temp |
Directory for temporary files (default = |
... |
Additional arguments passed to internal runner. |
Invisibly returns the path to temp used for input files.
Run JJM models for jjm.config
## S3 method for class 'jjm.config' runJJM( models, path = NULL, output = "results", input = NULL, exec = NULL, version = NULL, useGuess = FALSE, guess = NULL, piner = NULL, iprint = 100, wait = TRUE, parallel = FALSE, temp = NULL, ... )## S3 method for class 'jjm.config' runJJM( models, path = NULL, output = "results", input = NULL, exec = NULL, version = NULL, useGuess = FALSE, guess = NULL, piner = NULL, iprint = 100, wait = TRUE, parallel = FALSE, temp = NULL, ... )
models |
Character vector of model filenames. |
path |
Optional directory containing model files. |
output |
Directory for model results (created if missing). |
input |
Directory for input files (default = model directory). |
exec |
Path to JJM executable. |
version |
Executable version (ignored if |
useGuess |
Logical; whether to use starting parameter guesses. |
guess |
Vector of guess filenames or logical. |
piner |
Additional runner parameters. |
iprint |
Printing control for JJM output. |
wait |
Logical; whether to wait for completion before returning. |
parallel |
Logical; whether to run models in parallel. |
temp |
Directory for temporary files (default = |
... |
Additional arguments passed to internal runner. |
Run JJM models for jjm.output
## S3 method for class 'jjm.output' runJJM( models, path = NULL, output = "results", input = NULL, exec = NULL, version = NULL, useGuess = FALSE, guess = NULL, piner = NULL, iprint = 100, wait = TRUE, parallel = FALSE, temp = NULL, ... )## S3 method for class 'jjm.output' runJJM( models, path = NULL, output = "results", input = NULL, exec = NULL, version = NULL, useGuess = FALSE, guess = NULL, piner = NULL, iprint = 100, wait = TRUE, parallel = FALSE, temp = NULL, ... )
models |
Character vector of model filenames. |
path |
Optional directory containing model files. |
output |
Directory for model results (created if missing). |
input |
Directory for input files (default = model directory). |
exec |
Path to JJM executable. |
version |
Executable version (ignored if |
useGuess |
Logical; whether to use starting parameter guesses. |
guess |
Vector of guess filenames or logical. |
piner |
Additional runner parameters. |
iprint |
Printing control for JJM output. |
wait |
Logical; whether to wait for completion before returning. |
parallel |
Logical; whether to run models in parallel. |
temp |
Directory for temporary files (default = |
... |
Additional arguments passed to internal runner. |
Identify strong cohorts
strong_cohorts(mod, stock = 1, n = 3)strong_cohorts(mod, stock = 1, n = 3)
mod |
A 'jjm.output' object from [readJJM()]. |
stock |
Stock index. |
n |
Number of recruitment years to return. |
Integer vector of cohort years.
Summarize a jjm.config object
## S3 method for class 'jjm.config' summary(object, ...)## S3 method for class 'jjm.config' summary(object, ...)
object |
A |
... |
Additional arguments (ignored). |
An object of class summary.jjm.config containing model names.
Creates a detailed summary of JJM diagnostics, including information about input and output plots for model evaluation.
## S3 method for class 'jjm.diag' summary(object, ...)## S3 method for class 'jjm.diag' summary(object, ...)
object |
An object of class 'jjm.diag' |
... |
Additional arguments passed to internal functions |
An object of class 'summary.jjm.diag' containing detailed diagnostics
## Not run: diagnostics <- diag.jjm("path/to/model") diag_summary <- summary(diagnostics) print(diag_summary) ## End(Not run)## Not run: diagnostics <- diag.jjm("path/to/model") diag_summary <- summary(diagnostics) print(diag_summary) ## End(Not run)
Summarize all diagnostics from a jjm run
## S3 method for class 'jjm.diagnostics' summary(object, ...)## S3 method for class 'jjm.diagnostics' summary(object, ...)
object |
A list returned by runJJM |
... |
Additional arguments. Currently ignored. |
Generates a detailed summary of the JJM model output, including parameter tables, likelihood tables, projection tables (if requested), and summary plots.
## S3 method for class 'jjm.output' summary( object, Projections = FALSE, Fmult = NULL, BiomProj = NULL, CapProj = NULL, MRS = NULL, ... )## S3 method for class 'jjm.output' summary( object, Projections = FALSE, Fmult = NULL, BiomProj = NULL, CapProj = NULL, MRS = NULL, ... )
object |
An object of class 'jjm.output' |
Projections |
Logical. Whether to include projection tables. Default is FALSE. |
Fmult |
Optional vector of F multipliers for projections |
BiomProj |
Optional biomass projection parameters |
CapProj |
Optional capacity projection parameters |
MRS |
Optional Maximum Relative Selectivity parameters |
... |
Additional arguments passed to internal plotting functions |
An object of class 'summary.jjm.output' containing tables and plots
## Not run: model <- read.jjm("path/to/model") model_summary <- summary(model, Projections = TRUE) print(model_summary) ## End(Not run)## Not run: model <- read.jjm("path/to/model") model_summary <- summary(model, Projections = TRUE) print(model_summary) ## End(Not run)
ggplot2 theme for jjmR
theme_jjm(base_size = 12, ...)theme_jjm(base_size = 12, ...)
base_size |
Base font size. |
... |
Additional arguments passed to [ggplot2::theme_bw()]. |
a ggplot2 theme object
library(ggplot2) ggplot(mtcars, aes(mpg)) + geom_histogram() + theme_jjm()library(ggplot2) ggplot(mtcars, aes(mpg)) + geom_histogram() + theme_jjm()
Tidy results of JJM model
tidy_JJM(models)tidy_JJM(models)
models |
an object of class jjm.output |
a list of tidy dataframes
## Not run: mod0.00 <- readJJM("h2_0.00", path = "config", input = "input") tidy_jjm_results <- tidy_JJM(mod0.00) ## End(Not run)## Not run: mod0.00 <- readJJM("h2_0.00", path = "config", input = "input") tidy_jjm_results <- tidy_JJM(mod0.00) ## End(Not run)
Function write to the disk dat and ctl files
writeJJM(object, path, ...)writeJJM(object, path, ...)
object |
An object of class jjm.config or jjm.output. |
path |
Directory where the configuration files will be written. |
... |
Additional arguments |
## Not run: writeJJM(mod1) ## End(Not run)## Not run: writeJJM(mod1) ## End(Not run)