| Title: | State-Space Population Trend Analysis for Red List Assessments in 'RTMB' |
|---|---|
| Description: | The next generation of 'JARA' (Just Another Red-list Assessment). Fits the 'JARA' state-space models (a random walk with drift on log abundance, observed through relative abundance indices or census counts) in 'RTMB', in about a second per fit, with full posteriors through 'tmbstan' (NUTS) as an option. Estimates the change in abundance over three generation lengths and the probabilities of the IUCN Red List categories under criteria A1 and A2, with uncertainty in the generation length carried through. Includes projections, one-step-ahead residuals, retrospective analysis and hindcast cross-validation, graphics shared with 'JABBA3', inputs as data frames, 'FLIndices' or 'JABBA' objects, and a converter for 'JARA' inputs, so existing scripts continue to run. |
| Authors: | Henning Winker [aut, cre], Richard Sherley [aut], Nathan Pacoureau [aut] |
| Maintainer: | Henning Winker <[email protected]> |
| License: | EUPL (>= 1.2) |
| Version: | 2.0.0.9000 |
| Built: | 2026-12-03 09:12:58 UTC |
| Source: | https://github.com/Henning-Winker/JARA2 |
As in JARA: CR if the change (%) is at or below the CR threshold, and so on.
assign_iucn(change, criteria = "A2", NT = FALSE)assign_iucn(change, criteria = "A2", NT = FALSE)
change |
change in abundance over the assessment window (%) |
criteria |
|
NT |
add the Near Threatened band |
character vector of categories
assign_iucn(c(-85, -60, -35, -10))assign_iucn(c(-85, -60, -35, -10))
Fishing mortality and spawning biomass relative to reference points from the 73 quantitative ICES stock assessments analysed by Winker et al. (2026), used there for JARA's mixed-trend analysis of the joint trajectories of F/FMSY and B/BMSY in the Northeast Atlantic. A long table with one row per stock and year.
data.frame with columns stock (ICES stock code), common.name, species, order, ecoregion, model
(assessment model), year, FFmsy (F/FMSY), BBmsy (SSB/BMSY), BBtri (SSB/MSY Btrigger), BBlim (SSB/Blim),
ABImsy (age-based indicator relative to MSY)
https://github.com/Henning-Winker/ICES-Bmsy-FaF
Winker, H., Cardinale, M., Sharma, R., Kell, L.T., Mosqueira, I. and Griffiths, C. (2026). Assessing the progress of stock rebuilding in the Northeast Atlantic against levels that can produce maximum sustainable yield. Fish and Fisheries. doi:10.1111/faf.70066
As in JARA: the change over 3 GL from the first and last observation, and from a log-linear regression, extrapolated to 3 GL.
iucn_estimators(I, GL = 10, criteria = "A2")iucn_estimators(I, GL = 10, criteria = "A2")
I |
data.frame(year, index) |
GL |
generation length |
criteria |
IUCN criterion |
list with the regression rate, predictions, changes and categories
Category probabilities from posterior draws of the change
iucn_probs(change, criteria = "A2", NT = FALSE)iucn_probs(change, criteria = "A2", NT = FALSE)
change |
draws of the % change |
criteria |
IUCN criterion |
NT |
add the Near Threatened band |
named vector of probabilities (%)
IUCN thresholds for criterion A
iucn_thresholds(criteria = "A2", NT = FALSE)iucn_thresholds(criteria = "A2", NT = FALSE)
criteria |
|
NT |
add a Near Threatened band (JARA's |
named vector of upper % change bounds for CR, EN, VU (and NT)
Functions of JARA 1.x used in analysis scripts, working on jara2() fits:
mixed.trend(): joint indicator of a mixed-trend fit by year, in JARA's layout (Year, Obs, n, 5%, 25%,
50%, 75%, 95%, run); type = "pr" gives the proportion of components above threshold. Computed by
jr2_mixed() (geometric mean, bootstrap across components). JARA 1.x labelled its outer quantiles 5% and 95% but
computed 2.5% and 97.5%; here the columns are the quantiles they are named after.
dfidx(): fitted trajectories ($i: name, yr, mu, lci, uci) and observations with their fits ($o)
of each series, with backcast.na as in JARA.
jrplot_retrobias() = jrplot_retro(); jrplot_r() = jrplot_changes().
mixed.trend( jara, run = "joint", refyr = FALSE, type = c("mu", "pr"), threshold = 1, backcast.na = NULL, ... ) dfidx(jara, run = "obs", backcast.na = NULL, ...) jrplot_retrobias(rt, ...) jrplot_r(jara, ...)mixed.trend( jara, run = "joint", refyr = FALSE, type = c("mu", "pr"), threshold = 1, backcast.na = NULL, ... ) dfidx(jara, run = "obs", backcast.na = NULL, ...) jrplot_retrobias(rt, ...) jrplot_r(jara, ...)
jara |
a |
run |
label in the |
refyr |
scale to the first year's median |
type |
|
threshold |
threshold for |
backcast.na |
optional year: before it a series enters only from its first observation (as JARA) |
... |
passed to |
rt |
a |
data.frame (mixed.trend), list (dfidx), ggplot (plots)
data(jrdat) f <- jara2(jrdat$Cape_gannet$I, model.type = "mixed.trends", GL = 18.3, fixed.obsE = 0.1, silent = TRUE) head(mixed.trend(f, run = "gannet")) str(dfidx(f), max.level = 1)data(jrdat) f <- jara2(jrdat$Cape_gannet$I, model.type = "mixed.trends", GL = 18.3, fixed.obsE = 0.1, silent = TRUE) head(mixed.trend(f, run = "gannet")) str(dfidx(f), max.level = 1)
Fits the JARA state-space model in RTMB and evaluates the change in abundance over three generation lengths (GL)
against the IUCN Red List criterion A thresholds. Arguments keep the names of JARA's build_jara() and
fit_jara(), so existing settings carry over; jarainput2jara2() converts a build_jara() object directly.
jara2( I, se = NULL, model.type = c("relative", "census", "mixed.trends"), GL = NULL, GL.cv = 0, components = NULL, assessment = "Unnamed", scenario = "s1", start.year = NA, end.year = NA, fixed.obsE = NULL, variance.weighting = "model", defaults = c("jara2", "jara"), sigma.proc.fixed = FALSE, sigma.proc = c("shared", "component"), rho = 0, bias.correct = TRUE, timeblock = NULL, covariates = NULL, cov.lag = 0, cov.form = "linear", cov.period = NULL, proj.mod = "theta10", pk.prior = c(0.25, 0.1), pk.yr = NULL, pk.i = NULL, proj.r = "GL3", proj.yrs = NULL, proj.stoch = FALSE, priors = jr2_priors(), engine = c("rtmb", "nuts"), ndraws = 2000, nuts = list(), credibility = 0.95, criteria = c("A2", "A1"), min.yrs = 10, max.future = 100, window = c("iucn", "jara"), smooth = c("jara", "none"), osa = TRUE, seed = 1, silent = FALSE )jara2( I, se = NULL, model.type = c("relative", "census", "mixed.trends"), GL = NULL, GL.cv = 0, components = NULL, assessment = "Unnamed", scenario = "s1", start.year = NA, end.year = NA, fixed.obsE = NULL, variance.weighting = "model", defaults = c("jara2", "jara"), sigma.proc.fixed = FALSE, sigma.proc = c("shared", "component"), rho = 0, bias.correct = TRUE, timeblock = NULL, covariates = NULL, cov.lag = 0, cov.form = "linear", cov.period = NULL, proj.mod = "theta10", pk.prior = c(0.25, 0.1), pk.yr = NULL, pk.i = NULL, proj.r = "GL3", proj.yrs = NULL, proj.stoch = FALSE, priors = jr2_priors(), engine = c("rtmb", "nuts"), ndraws = 2000, nuts = list(), credibility = 0.95, criteria = c("A2", "A1"), min.yrs = 10, max.future = 100, window = c("iucn", "jara"), smooth = c("jara", "none"), osa = TRUE, seed = 1, silent = FALSE )
I |
indices: a data.frame(year, index1, ...), |
se |
optional data.frame of log-scale SEs (same layout as |
model.type |
|
GL |
generation length (years). Default as JARA: floor((n.years - 3)/3), with a warning |
GL.cv |
log-scale CV of the generation length (0: known) |
components |
census only: component of each index (see |
assessment, scenario
|
labels |
start.year, end.year
|
optional subset of years |
fixed.obsE |
fixed observation SD added to all indices (default as JABBA3: 0.1 without |
variance.weighting |
|
defaults |
|
sigma.proc.fixed |
|
sigma.proc |
|
rho |
AR(1) coefficient of the process deviations: 0 (JARA), a fixed value, or |
bias.correct |
subtract |
timeblock |
optional year(s) after which the mean rate of change takes a new value |
covariates |
optional data.frame(year, z1, ...) of covariates (e.g. environmental indices) acting on the
annual rate of change: |
cov.lag |
lag (years) between a covariate and the rate of change it acts on (default 0: the covariate of year t acts on the change from t-1 to t) |
cov.form |
form of each covariate effect (recycled, or named by covariate): |
cov.period |
period |
proj.mod |
|
pk.prior |
lognormal prior c(median, log.sd) on the ratio of current (maximum) abundance to K |
pk.yr |
years over which the maximum abundance for K is taken (default all years) |
pk.i |
census only: median pk per component |
proj.r |
rate of change used for projections: |
proj.yrs |
number of projection years (default: 3 GL ahead, enough for the projected state and for criteria A3/A4) |
proj.stoch |
projections with process error |
priors |
|
engine |
|
ndraws |
number of draws from the MVN approximation ( |
nuts |
list of tmbstan settings: chains, iter, warmup, seed, cores, control |
credibility |
credible interval width |
criteria |
IUCN criteria evaluated: |
min.yrs |
minimum length of the assessment window (IUCN: 10 years) |
max.future |
maximum years into the future for A3 and A4 windows (IUCN: 100) |
window |
length of the assessment window: |
smooth |
|
osa |
compute one-step-ahead residuals |
seed |
random seed for the draws |
silent |
suppress messages |
Model. Log abundance of each component follows a random walk with drift,
, (with
rho, AR(1) deviations), observed as . timeblock gives the mean rate a separate value after each block year. Beyond the data the
state is projected with the mean rate of change over the proj.r window, damped near a carrying capacity
with a theta-logistic term (proj.mod), as in JARA.
Estimation. engine = "rtmb" finds the posterior mode (states integrated out by the Laplace approximation)
and draws from the multivariate normal approximation of the joint posterior of parameters and states (from the
joint precision matrix). engine = "nuts" samples the same posterior with NUTS (tmbstan). All derived quantities
(population trajectory, rates of change, change over 3 GL, IUCN probabilities) are computed per draw.
Generation length. GL.cv > 0 gives the GL a lognormal distribution; each posterior draw gets its own GL, so
the uncertainty in GL is carried into the 3-GL window and the category probabilities. The window is at least
min.yrs (IUCN: 10 years) long.
object of class jara2
data(jrdat) fit <- jara2(jrdat$Yellowspot_skate$I, jrdat$Yellowspot_skate$SE, GL = 12) fit jrplot_iucn(fit)data(jrdat) fit <- jara2(jrdat$Yellowspot_skate$I, jrdat$Yellowspot_skate$SE, GL = 12) fit jrplot_iucn(fit)
build_jara() object to JARA2Maps the data and settings of a JARA input (from JARA::build_jara()) to the arguments of jara2() and fits the
model, so existing JARA scripts need only one changed line. Settings without a JARA2 counterpart (proc.pen,
backcast.na) are dropped with a message. mixed.trends inputs map to model.type = "mixed.trends".
jarainput2jara2(jarainput, run = TRUE, ...)jarainput2jara2(jarainput, run = TRUE, ...)
jarainput |
object from |
run |
fit the model (default) or return the argument list for |
... |
further arguments to |
a jara2 fit, or a list of arguments
## Not run: jrin <- JARA::build_jara(I = jrdat$Afr_penguin$I, GL = 9, model.type = "census") fit <- jarainput2jara2(jrin) ## End(Not run)## Not run: jrin <- JARA::build_jara(I = jrdat$Afr_penguin$I, GL = 9, model.type = "census") fit <- jarainput2jara2(jrin) ## End(Not run)
As JARA's jr_runs() (Carvalho et al. 2021): a runs test for non-random residual patterns (by default one-sided,
testing for positive autocorrelation), and 3-sigma control limits from the average moving range.
jr_runs(x, mixing = c("less", "two.sided"))jr_runs(x, mixing = c("less", "two.sided"))
x |
residuals |
mixing |
|
list: sig3lim (lower and upper limits) and p.runs
AIC, AICc, Akaike weights and boundary checks for fits to the same index data, e.g. different
variance.weighting, time blocks, rho or covariates. Fits must use the same observations and the same
fixed parts of the observation variance (se, fixed.obsE); otherwise their likelihoods are not comparable and
the function stops. Variances estimated at (near) zero are flagged: AIC is unreliable at the boundary, and
differences below about 2 should not be read as support for one model (Auger-Methe et al. 2021).
jr2_aic(..., boundary = 0.001)jr2_aic(..., boundary = 0.001)
... |
|
boundary |
SD below which an estimated process or observation SD is flagged as at the boundary |
data.frame: model, logLik, df, AIC, AICc, dAIC, weight, A2 status and change, boundary flag
data(jrdat) bm <- jrdat$Bluemarlin_Atl_CPUE runs <- list(equal = jara2(bm$I, bm$SE, GL = 7.3, variance.weighting = "equal", silent = TRUE), model = jara2(bm$I, bm$SE, GL = 7.3, variance.weighting = "model", silent = TRUE)) jr2_aic(runs)data(jrdat) bm <- jrdat$Bluemarlin_Atl_CPUE runs <- list(equal = jara2(bm$I, bm$SE, GL = 7.3, variance.weighting = "equal", silent = TRUE), model = jara2(bm$I, bm$SE, GL = 7.3, variance.weighting = "model", silent = TRUE)) jr2_aic(runs)
Returns the jara2() fit as a jb3trend object (the class of JABBA3::jb3_trend()), so that the JABBA3 trend and
index tools apply directly: jbplot_trend(), jbplot_fits(), jbplot_residuals(), jbplot_runs(),
jbplot_ppc(), jbplot_jointindex(), jbplot_q(), jbplot_indexcor(), jbplot_noise(), jb3_qtable(),
jb3_noise() and jb3_jointindex(). The JARA2 aliases (jrplot_fits() etc.) call them through this function.
Intervals and the posterior predictive check use the JARA2 draws (MVN or NUTS).
jr2_as_jb3trend(fit)jr2_as_jb3trend(fit)
fit |
a |
object of class jb3trend
data(jrdat) fit <- jara2(jrdat$Yellowspot_skate$I, jrdat$Yellowspot_skate$SE, GL = 12, silent = TRUE) tr <- jr2_as_jb3trend(fit) JABBA3::jb3_qtable(tr)data(jrdat) fit <- jara2(jrdat$Yellowspot_skate$I, jrdat$Yellowspot_skate$SE, GL = 12, silent = TRUE) tr <- jr2_as_jb3trend(fit) JABBA3::jb3_qtable(tr)
Arranges abundance indices or census counts and their log-scale standard errors for jara2(). Each index belongs to a
population component with its own state (log abundance):
"relative"all indices observe one common trend (CPUE, surveys). Each index has a catchability q; the q of the anchor index (by default the one with the earliest observation) is 1, so the trend is on its scale.
"census"each index is the absolute abundance of a subpopulation (colony, area). The total population is
the sum of the components. With components, several series can observe the same subpopulation: the first
series of a component is the absolute count (q = 1), the others get a q.
"mixed.trends"as census (one state per index), but the components are relative trends of different
sites and the population trend is their geometric mean (JARA's mixed.trends).
In relative models the anchor index is moved to the first column (as in JARA), so that it is the reference for q.
Zeros are replaced by 0.1 times the index mean (as in JARA) or set to NA (zeros = "na"). Leading years without any
observation are dropped.
jr2_data( I, se = NULL, model.type = c("relative", "census", "mixed.trends"), components = NULL, anchor = NULL, start.year = NA, end.year = NA, se.na = 0.2, zeros = c("replace", "na") )jr2_data( I, se = NULL, model.type = c("relative", "census", "mixed.trends"), components = NULL, anchor = NULL, start.year = NA, end.year = NA, se.na = 0.2, zeros = c("replace", "na") )
I |
indices in any of these formats: a data.frame(year, index1, index2, ...) (JARA and JABBA format); |
se |
optional data.frame(year, se1, se2, ...) of log-scale standard errors with the columns of |
model.type |
|
components |
census only: component (subpopulation) name of each index; default one component per index |
anchor |
optional index name(s) whose q is fixed at 1 (one per component) |
start.year, end.year
|
optional subset of years |
se.na |
SE used where an index value has no SE (only if |
zeros |
|
object of class jr2data
data(jrdat) d <- jr2_data(jrdat$Afr_penguin$I, model.type = "census") ddata(jrdat) d <- jr2_data(jrdat$Afr_penguin$I, model.type = "census") d
Runs test p-value, 3-sigma limits and RMSE for each index.
jr2_diags(fit, type = c("osa", "ordinary"), mixing = "less")jr2_diags(fit, type = c("osa", "ordinary"), mixing = "less")
fit |
a |
type |
|
mixing |
see |
data.frame
Computes, for every posterior draw, the change in population size over the assessment window of
years and the probability of each category:
past reduction: the window ends in the last data year. If the series is shorter than W, the window starts in the first year and ends in the future, using the projection (as in JARA).
(on request) projected reduction: from the last data year to W years ahead (at most max.future).
(on request) any window of length W that includes the last data year (past and future): the window ending 0 to W years after the last data year with the largest median decline.
The window length follows window in jara2(): exactly W years ("iucn", default) or round(3 GL) - 1 years
between the end points ("jara", as JARA 1.x, which reproduces its results).
With GL.cv > 0 in jara2() each draw has its own GL and window. The status is the most probable category
(rule = "max", JARA), the category of the median change ("median"), or the highest category whose cumulative
probability reaches p.cut ("cumulative").
jr2_iucn( fit, criteria = c("A2", "A1"), GL = NULL, NT = FALSE, rule = c("max", "median", "cumulative"), p.cut = 0.5 )jr2_iucn( fit, criteria = c("A2", "A1"), GL = NULL, NT = FALSE, rule = c("max", "median", "cumulative"), p.cut = 0.5 )
fit |
a |
criteria |
any of |
GL |
optional generation length to override the fit's (draws are rescaled) |
NT |
add a Near Threatened band |
rule |
status rule, see Details |
p.cut |
probability for |
object of class jr2iucn: table (one row per criterion) and change (draws, % change)
data(jrdat) fit <- jara2(jrdat$Yellowspot_skate$I, jrdat$Yellowspot_skate$SE, GL = 12, silent = TRUE) jr2_iucn(fit, c("A2", "A1"), NT = TRUE)data(jrdat) fit <- jara2(jrdat$Yellowspot_skate$I, jrdat$Yellowspot_skate$SE, GL = 12, silent = TRUE) jr2_iucn(fit, c("A2", "A1"), NT = TRUE)
A joint index from a relative model, as in JARA: the state-space trend plus, for each year, the mean residual of
the indices observed in that year (log scale), applied to every posterior draw of the trend, so the joint index
carries the uncertainty of the trend. With weights = "precision" (default) the residuals are weighted by
1/observation variance, which equals the precision-weighted mean of the q-scaled observations and reproduces the
hierarchical index of Conn (2010); weights = "equal" gives the unweighted mean residual of JARA 1.x.
Relative models only.
jr2_jointindex( fit, scale = c("mean", "none"), weights = c("precision", "equal") )jr2_jointindex( fit, scale = c("mean", "none"), weights = c("precision", "equal") )
fit |
a |
scale |
|
weights |
|
data.frame(year, trend, lci, uci, index, index.lci, index.uci, log.se, n)
Conn, P.B. (2010). Hierarchical analysis of multiple noisy abundance indices. Canadian Journal of Fisheries and Aquatic Sciences 67: 108-120.
Support tool for setting GL and GL.cv in jara2(). Both methods build a Leslie matrix by age with survival
and return the generation length as the mean age of spawners in the unfished population (the IUCN
definition), the maximum intrinsic rate of increase from the dominant eigenvalue
, and the persistence of process error (JABBA3::jb3_rho_gt()).
jr2_lifehistory( x, method = NULL, h = NULL, S0 = NULL, sex.ratio = 0.5, M.cv = 0, h.sd = 0, nsim = 500, seed = 1, ... )jr2_lifehistory( x, method = NULL, h = NULL, S0 = NULL, sex.ratio = 0.5, M.cv = 0, h.sd = 0, nsim = 500, seed = 1, ... )
x |
for |
method |
|
h |
steepness for |
S0 |
first-year survival for |
sex.ratio |
share of females among offspring for |
M.cv |
lognormal CV of natural mortality for the Monte Carlo (0: point estimate) |
h.sd |
SD of steepness ( |
nsim |
number of Monte Carlo draws (used when |
seed |
random seed |
... |
passed to |
method = "steepness" (bony fish; JABBA3::jb3_leslie()): reproduction is spawning biomass per recruit
(weight x maturity), and recruitment at low spawning biomass follows the slope at the origin of the
Beverton-Holt relationship, , with the unfished spawning biomass per recruit
(SPR0). The absolute scale of weight or fecundity cancels, so steepness sets .
method = "fecundity" (elasmobranchs and other species with known fecundity): the first row of the Leslie
matrix is the number of female offspring per female at age that survive their first year,
, with fecundity (e.g. pups per female per year, divided by the breeding
interval), maturity , the share of females and first-year survival . No steepness is
needed. The implied steepness , with and
the unfished offspring per recruit, is returned for comparison with steepness priors.
Uncertainty in natural mortality (and steepness or first-year survival) is propagated by Monte Carlo, which gives
GL.cv.
list of class jr2lh: GL (median generation length), GL.cv (SD of log GL), rmax, rho, method,
summary (median and 95% interval of r, GL, lambda, SPR0 or offspring per recruit, and the implied steepness
for "fecundity") and draws
Cortés, E. (2002). Incorporating uncertainty into demographic modeling: application to shark populations and their conservation. Conservation Biology 16: 1048-1062.
# bony fish: steepness and SPR0 lh <- c(linf = 55.7, k = 0.08, M = 0.162, L50 = 31.2, a = 0.0047, b = 3.15, s = 0.75) jr2_lifehistory(lh, M.cv = 0.2, h.sd = 0.1, nsim = 200) # shark: 8 pups every second year from age 12, first-year survival 0.6 bio <- data.frame(age = 0:30, M = 0.12, mat = plogis((0:30 - 12)/1.5), fec = c(0, rep(8/2, 30))) jr2_lifehistory(bio, S0 = 0.6, M.cv = 0.2, nsim = 200)# bony fish: steepness and SPR0 lh <- c(linf = 55.7, k = 0.08, M = 0.162, L50 = 31.2, a = 0.0047, b = 3.15, s = 0.75) jr2_lifehistory(lh, M.cv = 0.2, h.sd = 0.1, nsim = 200) # shark: 8 pups every second year from age 12, first-year survival 0.6 bio <- data.frame(age = 0:30, M = 0.12, mat = plogis((0:30 - 12)/1.5), fec = c(0, rep(8/2, 30))) jr2_lifehistory(bio, S0 = 0.6, M.cv = 0.2, nsim = 200)
Fits the core of a JARA2 model (one latent trend, several relative indices) in the configuration that equals the univariate random walk with drift of MARSS (Holmes et al. 2012), and fits that MARSS model to the same data:
The JARA2 run uses flat priors, no bias correction (so ), no sampling SEs (fixed.obsE = 0) and one
observation SD per index (variance.weighting = "model"). Both start from the same diffuse prior on the first
state, , so both maximise the same marginal likelihood (the Laplace approximation of RTMB is exact
for this linear Gaussian model) and the estimates, log-likelihood and smoothed states should agree to numerical
precision. Use it to show that the state-space core is standard; what JARA2 adds is the observation model with
known SEs, census and multistock totals, time blocks and covariates, and the Red List decision layer.
jr2_marss(fit, GL = NULL, ..., maxit = 5000, silent = TRUE) jrplot_marss(x)jr2_marss(fit, GL = NULL, ..., maxit = 5000, silent = TRUE) jrplot_marss(x)
fit |
a |
GL |
generation length for the Red List output of the JARA2 run (taken from |
... |
further arguments to |
maxit |
maximum iterations for MARSS |
silent |
suppress messages |
x |
a |
list of class jr2marss: table (parameter, JARA2, MARSS), logLik (MARSS log-likelihood at its own
estimates and at the JARA2 estimates), states (year, JARA2, MARSS smoothed log states, centred), max.diff,
jara2 (the JARA2 fit in MARSS configuration, a full fit with Red List output: plot(), jrplot_iucn(), ...)
and marss (the MARSS fit)
Holmes, E.E., Ward, E.J. and Wills, K. (2012). MARSS: multivariate autoregressive state-space models for analyzing time-series data. The R Journal 4, 11-19. doi:10.32614/RJ-2012-002
if (requireNamespace("MARSS", quietly = TRUE)) { bm <- jr2_marss(jrdat$StripedMarlin_IO_CPUE$I, GL = 4.2) bm jrplot_marss(bm) }if (requireNamespace("MARSS", quietly = TRUE)) { bm <- jr2_marss(jrdat$StripedMarlin_IO_CPUE$I, GL = 4.2) bm jrplot_marss(bm) }
For model.type = "mixed.trends" (or census) fits: combines the component trajectories into a joint indicator for
each posterior draw, as JARA's mixed-trend option used for the CFP stock status indicators (STECF 2022) and the
Northeast Atlantic B/BMSY and F/FMSY trajectories (Winker et al. 2026). Each component is, for example, the B/BMSY
series of one stock, fitted with q = 1 so that the states stay on the indicator scale.
jr2_mixed( fit, scale = c("geomean", "mean", "median"), bootstrap = TRUE, coverage = c("all", "observed"), backcast.na = NULL, threshold = NULL, direction = c("above", "below"), years = NULL, seed = 1 )jr2_mixed( fit, scale = c("geomean", "mean", "median"), bootstrap = TRUE, coverage = c("all", "observed"), backcast.na = NULL, threshold = NULL, direction = c("above", "below"), years = NULL, seed = 1 )
fit |
a |
scale |
|
bootstrap |
resample components in each draw |
coverage |
|
backcast.na |
optional year: components enter the indicator before this year only from their first observation |
threshold |
optional value(s); proportion of components above (or below) each |
direction |
|
years |
years to return (default the data years) |
seed |
random seed for the bootstrap |
With bootstrap = TRUE the components are resampled with replacement in each draw, so the uncertainty of the joint
indicator includes the variation among stocks as well as the estimation error of each stock. coverage = "observed"
leaves out a component in the years before its first and after its last observation (JARA's backcast.na), so the
indicator in a year only uses stocks assessed in that year; "all" uses the state-space predictions for missing years.
backcast.na = year (as JARA) leaves out a component only in years before both its first observation and the given
year, so later missing years are still filled by the state-space predictions.
With threshold the function also returns the proportion of components above the threshold (e.g. the proportion
of stocks with B/BMSY > 1, or with F/FMSY > 1).
for one fit, a list of class jr2mixed: trj (joint indicator by year: median, credible interval lci-uci, 50\
interval l50-u50, number of components n, and obs, the indicator of the observations of that year), prop
(proportion above each threshold, with the observed proportion obs, if thresholds are given), and the draws
(draws, prop.draws); for a list of fits, a named list of them (class jr2mixedlist) for jrplot_mixed()
data(jrdat) # census counts used here only to illustrate; mixed.trends fits use q = 1 indicator series f <- jara2(jrdat$Cape_gannet$I, model.type = "mixed.trends", GL = 18.3, fixed.obsE = 0.1, silent = TRUE) mx <- jr2_mixed(f, threshold = 10) jrplot_mixed(mx)data(jrdat) # census counts used here only to illustrate; mixed.trends fits use q = 1 indicator series f <- jara2(jrdat$Cape_gannet$I, model.type = "mixed.trends", GL = 18.3, fixed.obsE = 0.1, silent = TRUE) mx <- jr2_mixed(f, threshold = 10) jrplot_mixed(mx)
Weak priors that keep the posterior proper (needed for NUTS) and stop the variance terms collapsing to zero at the
posterior mode. Lognormal priors are given as c(median, log.sd).
jr2_priors( mu.sd = 10, sigma = c(0.1, 1.5), tau = c(0.1, 1.5), q.sd = 10, rho = c(0, 1), beta.sd = 1 )jr2_priors( mu.sd = 10, sigma = c(0.1, 1.5), tau = c(0.1, 1.5), q.sd = 10, rho = c(0, 1), beta.sd = 1 )
mu.sd |
SD of the normal prior (mean 0) on the mean annual rate of change (log scale); JARA used 31.6 |
sigma |
lognormal prior on the process SD (JARA: gamma(0.001, 0.001) on the precision) |
tau |
lognormal prior on the additional observation SD, where it is estimated |
q.sd |
SD of the normal prior (mean 0) on log q of non-anchor indices |
rho |
normal prior c(mean, sd) on the AR(1) coefficient on the logit scale of (rho + 1)/2, if it is estimated |
list of class jr2priors
jr2_priors(sigma = c(0.1, 2))jr2_priors(sigma = c(0.1, 2))
Diagnostics of the fitted process deviations of a one-component model, meant as a first check before trends or reference points are used for advice. Process error from outside the population (exogenous, e.g. environmental regimes) appears as shifts in the mean or variance of the deviations: productivity, and hence any reference point, changes over time. Process error from the population's own dynamics (endogenous, e.g. density dependence that the random walk ignores) depends on the state and is autocorrelated: treating it as noise overstates recovery rates and understates risk. The diagnostics are computed per posterior draw:
regimes in the mean (STARS, jr2_stars()), drawn as boxes of mean +- 2 SD per regime;
lag-1 autocorrelation of the deviations, before and after removing the regime means: autocorrelation that disappears once the regimes are removed points to exogenous step changes;
slope of the deviation on the (centred) log state of the previous year, minus the mean slope of a pure random walk of the same length (a random walk regressed on its own level gives a negative slope, the Dickey-Fuller bias): a corrected slope below zero points to compensation (endogenous). In simulations (50 years) P(< 0) exceeded 0.95 for 85% of Gompertz series (compensation 0.3) and for 20% of random walks, so treat it as a screen and confirm with a model that includes density dependence;
ratio of the SD of the deviations in the last and first regime (a change in variability);
correlation with each covariate in env (e.g. environmental indices), at lag env.lag.
The smoothed deviations of a state-space model are themselves slightly autocorrelated, and the two explanations are not exclusive, so read the results as a screen, not a test.
jr2_procdiag(fit, env = NULL, env.lag = 0, L = 10, p = 0.1, seed = 1) jrplot_procdiag(x, ...)jr2_procdiag(fit, env = NULL, env.lag = 0, L = 10, p = 0.1, seed = 1) jrplot_procdiag(x, ...)
fit |
a |
env |
optional data.frame(year, covariate1, ...) of covariates |
env.lag |
lag (years) of the covariates relative to the deviations (default 0) |
L, p
|
passed to |
seed |
random seed for the random-walk reference of the slope |
x |
a |
... |
passed to |
list of class jr2procdiag: summary (median, interval and probability per diagnostic), series (year,
deviation quantiles, lagged state, regime), regimes, acf (autocorrelation by lag across draws), stars, env and the draws of each statistic
data(jrdat) s <- jrdat$SmoothhoundShark fit <- jara2(s$I, s$SE, GL = 13.7, silent = TRUE) pd <- jr2_procdiag(fit, L = 6) pd jrplot_procdiag(pd)data(jrdat) s <- jrdat$SmoothhoundShark fit <- jara2(s$I, s$SE, GL = 13.7, silent = TRUE) pd <- jr2_procdiag(fit, L = 6) pd jrplot_procdiag(pd)
Refits the model with the last peels years removed (all settings unchanged, including GL), as JARA's
jara_hindcast(). Returns the population trajectories, the IUCN tables of each peel, Mohn's rho of the population
trajectory and the hindcast cross-validation of one-step-ahead index predictions (MASE; Kell et al. 2021). MASE < 1
means the model predicts the index better than a naive random walk (last observed value).
jr2_retro(fit, peels = 1:5, ndraws = 1000)jr2_retro(fit, peels = 1:5, ndraws = 1000)
fit |
a |
peels |
number of years removed, e.g. 1:5 |
ndraws |
draws per refit (fewer than the main fit is enough) |
object of class jr2retro
data(jrdat) fit <- jara2(jrdat$Yellowspot_skate$I, jrdat$Yellowspot_skate$SE, GL = 12, silent = TRUE) rt <- jr2_retro(fit, 1:5) rt$rho jrplot_retro(rt)data(jrdat) fit <- jara2(jrdat$Yellowspot_skate$I, jrdat$Yellowspot_skate$SE, GL = 12, silent = TRUE) rt <- jr2_retro(fit, 1:5) rt$rho jrplot_retro(rt)
The posterior of the change over the preceding years for every possible end year, from the
first year a full window is available to W years after the last data year (end years after the last data year use
the projection). This shows A2 (end = last data year), A3 (start = last data year) and every A4 window in one
view, and how the assessment would have looked in earlier years given the full series.
jr2_rolling(fit, criterion = "A2")jr2_rolling(fit, criterion = "A2")
fit |
a |
criterion |
IUCN criterion for the category probabilities |
data.frame(end, start, change, lci, uci, projected, category probabilities)
Sequential t-test analysis of regime shifts (STARS; Rodionov 2004), in the version of Szuwalski et al. (search
resumes one regime length after a confirmed shift, no Huber weights), applied to the fitted process deviations (for
models with one component; the deviations of the annual rate of change from its mean) or to the annual rate of
change of the population total (census and mixed models). A shift in the mean of these series is a change in the
rate of change, so the detected shift years suggest where to set timeblock in jara2().
jr2_stars(fit, L = 10, p = 0.1, sig = NULL, ndraws = 500, on = NULL) jrplot_stars(x, ...)jr2_stars(fit, L = 10, p = 0.1, sig = NULL, ndraws = 500, on = NULL) jrplot_stars(x, ...)
fit |
a |
L |
minimum regime length (cut-off length, years; default 10, at most a third of the series) |
p |
significance level of the t-test (two-sided); ignored if |
sig |
critical t value (default |
ndraws |
number of posterior draws for |
on |
|
x |
a |
... |
passed to |
STARS is run on the posterior median series, and on ndraws posterior draws to give the probability of a shift
starting in each year (P.shift, and within +-1 year of each detected shift, P.shift.pm1), which shows how firm
each change point is. The posterior median is smoother than the data, so the t-test on it finds shifts easily: treat
the suggested years as exploratory, weigh them by their support across draws and by prior knowledge (e.g. the year of
a management measure), and note that effects estimated for breaks chosen from the same data are overstated.
list of class jr2stars: shifts (start year of each new regime, suggested timeblock year = start - 1,
P.shift of that year and P.shift.pm1 within +-1 year), regimes (start, end, mean, sd), series (year, median, lci, uci, P.shift),
timeblock (suggested years) and the settings
Rodionov, S.N. (2004). A sequential algorithm for testing climate regime shifts. Geophysical Research Letters 31, L09204. doi:10.1029/2004GL019448
data(jrdat) s <- jrdat$SmoothhoundShark fit <- jara2(s$I, s$SE, GL = 13.7, silent = TRUE) st <- jr2_stars(fit, L = 6) st$shifts jrplot_stars(st)data(jrdat) s <- jrdat$SmoothhoundShark fit <- jara2(s$I, s$SE, GL = 13.7, silent = TRUE) st <- jr2_stars(fit, L = 6) st$shifts jrplot_stars(st)
As JARA's jrplot_state(): the posterior of the population in the last data year (current) and at the end of the
projection relative to the mean of the reference years (default the first three years), with the probability that
the projected population falls below extinction (quasi-extinction relative to the reference).
jr2_state(fit, ref.yr = NULL, prj.yr = NULL, extinction = 0.01) jrplot_state(fit, projected = TRUE, ...)jr2_state(fit, ref.yr = NULL, prj.yr = NULL, extinction = 0.01) jrplot_state(fit, projected = TRUE, ...)
fit |
a |
ref.yr |
reference year(s); default the first three years |
prj.yr |
projected year; default 3 GL after the last data year (max(3 GL, 10) years, at most 100) |
extinction |
quasi-extinction threshold relative to the reference |
projected |
also show the projected state |
... |
passed to |
jr2_state(): list with state (median and credible interval of the current and projected state),
prob.extinct and the draws; jrplot_state(): a ggplot
data(jrdat) fit <- jara2(jrdat$Yellowspot_skate$I, jrdat$Yellowspot_skate$SE, GL = 12, silent = TRUE) jr2_state(fit)$state jrplot_state(fit)data(jrdat) fit <- jara2(jrdat$Yellowspot_skate$I, jrdat$Yellowspot_skate$SE, GL = 12, silent = TRUE) jr2_state(fit)$state jrplot_state(fit)
The change in the mean rate of change across each timeblock year (the "effect", as JARA's mean.dr): the rate
of the block after minus the rate of the block before, on the log scale, expressed as % change in the annual rate,
, with its credible interval and the probability of a positive effect (a higher
rate of change after the break, e.g. after a management measure). For models with one component (relative indices)
the rates are the estimated drifts of the blocks (JARA's effect); for census and mixed models, with one drift per
component, they are the mean rates of change of the population total in each block.
jrplot_tbeffect() plots the posterior of each effect with its median and P(effect > 0).
jr2_tbeffect(fit) jrplot_tbeffect(fit)jr2_tbeffect(fit) jrplot_tbeffect(fit)
fit |
a |
jr2_tbeffect(): data.frame(break.year, before, after, effect, lci, uci, P.positive) with the draws (%) in
attribute "draws"; jrplot_tbeffect(): a ggplot
data(jrdat) s <- jrdat$SmoothhoundShark fit <- jara2(s$I, s$SE, GL = 13.7, timeblock = c(1998, 2008), silent = TRUE) jr2_tbeffect(fit) jrplot_tbeffect(fit)data(jrdat) s <- jrdat$SmoothhoundShark fit <- jara2(s$I, s$SE, GL = 13.7, timeblock = c(1998, 2008), silent = TRUE) jr2_tbeffect(fit) jrplot_tbeffect(fit)
For a fit with timeblock year(s): the mean annual rate of change of the population (%) in each block, from the
posterior draws of the population total (the mean log change between the first and last year of the block), with
its credible interval and the probability of an increase, and the probability that the rate increased from each
block to the next (e.g. after a management measure, as in Pacoureau et al. 2023). Without time blocks the whole
series is one block.
jr2_timeblock(fit)jr2_timeblock(fit)
fit |
a |
data.frame(block, start, end, rate, lci, uci, P.increase, P.faster) with the draws in attribute "draws"
data(jrdat) s <- jrdat$SmoothhoundShark fit <- jara2(s$I, s$SE, GL = 13.7, timeblock = c(1998, 2008), silent = TRUE) jr2_timeblock(fit)data(jrdat) s <- jrdat$SmoothhoundShark fit <- jara2(s$I, s$SE, GL = 13.7, timeblock = c(1998, 2008), silent = TRUE) jr2_timeblock(fit)
jrdat: the example datasets of JARA, each a list with I (data.frame(year, indices)) and, for relative indices,
SE (log-scale standard errors): Afr_penguin, Cape_gannet, Mountain_zebra (census counts by colony or
reserve), StripedMarlin_IO_CPUE, Bluemarlin_Atl_CPUE, Bluemarlin_ICCAT, SmoothhoundShark,
Yellowspot_skate (relative indices). jara.examples: the settings used in the JARA examples (generation length,
model type).
lists and a data.frame
JARA (https://github.com/Henning-Winker/JARA)
Sensitivity plots for a (named) list of jara2() fits, in the style of JABBA3::jbplot_ensemble():
"trajectory" overlays the estimated population trajectories (projections dotted), and "change" overlays the
posteriors of the change over the assessment window on the IUCN category bands, with each run's status and its
probability in the legend. Runs are told apart by colour and line type, so overlapping runs stay visible.
jrplot_compare( fits, type = c("trajectory", "change", "both"), criterion = NULL, ci = c("none", "ribbon"), scale = c("none", "mean"), projection = TRUE, colours = NULL )jrplot_compare( fits, type = c("trajectory", "change", "both"), criterion = NULL, ci = c("none", "ribbon"), scale = c("none", "mean"), projection = TRUE, colours = NULL )
fits |
named list of |
type |
|
criterion |
criterion for |
ci |
add credible intervals to the trajectories ( |
scale |
|
projection |
show the projected years in the trajectories ( |
colours |
optional colours (named by run, or recycled); default the JABBA3 palette as in
|
a ggplot object (patchwork for "both")
data(jrdat) bm <- jrdat$Bluemarlin_Atl_CPUE runs <- list(model = jara2(bm$I, bm$SE, GL = 7.3, silent = TRUE), equal = jara2(bm$I, bm$SE, GL = 7.3, variance.weighting = "equal", silent = TRUE), GL1 = jara2(bm$I, bm$SE, GL = 7.3, proj.r = "GL1", silent = TRUE)) jrplot_compare(runs, type = "both")data(jrdat) bm <- jrdat$Bluemarlin_Atl_CPUE runs <- list(model = jara2(bm$I, bm$SE, GL = 7.3, silent = TRUE), equal = jara2(bm$I, bm$SE, GL = 7.3, variance.weighting = "equal", silent = TRUE), GL1 = jara2(bm$I, bm$SE, GL = 7.3, proj.r = "GL1", silent = TRUE)) jrplot_compare(runs, type = "both")
Estimated effect of each covariate on the annual rate of change (log units per year), with credible bands, over the observed range of the covariate (rug: observed values).
jrplot_covariates(fit, n.grid = 60)jrplot_covariates(fit, n.grid = 60)
fit |
a |
n.grid |
number of grid points |
a ggplot object
set.seed(11); yr <- 1976:2020 env <- data.frame(year = yr, SST = as.numeric(arima.sim(list(ar = 0.6), 45))) x <- cumsum(c(0, -0.02 + 0.1*tanh(2*env$SST[-1]) + rnorm(44, 0, 0.05))) I <- data.frame(year = yr, cpue = exp(x + rnorm(45, 0, 0.1))) fit <- jara2(I, GL = 6, covariates = env, cov.form = "asymptotic", silent = TRUE) jrplot_covariates(fit)set.seed(11); yr <- 1976:2020 env <- data.frame(year = yr, SST = as.numeric(arima.sim(list(ar = 0.6), 45))) x <- cumsum(c(0, -0.02 + 0.1*tanh(2*env$SST[-1]) + rnorm(44, 0, 0.05))) I <- data.frame(year = yr, cpue = exp(x + rnorm(45, 0, 0.1))) fit <- jara2(I, GL = 6, covariates = env, cov.form = "asymptotic", silent = TRUE) jrplot_covariates(fit)
Drawn by JABBA3::jbplot_hcxval(): for each index, the observations (open circles), the reference fit (black), and
the fit of each retrospective peel up to the first year it did not see, with that one-step-ahead prediction marked,
and the mean absolute scaled error (MASE; Kell et al. 2021) in the panel label. MASE < 1: the model predicts the
next year of the index better than the naive prediction (the last observed value).
jrplot_hcxval(rt, nyears = 5, indices = NULL, ncol = NULL)jrplot_hcxval(rt, nyears = 5, indices = NULL, ncol = NULL)
rt |
a |
nyears |
years before the hindcast horizon to show |
indices |
optional subset of indices |
ncol |
facet columns |
a ggplot (MASE table in attribute "mase")
data(jrdat) fit <- jara2(jrdat$Yellowspot_skate$I, jrdat$Yellowspot_skate$SE, GL = 12, silent = TRUE) rt <- jr2_retro(fit, 1:5) jrplot_hcxval(rt)data(jrdat) fit <- jara2(jrdat$Yellowspot_skate$I, jrdat$Yellowspot_skate$SE, GL = 12, silent = TRUE) rt <- jr2_retro(fit, 1:5) jrplot_hcxval(rt)
jrplot_mixed(): the joint indicator of one or several runs (quantities) with its 50\
the observed values of each year (points), as the indicator plots of Winker et al. (2026). Runs are given as a named
list of jr2_mixed() objects, or as the output of jr2_mixed() for a list of fits, and are colour-coded.
type = "median" plots the joint indicators (e.g. F/FMSY and B/BMSY), type = "prob" the proportion of components on
the chosen side of each run's threshold (e.g. F < FMSY and B > BMSY, set by direction in jr2_mixed()).
jrplot_mixed( mx, type = c("both", "median", "prob", "indicator", "proportion"), ref = NULL, obs = TRUE, cols = NULL, ... )jrplot_mixed( mx, type = c("both", "median", "prob", "indicator", "proportion"), ref = NULL, obs = TRUE, cols = NULL, ... )
mx |
a |
type |
|
ref |
reference line(s) for |
obs |
show the observed values |
cols |
optional colours, one per run |
... |
unused |
a ggplot, or a list of two
data(jrdat) f <- jara2(jrdat$Cape_gannet$I, model.type = "mixed.trends", GL = 18.3, fixed.obsE = 0.1, silent = TRUE) mx <- jr2_mixed(list(above = f, below = f), threshold = 10, direction = c("above", "below")) jrplot_mixed(mx, type = "prob")data(jrdat) f <- jara2(jrdat$Cape_gannet$I, model.type = "mixed.trends", GL = 18.3, fixed.obsE = 0.1, silent = TRUE) mx <- jr2_mixed(list(above = f, below = f), threshold = 10, direction = c("above", "below")) jrplot_mixed(mx, type = "prob")
Densities of the prior (grey) and the posterior (blue) of the process SD and, where estimated, the additional
observation SD (as JABBA3::jbplot_priorpost()), with the ratio of posterior to prior median (PPMR) and of
posterior to prior variance on the log scale (PPVR). A posterior equal to the prior (PPVR near 1) means the data carry
little information on that parameter; a posterior piled up at the lower end of the prior means the variance is
weakly identified and the prior holds it away from zero.
jrplot_priorpost(fit)jrplot_priorpost(fit)
fit |
a |
a ggplot; the table in attribute "table"
data(jrdat) fit <- jara2(jrdat$SmoothhoundShark$I, jrdat$SmoothhoundShark$SE, GL = 13.7, silent = TRUE) jrplot_priorpost(fit)data(jrdat) fit <- jara2(jrdat$SmoothhoundShark$I, jrdat$SmoothhoundShark$SE, GL = 13.7, silent = TRUE) jrplot_priorpost(fit)
jrplot_retro(): population trajectories of the retrospective peels with Mohn's rho (as JABBA3::jbplot_retro()).
jrplot_retroiucn(): category probabilities by terminal year of each peel.
jrplot_retro(rt, ...) jrplot_retroiucn(rt, criterion = NULL, style = c("density", "bars"), ...)jrplot_retro(rt, ...) jrplot_retroiucn(rt, criterion = NULL, style = c("density", "bars"), ...)
rt |
a |
... |
unused |
criterion |
IUCN criterion |
style |
|
a ggplot
Relative models: the population trend with the q-scaled indices coloured by index (as the B panel of
JABBA3::jabbaplot3()). Census and mixed models: the trajectory of each component with its observations, colour-coded
by component, on the absolute scale, with credible intervals at cr (default 90%); the y-axis is set by the data
and the medians, so wide intervals in years without observations do not dominate.
jrplot_trjobs(fit, log = FALSE, cr = 0.9, ...)jrplot_trjobs(fit, log = FALSE, cr = 0.9, ...)
fit |
a |
log |
log scale |
cr |
credibility of the component intervals (census and mixed models) |
... |
unused |
a ggplot
Plots of the population trajectory and the Red List assessment, in the JABBA3 style. The index and trend
diagnostics are the JABBA3 functions (jrplots_jb3); jaraplot2() (and plot(fit)) combines both.
jrplot_indices(fit, log = FALSE, ...) jrplot_poptrj(fit, projection = TRUE, obs = TRUE, stacked = FALSE, ...) jrplot_components(fit, projection = FALSE, overlay = FALSE, ...) jrplot_rate(fit, ...) jrplot_changes(fit, ...) jrplot_procdev(fit, ...) jrplot_iucn( fit, criterion = NULL, NT = FALSE, labels = c("bands", "legend"), ... ) jrplot_criteria(fit, NT = FALSE, ...) jrplot_rolling(fit, criterion = "A2", ...) jrplot_timeblock(fit, ...)jrplot_indices(fit, log = FALSE, ...) jrplot_poptrj(fit, projection = TRUE, obs = TRUE, stacked = FALSE, ...) jrplot_components(fit, projection = FALSE, overlay = FALSE, ...) jrplot_rate(fit, ...) jrplot_changes(fit, ...) jrplot_procdev(fit, ...) jrplot_iucn( fit, criterion = NULL, NT = FALSE, labels = c("bands", "legend"), ... ) jrplot_criteria(fit, NT = FALSE, ...) jrplot_rolling(fit, criterion = "A2", ...) jrplot_timeblock(fit, ...)
fit |
a |
log |
plot on log scale |
... |
unused |
projection |
show the projection years |
obs |
show the q-scaled observations (relative models) |
stacked |
census models: the component trajectories as stacked areas under the total (data years) |
overlay |
|
criterion |
IUCN criterion |
NT |
show the Near Threatened band |
labels |
|
jrplot_indices(): observed indices with 95\
jrplot_poptrj(): population trajectory with credible interval, projection and the 1-3 GL marks back from the last data year; relative models show the q-scaled observations by index
jrplot_components(): census and mixed models: trajectory of each component with its observations
jrplot_rate(): annual rate of change of the population by year
jrplot_changes(): posteriors of the mean annual rate of change over all years and the last 1, 2 and 3 GL
jrplot_procdev(): process deviations
jrplot_iucn(): posterior of the change over the assessment window on the IUCN category bands
jrplot_criteria(): category probabilities for each criterion evaluated, with the status
jrplot_rolling(): change over the assessment window for every end year (jr2_rolling()) on the IUCN bands
jrplot_timeblock(): posteriors of the mean annual rate of change in each time block (jr2_timeblock()); block
boundaries are marked in jrplot_poptrj() and jrplot_rate(), which also shows the block means (dark red)
a ggplot
data(jrdat) fit <- jara2(jrdat$Yellowspot_skate$I, jrdat$Yellowspot_skate$SE, GL = 12, silent = TRUE) jrplot_poptrj(fit) jrplot_iucn(fit) jrplot_rolling(fit)data(jrdat) fit <- jara2(jrdat$Yellowspot_skate$I, jrdat$Yellowspot_skate$SE, GL = 12, silent = TRUE) jrplot_poptrj(fit) jrplot_iucn(fit) jrplot_rolling(fit)
The index and trend plots of JARA, drawn by the JABBA3 functions on a jara2() fit (through jr2_as_jb3trend()),
so JARA2 and JABBA3 graphics are the same. Names follow JARA 1.x:
jrplot_trjfit() |
JABBA3::jbplot_trend(): q-scaled indices with the trend (relative); component states and total (census) |
jrplot_fits() |
JABBA3::jbplot_fits(): fits to each index with credible and predictive intervals |
jrplot_logfits() |
jbplot_fits(log = TRUE)
|
jrplot_residuals() |
JABBA3::jbplot_residuals(): residuals by year, OSA by default |
jrplot_runstest() |
JABBA3::jbplot_runs(): runs tests with 3-sigma limits |
jrplot_PPC() |
JABBA3::jbplot_ppc(): posterior predictive check |
jrplot_jointindex() |
JABBA3::jbplot_jointindex(): joint index |
jrplot_q() |
JABBA3::jbplot_q(): catchability relative to the reference index |
jrplot_indexcor() |
JABBA3::jbplot_indexcor(): correlation of the log indices |
jrplot_noise() |
JABBA3::jbplot_noise(): observation and process noise by index |
jr_qtable(), jr_noise() |
JABBA3::jb3_qtable(), JABBA3::jb3_noise()
|
jrplot_trjfit(fit, ...) jrplot_fits(fit, log = FALSE, years = c("observed", "all"), ...) jrplot_logfits(fit, years = c("observed", "all"), ...) jrplot_residuals(fit, type = c("osa", "ordinary"), ...) jrplot_runstest(fit, type = c("osa", "ordinary"), ...) jrplot_PPC(fit, ...) jrplot_jointindex(fit, ...) jrplot_q(fit, ...) jrplot_indexcor(fit, ...) jrplot_noise(fit, ...) jr_qtable(fit, ...) jr_noise(fit, ...)jrplot_trjfit(fit, ...) jrplot_fits(fit, log = FALSE, years = c("observed", "all"), ...) jrplot_logfits(fit, years = c("observed", "all"), ...) jrplot_residuals(fit, type = c("osa", "ordinary"), ...) jrplot_runstest(fit, type = c("osa", "ordinary"), ...) jrplot_PPC(fit, ...) jrplot_jointindex(fit, ...) jrplot_q(fit, ...) jrplot_indexcor(fit, ...) jrplot_noise(fit, ...) jr_qtable(fit, ...) jr_noise(fit, ...)
fit |
a |
... |
passed to the JABBA3 function |
log |
plot on log scale |
years |
|
type |
residual type: |
a ggplot (tables for jr_qtable(), jr_noise())
data(jrdat) fit <- jara2(jrdat$Yellowspot_skate$I, jrdat$Yellowspot_skate$SE, GL = 12, silent = TRUE) jrplot_fits(fit) jrplot_fits(fit, years = "all") jrplot_runstest(fit)data(jrdat) fit <- jara2(jrdat$Yellowspot_skate$I, jrdat$Yellowspot_skate$SE, GL = 12, silent = TRUE) jrplot_fits(fit) jrplot_fits(fit, years = "all") jrplot_runstest(fit)
The marginal log-likelihood of the index data, with the latent states integrated out (Laplace approximation; exact
for the Gaussian JARA2 model), evaluated at the mode and with the prior densities of the parameters removed. The
first state keeps its diffuse prior, as the initial-state variance V0 in MARSS. df counts the estimated
parameters that enter the likelihood (drift per block, process and observation SDs, catchabilities, AR(1),
covariate effects). stats::AIC() and stats::BIC() then work on JARA2 fits; jr2_aic() compares several.
## S3 method for class 'jara2' logLik(object, ...)## S3 method for class 'jara2' logLik(object, ...)
object |
a |
... |
unused |
object of class logLik
A grid of panels, as JABBA3::jabbaplot3(). type = "full" (2 x 3): population trajectory, rate of change over
all years and the last 1-3 GL, current and projected state relative to the first years / trend with the q-scaled
indices (relative models) or the component trajectories with their observations (census and mixed models), OSA
residuals and the IUCN plot. type = "simple" (2 x 2): population trajectory (with the q-scaled indices for
relative models), rate of change, state and the IUCN plot. For census models the population panel shows the
component trajectories as stacked areas under the total (its legend identifies the colours of the components panel).
plot(fit) calls jaraplot2(fit).
## S3 method for class 'jara2' plot(x, ...) jaraplot2( fit, type = c("full", "simple"), criterion = NULL, panels = NULL, ncol = NULL, base_size = 9 )## S3 method for class 'jara2' plot(x, ...) jaraplot2( fit, type = c("full", "simple"), criterion = NULL, panels = NULL, ncol = NULL, base_size = 9 )
x |
a |
... |
passed to |
fit |
a |
type |
|
criterion |
IUCN criterion of the IUCN panel ( |
panels |
panel names, in order: any of |
ncol |
number of columns |
base_size |
font size |
a patchwork (or a list of ggplots if patchwork is not installed)
data(jrdat) fit <- jara2(jrdat$Yellowspot_skate$I, jrdat$Yellowspot_skate$SE, GL = 12, silent = TRUE) jaraplot2(fit) jaraplot2(fit, type = "simple", criterion = "A1")data(jrdat) fit <- jara2(jrdat$Yellowspot_skate$I, jrdat$Yellowspot_skate$SE, GL = 12, silent = TRUE) jaraplot2(fit) jaraplot2(fit, type = "simple", criterion = "A1")
Summary of a JARA2 fit
## S3 method for class 'jara2' summary(object, ...)## S3 method for class 'jara2' summary(object, ...)
object |
a |
... |
unused |
list with parameters, IUCN table, rates of change, goodness of fit and residual diagnostics