Title: | Stochastic surplus Production model in Continuous-Time (SPiCT) |
---|---|
Description: | Fits a surplus production model to fisheries catch and biomass index data. |
Authors: | Martin Waever Pedersen [aut, cre, cph], Casper Willestofte Berg [aut], Tobias Karl Mildenberger [aut] , Alexandros Kokkalis [aut] |
Maintainer: | Martin Waever Pedersen <[email protected]> |
License: | GPL (>=3) |
Version: | 1.3.8 |
Built: | 2024-10-05 03:59:42 UTC |
Source: | https://github.com/DTUAqua/spict |
Check whether ACF of residuals is significant in any lags.
acf.signf(resid, lag.max = 4, return.p = FALSE)
acf.signf(resid, lag.max = 4, return.p = FALSE)
resid |
Vector of residuals. |
lag.max |
Only check from lag 1 until lag.max. |
return.p |
Return p-values of the calculated lags. |
This corresponds to plotting the ACF using acf() and checking whether any lags has an acf value above the CI limit.
Vector of TRUE and FALSE indicating whether significant lags were present. If return.p is TRUE then p-values are returned instead.
Add catch unit to label
add.catchunit(lab, cu)
add.catchunit(lab, cu)
lab |
Base label |
cu |
Catch unit as a character string |
Label with added catch unit
Add a legend explaining colors of points (vertical orientation)
add.col.legend()
add.col.legend()
Nothing.
Add a legend explaining colors of points (horizontal orientation)
add.col.legend.hor()
add.col.legend.hor()
Nothing.
Define management scenario
add.man.scenario( rep, scenarioTitle = "", maninterval = NULL, maneval = NULL, ffac = NULL, fabs = NULL, cfac = NULL, cabs = NULL, fractiles = list(catch = 0.5, bbmsy = 0.5, ffmsy = 0.5), breakpointB = 0, safeguardB = list(limitB = 0, prob = 0.95), intermediatePeriodCatch = NULL, intermediatePeriodCatchSDFac = 1, intermediatePeriodCatchList = NULL, ctol = 0.001, evalBreakpointB = 0, verbose = TRUE, dbg = 0, mancheck = TRUE ) get.TAC( rep, scenarioTitle = "", maninterval = NULL, maneval = NULL, ffac = NULL, fabs = NULL, cfac = NULL, cabs = NULL, fractiles = list(catch = 0.5, bbmsy = 0.5, ffmsy = 0.5), breakpointB = 0, safeguardB = list(limitB = 0, prob = 0.95), intermediatePeriodCatch = NULL, intermediatePeriodCatchSDFac = 1, intermediatePeriodCatchList = NULL, ctol = 0.001, evalBreakpointB = 0, verbose = TRUE, dbg = 0, mancheck = TRUE ) make.man.inp( rep, scenarioTitle = "", maninterval = NULL, maneval = NULL, ffac = NULL, fabs = NULL, cfac = NULL, cabs = NULL, fractiles = list(catch = 0.5, bbmsy = 0.5, ffmsy = 0.5), breakpointB = 0, safeguardB = list(limitB = 0, prob = 0.95), intermediatePeriodCatch = NULL, intermediatePeriodCatchSDFac = 1, intermediatePeriodCatchList = NULL, ctol = 0.001, evalBreakpointB = 0, verbose = TRUE, dbg = 0, mancheck = TRUE )
add.man.scenario( rep, scenarioTitle = "", maninterval = NULL, maneval = NULL, ffac = NULL, fabs = NULL, cfac = NULL, cabs = NULL, fractiles = list(catch = 0.5, bbmsy = 0.5, ffmsy = 0.5), breakpointB = 0, safeguardB = list(limitB = 0, prob = 0.95), intermediatePeriodCatch = NULL, intermediatePeriodCatchSDFac = 1, intermediatePeriodCatchList = NULL, ctol = 0.001, evalBreakpointB = 0, verbose = TRUE, dbg = 0, mancheck = TRUE ) get.TAC( rep, scenarioTitle = "", maninterval = NULL, maneval = NULL, ffac = NULL, fabs = NULL, cfac = NULL, cabs = NULL, fractiles = list(catch = 0.5, bbmsy = 0.5, ffmsy = 0.5), breakpointB = 0, safeguardB = list(limitB = 0, prob = 0.95), intermediatePeriodCatch = NULL, intermediatePeriodCatchSDFac = 1, intermediatePeriodCatchList = NULL, ctol = 0.001, evalBreakpointB = 0, verbose = TRUE, dbg = 0, mancheck = TRUE ) make.man.inp( rep, scenarioTitle = "", maninterval = NULL, maneval = NULL, ffac = NULL, fabs = NULL, cfac = NULL, cabs = NULL, fractiles = list(catch = 0.5, bbmsy = 0.5, ffmsy = 0.5), breakpointB = 0, safeguardB = list(limitB = 0, prob = 0.95), intermediatePeriodCatch = NULL, intermediatePeriodCatchSDFac = 1, intermediatePeriodCatchList = NULL, ctol = 0.001, evalBreakpointB = 0, verbose = TRUE, dbg = 0, mancheck = TRUE )
rep |
A result report as generated by running |
scenarioTitle |
Title of scenario (default: |
maninterval |
Two floats representing the start and end of the
management period. Example: |
maneval |
Time at which to evaluate model states. Example: |
ffac |
Factor to multiply current fishing mortality by (default: NULL). |
fabs |
Absolute fishing mortality for management period (default: NULL). |
cfac |
Factor to multiply current catch by (default: NULL). Please refer to the details for more information. |
cabs |
Absolute catch for the management period (default: NULL). |
fractiles |
List defining the fractiles of the 3 distributions of 'catch', 'bbmsy', and 'ffmsy'. By default (0.5) median is used for all 3 quantities. Please refer to the details for more information. |
breakpointB |
Breakpoints in terms of |
safeguardB |
List defining an optional precautionary buffer by means of
a biomass reference level relative to |
intermediatePeriodCatch |
Catch during intermediate period, e.g. last
year's TAC (default: |
intermediatePeriodCatchSDFac |
Factor for the multiplication of the standard deviation of the catch during the intermediate period (default: 1). Please refer to the details for more information. |
intermediatePeriodCatchList |
List defining catch in the intermediate period obtaining the elements 'obsC', 'timeC', and 'dtc' (optional element 'stdevfacC' which is 1 if not provided). Please refer to the details for more information. |
ctol |
Tolerance of |
evalBreakpointB |
Time for the evaluation of the hockey-stick component of the HCR: 0 indicating start of the management period and 1 indicating the end of the management period (default: 0). |
verbose |
Should detailed outputs be provided (default: TRUE). |
dbg |
Debug flag, dbg=1 some output, dbg=2 more output. |
mancheck |
Should the time-dependent objects in |
The default management scenario is fish at . This is when
ffac
, cfac
, fabs
, cabs
are all NULL
, and
breakpointB
and safeguardB$limitB
are 0. In practice ffac
is set equal to .
Management scenarios can be defined based on a desired catch during the
management period. Common examples include scenarios like "increase catch by
25%", "keep current catch", or "zero catch". The catch can be relative to the
predicted "previous catch", using the multiplier cfac
, or in absolute
terms using cabs
catch in the same units as the input data. By default,
the respective previous catch corresponds to that part of the previous
year which corresponds to the management interval. For example,
if the management period is , the
whole catch from the year
is being used. If the
management period is
, the same interval from the
previous year
is being used. If the management
period spans several years, e.g.
, the whole catch from
the previous year
is being used two times.
The combination of the arguments "fractiles", "breakpointB", and "safeguardB" allow the specification of a number of different harvest control rules:
MSY hockey-stick rule: Fishing at F_MSY above a certain biomass reference
level (here defined as a fraction of B_MSY with breakpointB
).
Below the reference level, fishing is reduced linearly to 0 as suggested in
ICES (2017).
MSY (hockey-stick) rule with additional precautionary buffer: As long
as the probability of the predicted biomass relative to a reference
biomass level (e.g. 0.3 B_MSY, defined by safeguardB$limitB
) is smaller or
equal to a specified risk aversion probability (e.g. 95%, defined by
safeguardB$prob
), fishing at F_MSY or following the hockey-stick rule
(if breakpoint != 0
), otherwise reduce fishing mortality to meet
specified risk aversion probability (safeguardB$prob
) as introduced in
ICES (2018).
By ICES (2019) recommended MSY hockey-stick rule with 35th percentiles:
Fishing at 35th percentile of F_MSY above the 35th percentile of 0.5
(
breakpointB = 0.5
) and 35th percentile of
linearly reduced F_MSY below the 35th percentile of 0.5
. TAC corresponds to 35th percentile of predicted catch.
Rule is applied with
fractiles = list(catch=0.35, bbmsy=0.35,
ffmsy=0.35)
, breakpointB = 0.5
, and safeguardB =
list(limitB = 0, prob = 0.95)
.
By default, the median (fractile of 0.5) is used for the stock status (,
) and predicted catch distribution. A more precautionary
approach is to used fractiles lower than the median (0.5) to account for the
estimated uncertainty. The arguments of the 'fractiles' are:
catch - Fractile of the predicted catch distribution
bbmsy - Fractile of the distribution
ffmsy - Fractile of the distribution
Note that the fractile for the distribution is 1 minus the
fractile specified. As the current fishing mortality is divided by the value
of this distribution
, a lower
percentile of the
distribution is more conservative than a
larger one. This allows a consistent setting of fractiles among the different
quantities.
The argument list "safeguardB" includes:
limitB - Reference level for the evaluation of the predicted biomass
defined as fraction of . By default (
safeguardB$limitB
== 0
) the PA buffer is not used. Theoretically, any value smaller than 1
is meaningful, but an ICES recommended value would be 30%
safeguardB$limitB = 0.3
(ICES, 2018).
prob - Risk aversion probability of the predicted biomass relative to
specified reference level (safeguardB$limitB
) for all rules with PA
buffer (safeguardB$limitB != 0
). Default: 0.95 as recommended by ICES
(2018).
Dependent on the start of the management period (e.g. advice year), there might be a time lag between the last observation and the start of the management period, often referred to as the intermediate period. If this is the case, an assumption about the catch during intermediate time period (e.g. assessment year) has to be made. Two meaningful assumptions are:
1: The catch in the intermediate period is based on the fishing mortality which is extrapolated from the previous year. This is the default assumption;
2: The catch in the intermediate period is directly specified. This
could for example be the TAC recommended in the previous year. The catch can
be specified by means of the argument intermediatePeriodCatch
. Be
aware that this catch might correspond to several years or a fraction of a
year depending on the time between the last observation and the start of the
management period. The function man.timeline
can help
visualising the default or specified intermediate period in your data. The
argument intermediatePeriodCatchSDFac
allows to specify the factor
with which to multiply the standard deviation of the catch ()
with. It is thus a measure of the certainty around the catch in the
intermediate period. The argument
intermediatePeriodCatchList
allows
to define a list with catches and their intervals. It is a list with the
elements 'obsC', 'timeC', 'dtc' and the optional element 'stdevfacC' (which
is equal to 1 if not provided).
make.man.inp
Internal function that creates the required input list for the specific HCR.
add.man.scenario
returns the input object rep
with the
specified HCR added to the man
list.
get.TAC
returns the total allowable catch (TAC) based on the
specified scenario.
make.man.inp
returns the updated inp
list based on specified HCR.
ICES. 2017. Report of the Workshop on the Development of the ICES approach to providing MSY advice for category 3 and 4 stocks (WKMSYCat34), 6-10 March 2017, Copenhagen, Denmark. ICES CM 2017/ ACOM:47. 53 pp.
ICES. 2018. Report of the Eighth Workshop on the Development of Quantitative Assessment Methodologies based on LIFE-history traits, exploitation characteristics, and other relevant parameters for data-limited stocks (WKLIFE VIII), 8-12 October 2018, Lisbon, Portugal. ICES CM 2018/ACOM:40. 172 pp.
ICES.2019. Ninth Workshop on the Development of Quantitative Assessment Methodologies based on LIFE-history traits, exploitation characteristics, and other relevant parameters for data-limited stocks (WKLIFE IX). ICES Scientific Reports. 1:77. 131 pp.http://doi.org/10.17895/ices.pub.5550
ICES 2020. Report of the Ninth Workshop on the Development of Quantitative Assessment Methodologies based on LIFE-history traits, exploitation characteristics, and other relevant parameters for data-limited stocks (WKLIFE X), ICES Scientific Reports. 2:98. 72 pp. http://doi.org/10.17895/ices.pub.5985
data(pol) rep <- fit.spict(pol$albacore) ## Fishing at Fmsy rep <- add.man.scenario(rep) ## MSY hockey-stick rule rep <- add.man.scenario(rep, breakpointB = 0.5) ## ICES (2019) recommended HCR rep <- add.man.scenario(rep, fractiles = list(catch=0.35, bbmsy=0.35, ffmsy=0.35), breakpointB=0.5) ## Get the TAC for the ICES (2020) recommended HCR (as used in WKMSYSPICT) rep <- add.man.scenario(rep, fractiles = list(catch=0.35), breakpointB = c(0.3, 0.5)) ## Now `rep` includes 3 management scenarios ## Get the TAC when fishing mortality is equal to Fmsy get.TAC(rep) ## Get TAC for the MSY hockey-stick rule (only using Btrigger) get.TAC(rep, breakpointB = 0.5) ## Get TAC for the MSY hockey-stick rule (with Btrigger and Blim) get.TAC(rep, breakpointB = c(0.3, 0.5)) ## Get the TAC for the ICES (2019) recommended HCR get.TAC(rep, fractiles = list(catch=0.35, bbmsy=0.35, ffmsy=0.35), breakpointB=0.5) ## Get the TAC for the ICES (2020) recommended HCR (as used in WKMSYSPICT) get.TAC(rep, fractiles = list(catch=0.35), breakpointB = c(0.3, 0.5))
data(pol) rep <- fit.spict(pol$albacore) ## Fishing at Fmsy rep <- add.man.scenario(rep) ## MSY hockey-stick rule rep <- add.man.scenario(rep, breakpointB = 0.5) ## ICES (2019) recommended HCR rep <- add.man.scenario(rep, fractiles = list(catch=0.35, bbmsy=0.35, ffmsy=0.35), breakpointB=0.5) ## Get the TAC for the ICES (2020) recommended HCR (as used in WKMSYSPICT) rep <- add.man.scenario(rep, fractiles = list(catch=0.35), breakpointB = c(0.3, 0.5)) ## Now `rep` includes 3 management scenarios ## Get the TAC when fishing mortality is equal to Fmsy get.TAC(rep) ## Get TAC for the MSY hockey-stick rule (only using Btrigger) get.TAC(rep, breakpointB = 0.5) ## Get TAC for the MSY hockey-stick rule (with Btrigger and Blim) get.TAC(rep, breakpointB = c(0.3, 0.5)) ## Get the TAC for the ICES (2019) recommended HCR get.TAC(rep, fractiles = list(catch=0.35, bbmsy=0.35, ffmsy=0.35), breakpointB=0.5) ## Get the TAC for the ICES (2020) recommended HCR (as used in WKMSYSPICT) get.TAC(rep, fractiles = list(catch=0.35), breakpointB = c(0.3, 0.5))
Add lines to plot indicating result of management scenarios.
add.manlines( rep, par, par2 = NULL, index.shift = 0, plot.legend = TRUE, verbose = TRUE, ... )
add.manlines( rep, par, par2 = NULL, index.shift = 0, plot.legend = TRUE, verbose = TRUE, ... )
rep |
A result report as generated by running fit.spict. |
par |
The name of the parameter to be plotted. |
par2 |
If a second parameter should be used as explanatory variable instead of time. |
index.shift |
Shift initial time point by this index. |
plot.legend |
Logical; should the legend be plotted? |
verbose |
Should detailed outputs be provided (default: TRUE). |
... |
Passed to |
Nothing
Convert from quarterly (or other sub-annual) data to annual means, sums or a custom function.
annual(intime, vec, type = "mean")
annual(intime, vec, type = "mean")
intime |
A time vector corresponding to the values in vec. |
vec |
The vector of values to convert to annual means. |
type |
item to match as function: symbol or string, see |
A list containing the annual means $annvec
and a corresponding time vector $anntime
.
Draw a line with arrow heads.
arrow.line( x, y, length = 0.25, angle = 30, code = 2, col = par("fg"), lty = par("lty"), lwd = par("lwd"), ... )
arrow.line( x, y, length = 0.25, angle = 30, code = 2, col = par("fg"), lty = par("lty"), lwd = par("lwd"), ... )
x |
X coordinates. |
y |
Y coordinates. |
length |
See documentation for arrows. |
angle |
See documentation for arrows. |
code |
See documentation for arrows. |
col |
See documentation for arrows. |
lty |
See documentation for arrows. |
lwd |
See documentation for arrows. |
... |
See documentation for arrows. |
Add to an existing plot a continuous line with arrow heads showing the direction between each data point
Nothing, but an arrow line is added to the current plot.
Calculates the Bmsy/K ratio
calc.bmsyk(rep)
calc.bmsyk(rep)
rep |
Result of fit.spict(). |
Bmsy/K
Calculate E(Binfinity), i.e. the fished equilibrium.
calc.EBinf(K, n, Fl, Fmsy, sdb2)
calc.EBinf(K, n, Fl, Fmsy, sdb2)
K |
The carrying capacity. |
n |
Pella-Tomlinson exponent. |
Fl |
Average fishing mortality of the last year. |
Fmsy |
Fishing mortality at MSY. |
sdb2 |
Standard deviation squared (variance) of B process. |
If a seasonal pattern in F is imposed the annual average F is used for calculating the expectation. Max() is used to avoid negative values.
E(Binf).
Calculate gamma from n
calc.gamma(n)
calc.gamma(n)
n |
Exponent of the Pella-Tomlinson surplus production equation. |
Calculates influence statistics of observations.
calc.influence(rep, mc.cores = 1)
calc.influence(rep, mc.cores = 1)
rep |
A valid result from fit.spict(). |
mc.cores |
Number of cores for |
TBA
A list equal to the input with the added key "infl" containing influence statistics.
Calculate Mean Absolute Scaled Error (MASE)
calc.mase(rep, verbose = TRUE)
calc.mase(rep, verbose = TRUE)
rep |
Result of |
verbose |
Should detailed outputs be provided (default: TRUE). |
This function calculates the Mean Absolute Scaled Error (MASE) for
each index time series by hindcasting. Thus, the application of this
method requires a fitted spict object with the results of the hindcasting
analysis hindcast
.
The smaller MASE, the higher the predictive power of the spict model regarding the prediction of index observations. In contrast, a MASE above 1 suggests that the naive prediction of the index observations assuming the preceding index observations have a higher predictive power than the spict model. Note, however, that the absolute MASE value depends on multiple factors such as the number of peels, assumed priors, etc.
Note that a difference in the timing of the index observations of less than a month are considered acceptable for the estimation of the naive prediction residuals and no warning is printed. If the variability exceeds a month, the predictions are still calculated, but a warning is printed.
A data frame with estimate the MASE and the number of runs used for the estimation for each index.
Carvalho, F., Winker, H., Courtney, D., Kapur, M., Kell, L., Cardinale, M., Schirripa, M., Kitakado, T., Yemane, D., Piner, K.R. Maunder, M.N., Taylor, I., Wetzel, C.R., Doering, K., Johnsonm, K.F., Methot, R. D. (2021). A cookbook for using model diagnostics in integrated stock assessments. Fisheries Research, 240, 105959.
Kell, L. T., Kimoto, A., & Kitakado, T. (2016). Evaluation of the prediction skill of stock assessment using hindcasting. Fisheries research, 183, 119-127.
Kell, L. T., Sharma, R., Kitakado, T., Winker, H., Mosqueira, I., Cardinale, M., & Fu, D. (2021). Validation of stock assessment methods: is it me or my model talking?. ICES Journal of Marine Science, 78(6), 2244-2255.
Winker, H., Carvalho, F., & Kapur, M. (2018). JABBA: just another Bayesian biomass assessment. Fisheries Research, 204, 275-288.
data(pol) inp <- pol$albacore rep <- fit.spict(inp) rep <- hindcast(rep) calc.mase(rep)
data(pol) inp <- pol$albacore rep <- fit.spict(inp) rep <- hindcast(rep) calc.mase(rep)
Calculates the order of magnitude for the relative reference levels B/Bmsy and F/Fmsy
calc.om(rep, CI = 0.95)
calc.om(rep, CI = 0.95)
rep |
Result of fit.spict(). |
CI |
Confidence intervals to be used for CI range, e.g. 0.9 for the 90% confidence intervals. By default (CI = 0.95), the 95% confidence intervals are used for the CI range. |
The lower, upper values and the CI range are based on the 95% confidence interval (CI; default).
Matrix containing the order of magnitude for B/Bmsy and F/Fmsy.
Calculate one-step-ahead residuals.
calc.osa.resid(rep)
calc.osa.resid(rep)
rep |
A result report as generated by running fit.spict. |
In TMB one-step-ahead residuals are calculated by sequentially including one data point at a time while keeping the model parameters fixed at their ML estimates. The calculated residuals are tested for independence, bias, and normality.
An updated result report, which contains one-step-ahead residuals stored in $osarC and $osarI.
data(pol) rep <- fit.spict(pol$albacore) rep <- calc.osa.resid(rep) plotspict.osar(rep)
data(pol) rep <- fit.spict(pol$albacore) rep <- calc.osa.resid(rep) plotspict.osar(rep)
Calculate process residuals
calc.process.resid(rep, dt = NULL)
calc.process.resid(rep, dt = NULL)
rep |
A result report as generated by running |
dt |
Time resolution of process residuals. By default (NULL), the process residuals are calculated corresponding to the time resolution of the input data. |
Calculates process residuals for biomass and fishing mortality process.
Data frame with year, process residuals for biomass and fishing mortality in the columns.
data(pol) inp <- pol$albacore rep <- fit.spict(inp) rep <- calc.process.resid(rep) plotspict.diagnostic.process(rep)
data(pol) inp <- pol$albacore rep <- fit.spict(inp) rep <- calc.process.resid(rep) plotspict.diagnostic.process(rep)
Calculate Total Allowable Catch (TAC)
calc.tac(rep, inp = NULL, fractileCatch = 0.5, exp = TRUE)
calc.tac(rep, inp = NULL, fractileCatch = 0.5, exp = TRUE)
rep |
A result report as generated by running |
inp |
Input list with ffac or catch observation corresponding to
management. If |
fractileCatch |
The fractile of the catch distribution to be used for setting the TAC. Default (0.5) corresponds to the median. |
exp |
Should tac be reported on natural scale? (default: TRUE) |
Total Allowable Catch (TAC)
Check catch list
check.catchList(catchList, sdfac = 1)
check.catchList(catchList, sdfac = 1)
catchList |
List obtaining the elements 'obsC', 'timeC', and 'dtc' (optional element 'stdevfacC' which is 1 if not provided) |
sdfac |
Factor for the multiplication of the standard deviation of the catch (default: 1). |
Internal function that checks if catchList is complete.
Checked catchList
Check sensitivity of fit to initial parameter values
check.ini(input, ntrials = 10, verbose = TRUE, numdigits = 2)
check.ini(input, ntrials = 10, verbose = TRUE, numdigits = 2)
input |
Either an inp list passing check.inp(), or a rep list where rep is the output of running fit.spict(). |
ntrials |
The number of trials with different starting values to run. |
verbose |
If true write information to screen. |
numdigits |
Number of digits in reported results. |
List containing results of sensitivity check and associated initial values.
Check list of input variables
check.inp(inp, verbose = TRUE, mancheck = TRUE)
check.inp(inp, verbose = TRUE, mancheck = TRUE)
inp |
List of input variables, see details for required variables. |
verbose |
Should detailed outputs be provided (default: TRUE). |
mancheck |
Should the time-dependent objects in |
Fills in default values if missing.
Required inputs:
"inp$obsC" Vector of catch observations.
"inp$obsI and/or inp$obsE" List containing vectors of index observations and/or a vector of effort information.
Optional inputs:
- Data
"inp$timeC" Vector of catch times. Default: even time steps starting at 1.
"inp$timeI" List containing vectors of index times. Default: even time steps starting at 1.
"inp$timeE" Vector of effort times. Default: even time steps starting at 1.
"inp$dtc" Time interval for catches, e.g. for annual catches inp$dtc=1, for quarterly catches inp$dtc=0.25. Can be given as a scalar, which is then used for all catch observations. Can also be given as a vector specifying the catch interval of each catch observation. Default: min(diff(inp$timeC)).
"inp$dte" Time interval for effort observations. For annual effort inp$dte=1, for quarterly effort inp$dte=0.25. Default: min(diff(inp$timeE)).
"inp$nseasons" Number of within-year seasons in data. If inp$nseasons > 1 then a seasonal pattern is used in F. Valid values of inp$nseasons are 1, 2 or 4. Default: number of unique within-year time points present in data.
"start.in.first.data.point" Logical. If TRUE
(default), modelling time starts at the first available data point, otherwise it starts in the beginning of that year.
- Initial parameter values
"inp$ini$logn" Pella-Tomlinson exponent determining shape of production function. Default: log(2) corresponding to the Schaefer formulation.
"inp$ini$logm" Initial value for logm (log maximum sustainable yield). Default: log(mean(catch)).
"inp$ini$logK" Initial value for logK (log carrying capacity). Default: log(4*max(catch)).
"inp$ini$logq" Initial value for logq (log catchability of index). Default: log(max(index)/K).
"inp$ini$logsdb" Initial value for logsdb (log standard deviation of biomass process). Default: log(0.2).
"inp$ini$logsdf" Initial value for logsdf (log standard deviation of fishing mortality process). Default: log(0.2).
"inp$ini$logsdi" Initial value for logsdi (log standard deviation of index observation error). Default: log(0.2).
"inp$ini$logsdc" Initial value for logsdc (log standard deviation of catch observation error). Default: log(0.2).
"inp$ini$phi" Vector for cyclic B spline representing within-year seasonal variation. Default: rep(1, inp$nseasons).
"inp$ini$logsdu" Initial value for logsdu (log standard deviation of log U, the state of the coupled SDE representation of seasonality). Default: log(0.1).
"inp$ini$loglambda" Initial value for loglambda (log damping parameter of the coupled SDE representation of seasonality). Default: log(0.1).
- Initial values for unobserved states estimated as random effects
"inp$ini$logF" Log fishing mortality. Default: log(0.2*r), with r derived from m and K.
"inp$ini$logB" Log biomass. Default: log(0.5*K).
"inp$ini$logU" Log U, the state of the coupled SDE representation of seasonality. Default: log(1).
- Priors
Priors on model parameters are assumed generally assumed Gaussian and specified in a vector of length 2: c(log(mean), stdev in log domain, useflag [optional]). NOTE: if specifying a prior for a value in a temporal vector e.g. logB, then a fourth element is required specifying the year the prior should be applied. log(mean): log of the mean of the prior distribution. stdev in log: standard deviation of the prior distribution in log domain. useflag: if 1 then the prior is used, if 0 it is not used. Default is 1. To list parameters to which priors can be applied run list.possible.priors(). Example: intrinsic growth rate of 0.8 inp$priors$logr <- c(log(0.8), 0.1) inp$priors$logr <- c(log(0.8), 0.1, 1) # This includes the optional useflag Example: Biomass prior of 200 in 1985 inp$priors$logB <- c(log(200), 0.2, 1985) inp$priors$logB <- c(log(200), 0.2, 1, 1985) # This includes the optional useflag
- Settings/Options/Preferences
"inp$maninterval" Start and end time of management period. Default: One year interval starting at the beginning of the new year after the last observation. Example: inp$maninterval <- c(2020.25,2021.25)
"inp$maneval" Time for the estimation of predicted model states (biomass and fishing mortality), which can be used to evaluate the implications of management scenarios. Default: At the end of the management interval inp$maninterval[2]
. Example: inp$maneval <- 2021.25
"inp$timepredc" Deprecated: Predict accummulated catch in the interval starting at $timepredc and $dtpredc into the future. Default depends on inp$maninterval
.
"inp$dtpredc" Deprecated: Length of catch prediction interval in years. Default depends on inp$maninterval
.
"inp$timepredi" Deprecated: Predict index until this time. Default depends on inp$maneval
.
"inp$manstart" Deprecated: Start of the management period. Updated argument inp$maninterval
. Default depends on inp$maninterval
.
"inp$do.sd.report" Flag indicating whether SD report (uncertainty of derived quantities) should be calculated. For small values of inp$dteuler this may require a lot of memory. Default: TRUE.
"inp$reportall" Flag indicating whether quantities derived from state vectors (e.g. B/Bmsy, F/Fmsy etc.) should be calculated by SD report. For small values of inp$dteuler (< 1/32) reporting all may have to be set to FALSE for sdreport to run. Additionally, if only reference points of parameter estimates are of interest one can set to FALSE to gain a speed-up. Default: TRUE.
"inp$reportmode" Integer between 0 and 2 determining which objects will be adreported. Default: 0 = all quantities are adreported. Example: inp$reportmode <- 1
"inp$reportRel" Flag indicating whether mean 1 standardized states (i.e. B/mean(B), F/mean(F) etc.) should be calculated by SD report. Default: FALSE.
"inp$robflagc" Flag indicating whether robust estimation should be used for catches (either 0 or 1). Default: 0.
"inp$robflagi" Vector of flags indicating whether robust estimation should be used for indices (either 0 or 1). Default: 0.
"inp$ffac" Management scenario represented by a factor to multiply F with when calculating the F of the next time step. ffac=0.8 means a 20% reduction in F over the next year. The factor is only used when predicting beyond the data set. Default: 1 (0% reduction).
"inp$dteuler" Length of Euler time step in years. Default: 1/16 year.
"inp$phases" Phases can be used to fix/free parameters and estimate in different stages or phases. To fix e.g. logr at inp$ini$logr set inp$phases$logr <- -1. To free logalpha and estimate in phase 1 set inp$phases$logalpha <- 1.
"inp$osar.method" Method to use in TMB's oneStepPredict function. Valid methods include: "oneStepGaussianOffMode", "fullGaussian", "oneStepGeneric", "oneStepGaussian", "cdf". See TMB help for more information. Default: "none" (i.e. don't run this).
"inp$osar.trace" If TRUE print OSAR calculation progress to screen. Default: FALSE.
"inp$osar.parallel" If TRUE parallelise OSAR calculation for speed-up. Default: FALSE.
"inp$catchunit" Specify unit of catches to be used in plotting legends. Default: ”.
"inp$stdevfacC" Factors to multiply the observation error standard deviation of each individual catch observation. Can be used if some observations are more uncertain than others. Must be same length as observation vector. Default: 1.
"inp$stdevfacI" Factors to multiply the observation error standard deviation of each individual index observation. Can be used if some observations are more uncertain than others. A list with vectors of same length as observation vectors. Default: 1.
"inp$stdevfacE" Factors to multiply the observation error standard deviation of each individual effort observation. Can be used if some observations are more uncertain than others. A list with vectors of same length as observation vectors. Default: 1.
"inp$mapsdi" Vector of length equal to the number of index series specifying which indices that should use the same sdi. For example: in case of 3 index series use inp$mapsdi <- c(1, 1, 2)
to have series 1 and 2 share sdi and have a separate sdi for series 3. Default: 1:nindex, where nindex is number of index series.
"inp$seasontype" If set to 1 use the spline-based representation of seasonality. If set to 2 use the oscillatory SDE system (this is more unstable and difficult to fit, but also more flexible).
"inp$sim.random.effects"Should random effects (logB, logF, etc.) be simulated (default) or the same random effects be used (as specified in inp$ini
or in an fitted spict object)?
"inp$sim.fit"Should the estimated parameters from the last fit of a fitted spict object be used for simulation (env$last.par
, default) or the inital values (specified in inp$ini
)?. Note, that this only works if a fitted spict object is provided as input to sim.spict
.
An updated list of input variables checked for consistency and with defaults added.
data(pol) (inp <- check.inp(pol$albacore))
data(pol) (inp <- check.inp(pol$albacore))
Check the consistency of management scenarios in rep
check.man( rep, maninterval = NULL, maneval = NULL, verbose = TRUE, reportmode0 = TRUE )
check.man( rep, maninterval = NULL, maneval = NULL, verbose = TRUE, reportmode0 = TRUE )
rep |
A result report as generated by running |
maninterval |
Two floats representing the start and end of the management period. Example: maninterval = c(2020.25,2021.25). Default: NULL. |
maneval |
Time at which to evaluate model states. Example: |
verbose |
Should detailed outputs be provided (default: TRUE). |
reportmode0 |
Should it be checked that the reportmode is 0 (default: TRUE). |
Internal function that checks if the fitted spict objects in
rep$man
have a consistent management interval.
TRUE/FALSE
Checks and corrects management time to be within model time
check.man.time( x, maninterval = NULL, maneval = NULL, verbose = TRUE, printTimeline = FALSE, mancheck = TRUE )
check.man.time( x, maninterval = NULL, maneval = NULL, verbose = TRUE, printTimeline = FALSE, mancheck = TRUE )
x |
Either an input list from |
maninterval |
Two floats representing the start and end of the management period. Example: maninterval = c(2020.25,2021.25). Default: NULL. |
maneval |
Time at which to evaluate model states. Example: maneval = 2021.25. Default: NULL. |
verbose |
Should detailed outputs be provided (default: TRUE). |
printTimeline |
logical; print the management time line (default: FALSE) |
mancheck |
Should the time-dependent objects in |
Updated input list or fitted spict object dependent on type of input.
data(pol) inp <- check.inp(pol$albacore) rep <- fit.spict(inp) ## with an input list check.man.time(inp) ## with an output list check.man.time(rep)
data(pol) inp <- check.inp(pol$albacore) rep <- fit.spict(inp) ## with an input list check.man.time(inp) ## with an output list check.man.time(rep)
Check rep list
check.rep(rep, reportmode0 = TRUE)
check.rep(rep, reportmode0 = TRUE)
rep |
A result report as generated by running |
reportmode0 |
Should it be checked that the reportmode is 0 (default: TRUE). |
Internal function that checks if rep is fitted spict object.
Nothing
Extract hindcast info from a fitted spict object
extract.hindcast.info(rep, CI = 0.95, verbose = TRUE)
extract.hindcast.info(rep, CI = 0.95, verbose = TRUE)
rep |
Result of |
CI |
Confidence intervals to be calculated, e.g. 0.9 for the 90% confidence intervals. By default (CI = 0.95), the 95% confidence intervals are estimated. |
verbose |
Should detailed outputs be provided (default: TRUE). |
Note that a difference in the timing of the index observations of less than a month are considered acceptable for the estimation of the naive prediction residuals and no warning is printed. If the variability exceeds a month, the predictions are still calculated, but a warning is printed.
A list with hindcast information.
Extracts relevant statistics from the estimation of a simulated data set.
extract.simstats(rep, inp = NULL, exp = NULL, parnames = NULL)
extract.simstats(rep, inp = NULL, exp = NULL, parnames = NULL)
rep |
A result report as generated by running fit.spict. |
inp |
The input list used as input to the validation.spict function. |
exp |
Should exp be taken of parameters? |
parnames |
Vector of parameter names to extract stats for. |
TBA
A list containing the relevant statistics.
data(pol) repin <- fit.spict(pol$albacore) sim <- sim.spict(repin) rep <- fit.spict(sim) extract.simstats(rep)
data(pol) repin <- fit.spict(pol$albacore) sim <- sim.spict(repin) rep <- fit.spict(sim) extract.simstats(rep)
Format date
fd(d, dec = 2)
fd(d, dec = 2)
d |
Point in time in years as decimal number. |
dec |
Number of decimals. |
Correctly formatted date.
Fits aspic to the data contained in the input file
fit.aspic( input, do.boot = FALSE, nboot = NULL, ciperc = NULL, verbose = FALSE, filebase = "tmp", savefile = NULL )
fit.aspic( input, do.boot = FALSE, nboot = NULL, ciperc = NULL, verbose = FALSE, filebase = "tmp", savefile = NULL )
input |
A spict input list containing observations. |
do.boot |
Do bootstrap to get uncertainties of estimates? |
nboot |
Number of bootstrap runs (only used if do.boot=TRUE). Prager suggests in the ASPIC manual p. 13 to use nboot > 1000 if ciperc > 80. |
ciperc |
Coverage percentage (integer between 0 and 100) of bootstrapped confidence intervals. |
verbose |
If TRUE write information to screen. |
filebase |
Basename of all generated aspic files. |
savefile |
Save results to this file. |
Only works on Linux. This furthermore requires that wine is installed and that aspic7 is installed and available to the PATH.
List containing aspic results.
Fit the Meyer & Millar model using rjags
fit.jags( inp, fn, n.iter = 10000, n.chains = 1, burnin = round(n.iter/2), thin = 1000 )
fit.jags( inp, fn, n.iter = 10000, n.chains = 1, burnin = round(n.iter/2), thin = 1000 )
inp |
Input list containing data and settings. |
fn |
Filename of containing BUGS code. |
n.iter |
Number of iterations. |
n.chains |
Number of chains. |
burnin |
Number of burn-in iterations. |
thin |
Thin chains by this value. |
The raw output of rjags::coda.samples.
Fit the model of Meyer & Millar (1999)
fit.meyermillar(mminp)
fit.meyermillar(mminp)
mminp |
Input list similar to the input to fit.spict() |
Same input structure as for fit.spict(). Fitting the model of Meyer & Millar requires the packages rjags and coda. It furthermore requires that priors are specified for K, r, q, sigma2 (process error variance) and tau2 (observation error variance). Following Meyer & Millar (1999) the priors are:
"K" log-normal.
"r" log-normal.
"q" inverse-gamma.
"tau2" inverse-gamma.
"sigma2" inverse-gamma.
See example for how to specify priors.
List containing results
priors <- list() priors$K <- c(5.042905, 3.76) priors$r <- c(-1.38, 3.845) priors$iq <- c(0.001, 0.0012) priors$itau2 <- c(1.709, 0.00861342) priors$isigma2 <- c(3.785518, 0.0102232) priors$logPini <- -0.223 data(pol) inp <- pol$albacore inp$meyermillar$n.iter <- 10000 inp$meyermillar$burnin <- 1000 inp$meyermillar$thin <- 10 inp$meyermillar$n.chains <- 1 inp$meyermillar$priors <- priors res <- fit.meyermillar(inp) summary(res$jags)
priors <- list() priors$K <- c(5.042905, 3.76) priors$r <- c(-1.38, 3.845) priors$iq <- c(0.001, 0.0012) priors$itau2 <- c(1.709, 0.00861342) priors$isigma2 <- c(3.785518, 0.0102232) priors$logPini <- -0.223 data(pol) inp <- pol$albacore inp$meyermillar$n.iter <- 10000 inp$meyermillar$burnin <- 1000 inp$meyermillar$thin <- 10 inp$meyermillar$n.chains <- 1 inp$meyermillar$priors <- priors res <- fit.meyermillar(inp) summary(res$jags)
Fit a continuous-time surplus production model to data.
fit.spict(inp, verbose = TRUE, dbg = 0)
fit.spict(inp, verbose = TRUE, dbg = 0)
inp |
List of input variables as output by check.inp. |
verbose |
Should detailed outputs be provided (default: TRUE). |
dbg |
Debugging option. Will print out runtime information useful for debugging if set to 1. Will print even more if set to 2. |
Fits the model using the TMB package and returns a result report containing estimates of model parameters, random effects (biomass and fishing mortality), reference points (Fmsy, Bmsy, MSY) including uncertainties given as standard deviations.
Model parameters using the formulation of Fletcher (1978):
"logn" Parameter determining the shape of the production curve as in the generalised form of Pella & Tomlinson (1969).
"logm" Log of maximum sustainable yield.
"logK" Log of carrying capacity.
"logq" Log of catchability vector.
"logsdb" Log of standard deviation of biomass process error.
"logsdf" Log of standard deviation of fishing mortality process error.
"logsdi" Log of standard deviation of index observation error.
"logsdc" Log of standard deviation of catch observation error.
Unobserved states estimated as random effects:
"logB" Log of the biomass process given by the stochastic differential equation: dB_t = r*B_t*(1-(B_t/K)^n)*dt + sdb*dW_t, where dW_t is Brownian motion.
"logF" Log of the fishing mortality process given by: dlog(F_t) = f(t, sdf), where the function f depends on the choice of seasonal model.
Other parameters (which are only needed in certain cases):
"logphi" Log of parameters used to specify the cyclic B spline representing seasonal variation. Used when inp$nseasons > 1 and inp$seasontype = 1.
"logU" Log of the state of the coupled SDE system used to represent seasonal variation, i.e. when inp$nseasons > 1 and inp$seasontype = 2.
"loglambda" Log of damping parameter when using the coupled SDE system to represent seasonal variation, i.e. when inp$nseasons > 1 and inp$seasontype = 2.
"logsdu" Log of standard deviation of process error of U_t (the state of the coupled SDE system) used to represent seasonal variation, i.e. when inp$nseasons > 1 and inp$seasontype = 2.
"logsde" Log of standard deviation of observation error of effort data. Only used if effort data is part of input.
"logp1robfac" Log plus one of the coefficient to the standard deviation of the observation error when using a mixture distribution robust toward outliers, i.e. when either inp$robflag = 1 and/or inp$robflagi = 1.
"logitpp"Logit of the proportion of narrow distribution when using a mixture distribution robust toward outliers, i.e. when either inp$robflag = 1 and/or inp$robflagi = 1.
Parameters that can be derived from model parameters:
"logr" Log of intrinsic growth rate (r = 4m/K).
"logalpha" Proportionality factor for the observation noise of the indices and the biomass process noise: sdi = exp(logalpha)*sdb. (normally set to logalpha=0)
"logbeta" Proportionality factor for the observation noise of the catches and the fishing mortality process noise: sdc = exp(logbeta)*sdf. (this is often difficult to estimate and can result in divergence of the optimisation. Normally set to logbeta=0)
"logBmsy" Log of the equilibrium biomass (Bmsy) when fished at Fmsy.
"logFmsy" Log of the fishing mortality (Fmsy) leading to the maximum sustainable yield.
"MSY" The yield when the biomass is at Bmsy and the fishing mortality is at Fmsy, i.e. the maximum sustainable yield.
The above parameter values can be extracted from the fit.spict() results using get.par().
Model assumptions
The intrinsic growth rate (r) represents a combination of natural mortality, growth, and recruitment.
The biomass B_t refers to the exploitable part of the stock. Estimates in absolute numbers (K, Bmsy, etc.) should be interpreted in light of this.
The stock is closed to migration.
Age and size-distribution are stable in time.
Constant catchability of the gear used to gather information for the biomass index.
A result report containing estimates of model parameters, random effects (biomass and fishing mortality), reference points (Fmsy, Bmsy, MSY) including uncertainties given as standard deviations.
data(pol) rep <- fit.spict(pol$albacore) Bmsy <- get.par('logBmsy', rep, exp=TRUE) summary(rep) plot(rep)
data(pol) rep <- fit.spict(pol$albacore) Bmsy <- get.par('logBmsy', rep, exp=TRUE) summary(rep) plot(rep)
Calculate AIC from a rep list.
get.AIC(rep)
get.AIC(rep)
rep |
A result report as generated by running fit.spict. |
AIC
Find observations of catch and index that overlap
get.catchindexoverlap(inp)
get.catchindexoverlap(inp)
inp |
An input list containing data. |
List containing overlapping catch (y) and index (z) observations and their time vectors.
Get column names for data.frames.
get.colnms()
get.colnms()
Vector containing column names of data frames.
Get covariance matrix of two reported quantities not of fixed model parameters. Covariance of fixed model parameters can be found in rep$cov.fixed.
get.cov(rep, parname1, parname2, cor = FALSE)
get.cov(rep, parname1, parname2, cor = FALSE)
rep |
Result of fit.spict(). |
parname1 |
Name first parameter. |
parname2 |
Name second parameter. |
cor |
If TRUE correlation matrix is reported instead of covariance matrix |
Covariance matrix of specified parameters.
Calculate E(Binfinity) the fished equilibrium.
get.EBinf(rep)
get.EBinf(rep)
rep |
A result of fit.spict. |
If a seasonal pattern in F is imposed the annual average F is used for calculating the expectation.
E(Binf).
Estimate fishing mortality factor minimising probability of specified model variable hitting a specified reference level under given fishing mortality
get.ffac( rep, var = "logBpBmsy", ref = 1, problevel = 0.95, reportmode = 1, verbose = TRUE )
get.ffac( rep, var = "logBpBmsy", ref = 1, problevel = 0.95, reportmode = 1, verbose = TRUE )
rep |
A result report as generated by running |
var |
A variable of the spict model (default: "logBpBmsy"). |
ref |
Reference level relative to specified variable (default: 1) |
problevel |
Probability level of the risk aversion (default: 0.95). |
reportmode |
Integer between 0 and 2 determining which objects will be adreported (default: 1). |
verbose |
logical; print informative text (default: TRUE). |
Optimised Fishing mortality for P(Bp<Blim)
Estimate catch for management period based on last catch observations
get.manC(rep, inp)
get.manC(rep, inp)
rep |
A result report as generated by running |
inp |
Input list with ffac or catch observation corresponding to management. |
Internal function that estimates the catch in the management period based on the catch observations in the last year. Only catch observations in the last year are considered. If the management period is longer than a year the catches of the last year are raised. If the management period is shorter than a year, but only annual catches are available, the respective fraction of the last annual catch observation is used. If both the management period and the catch observations are subannual, the subannual catches of the respective 'seasons' of the year corresponding to the 'season' of the management period are used. Be aware that the estimated catch might correspond to a different season(s) than the management period both are subannual and some catch observations are missing.
Table with catches for management period based on last observed catches and corresponding times.
Get limts of any parameter considering all spict objects in rep$man
get.manlimits(rep, par, CI = 0.95)
get.manlimits(rep, par, CI = 0.95)
rep |
A result report as generated by running fit.spict. |
par |
The name of the parameter to be plotted. |
CI |
Confidence intervals to be calculated, e.g. 0.9 for the 90% confidence intervals. By default (CI = 0.95), the 95% confidence intervals are estimated. |
plotting limits for all reps in rep$man
Get spict object in rep$man with longest time series
get.manmax(rep)
get.manmax(rep)
rep |
A result report as generated by running fit.spict. |
rep in rep$man which hast the longest time series
Get mfrow from the number of plots to be plotted
get.mfrow(n)
get.mfrow(n)
n |
Number of plots to be plotted. |
Nothing
If multiple growth rates (r) are used (e.g. for a seasonal model), return specified reference point for all instances of r.
get.msyvec(inp, msy)
get.msyvec(inp, msy)
inp |
An input list as validated by check.inp(). |
msy |
Matrix containing reference point values as given by get.par(). |
A list containing reference point estimates with upper and lower CI bounds.
Get number of active priors
get.no.active.priors(inp)
get.no.active.priors(inp)
inp |
An input list containing priors (after call to check.inp and/or fit.spict) |
number of active priors
Get order of printed quantities.
get.order()
get.order()
Vector containing indices of printed quantities.
Check whether ACF of catch and index residuals is significant in any lags.
get.osar.pvals(rep)
get.osar.pvals(rep)
rep |
Result of fit.spict(), but requires that also residuals have been calculated using calc.osa.resic(). |
Vector of p-values of length equal to the number of data series.
Extract parameters from a result report as generated by fit.spict.
get.par( parname, rep = rep, exp = FALSE, random = FALSE, fixed = FALSE, CI = 0.95 ) list.quantities(rep)
get.par( parname, rep = rep, exp = FALSE, random = FALSE, fixed = FALSE, CI = 0.95 ) list.quantities(rep)
parname |
Character string containing the name of the variable of interest. |
rep |
A result report as generated by running |
exp |
Take exp of the variable? TRUE/FALSE. |
random |
DUMMY not used anymore. (Is the variable a random effect? TRUE/FALSE.) |
fixed |
DUMMY not used anymore. (Is the variable a fixed effect? TRUE/FALSE.) |
CI |
Confidence intervals to be calculated, e.g. 0.9 for the 90% confidence intervals. By default (CI = 0.95), the 95% confidence intervals are estimated. |
get.par
is a helper function for extracting the value and
uncertainty of a specific model parameter, random effect or derived
quantity. list.quantities
gives the names of all quantities.
get.par returns a matrix with four columns containing respectively: 1) the lower 95% confidence limit; 2) the parameter estimate; 3) the upper 95% confidence limit; 4) the parameter standard deviation in the domain it was estimated (log or non-log). 'list.quantities' returns a vector with the names of all estimated parameters and derived quantities.
## Run the South Atlantic albacore assessment data(pol) rep <- fit.spict(pol$albacore) ## See all quantitites that can be extracted list.quantities(rep) ## Extract the Bmsy reference point Bmsy <- get.par('logBmsy', rep, exp=TRUE) ## Extract the exploitable biomass estimates Best <- get.par('logB', rep, exp=TRUE) ## Extract the estimated carrying capacity K <- get.par('logK', rep, exp=TRUE)
## Run the South Atlantic albacore assessment data(pol) rep <- fit.spict(pol$albacore) ## See all quantitites that can be extracted list.quantities(rep) ## Extract the Bmsy reference point Bmsy <- get.par('logBmsy', rep, exp=TRUE) ## Extract the exploitable biomass estimates Best <- get.par('logB', rep, exp=TRUE) ## Extract the estimated carrying capacity K <- get.par('logK', rep, exp=TRUE)
Get the values of the seasonal spline for F.
get.spline(logphi, order, dtfine = 1/100)
get.spline(logphi, order, dtfine = 1/100)
logphi |
Values of the phi vector. |
order |
Order of the spline. |
dtfine |
Time between points where spline is evaluated. |
Spline values at the points between 0 and 1 with dtfine as time step.
Get version of spict including git sha1 version if available.
get.version(pkg = "spict")
get.version(pkg = "spict")
pkg |
Name of package. |
Package version
Use a simple linear regression to guess m (MSY).
guess.m(inp, all.return = FALSE)
guess.m(inp, all.return = FALSE)
inp |
An input list containing data. |
all.return |
If true also return a guess on Emsy (effort at MSY) and components of the linear regression. |
Equations 9.1.7 and 9.1.8 on page 284 of FAO's tropical assessment book are used to guess MSY.
The guess on MSY.
Conduct hindcasting analysis
hindcast( rep, npeels = 7, reduce.output.size = TRUE, mc.cores = 1, peel.dtc = FALSE )
hindcast( rep, npeels = 7, reduce.output.size = TRUE, mc.cores = 1, peel.dtc = FALSE )
rep |
rep Result of |
npeels |
Number of years/seasons (dependent on dtc) of data (catch and effort) to remove (this is also the total number of model runs). |
reduce.output.size |
logical, if |
mc.cores |
Number of cores for |
peel.dtc |
Peel according to catch seasons (dtc) rather than years? It only differs if the data includes seasonal catches (Default: FALSE) |
This method creates a number of subsets (or peels) specified with
the argument npeels
by sequentially omitting all observations from
the most recent time step (by default corresponding to a year). Then,
spict is fitted to each subset while excluding all index observations in
the most recent year with data. The resulting fitted spict objects are
attached to the base spict object as a list element labeled
hindcast
and resulted by this method.
The prediction of the excluded index observations relative to the actual
excluded index can then be compared to a 'naive' prediction using the
preceding index observation. This allows to estimate the Mean Absolute
Scaled Error (MASE) for each index calc.mase
.
The predicted indices can be visualised with the function
plotspict.hindcast
.
A spictcls
list with the added element hindcast
containing the results of the hindcasting analysis. Use
plotspict.hindcast
to plot these results.
Carvalho, F., Winker, H., Courtney, D., Kapur, M., Kell, L., Cardinale, M., Schirripa, M., Kitakado, T., Yemane, D., Piner, K.R. Maunder, M.N., Taylor, I., Wetzel, C.R., Doering, K., Johnsonm, K.F., Methot, R. D. (2021). A cookbook for using model diagnostics in integrated stock assessments. Fisheries Research, 240, 105959.
Kell, L. T., Kimoto, A., & Kitakado, T. (2016). Evaluation of the prediction skill of stock assessment using hindcasting. Fisheries research, 183, 119-127.
Kell, L. T., Sharma, R., Kitakado, T., Winker, H., Mosqueira, I., Cardinale, M., & Fu, D. (2021). Validation of stock assessment methods: is it me or my model talking?. ICES Journal of Marine Science, 78(6), 2244-2255.
Winker, H., Carvalho, F., & Kapur, M. (2018). JABBA: just another Bayesian biomass assessment. Fisheries Research, 204, 275-288.
data(pol) inp <- pol$albacore rep <- fit.spict(inp) rep <- hindcast(rep, npeels = 5) plotspict.hindcast(rep)
data(pol) inp <- pol$albacore rep <- fit.spict(inp) rep <- hindcast(rep, npeels = 5) plotspict.hindcast(rep)
Inverse logit transform.
invlogit(a)
invlogit(a)
a |
Value to take inverse logit of. |
Inverse logit.
Inverse log "plus one" transform
invlogp1(a)
invlogp1(a)
a |
Value to take inverse logp1 of. |
If a = log(b-1), then the inverse transform is b = 1 + exp(a). Useful for values with lower bound at 1.
Inverse logp1.
Generate latex code for including a figure.
latex.figure(figfile, reportfile, caption = "")
latex.figure(figfile, reportfile, caption = "")
figfile |
Path to figure file. |
reportfile |
Path to report file. |
caption |
This character string will be included as the figure caption. |
Nothing.
Create profile likelihood
likprof.spict(input, verbose = FALSE, mc.cores = 1)
likprof.spict(input, verbose = FALSE, mc.cores = 1)
input |
A list containing observations and initial values for non profiled parameters (essentially an inp list) with the additional key "likprof" (see details for required keys). A valid result from fit.spict() containing an "inp" key with the described properties is also accepted. |
verbose |
Print progress to screen. |
mc.cores |
Number of cores for |
The "likprof" list must containg the following keys:
"pars" A character vector of length equal 1 or 2 containing the name(s) of the parameters to calculate the profile likelihood for.
"parrange" A vector containing the parameter range(s) to profile over: parrange = c(min(par1), max(par1), min(par2), max(par2)).
Optional:
"nogridpoints" Number of grid points to evaluate the profile likelihood for each parameter. Default: 9. Note: with two parameters the calculation time increases quadratically when increasing the number of gridpoints.
The output is the input with the likelihood profile information added to the likprof key of either inp or rep$inp.
data(pol) inp <- pol$albacore inp$likprof <- list() inp$likprof$pars <- 'logK' inp$likprof$parrange <- c(log(80), log(400)) inp$likprof$nogridpoints <- 15 rep <- fit.spict(inp) rep <- likprof.spict(rep) plotspict.likprof(rep, logpar=TRUE)
data(pol) inp <- pol$albacore inp$likprof <- list() inp$likprof$pars <- 'logK' inp$likprof$parrange <- c(log(80), log(400)) inp$likprof$nogridpoints <- 15 rep <- fit.spict(inp) rep <- likprof.spict(rep) plotspict.likprof(rep, logpar=TRUE)
List parameters to which priors can be added
list.possible.priors()
list.possible.priors()
Prints parameters to which priors can be added.
Create data list used as input to TMB::MakeADFun.
make.datin(inp, dbg = 0)
make.datin(inp, dbg = 0)
inp |
List of input variables as output by check.inp. |
dbg |
Debugging option. Will print out runtime information useful for debugging if set to 1. |
List to be used as data input to TMB::MakeADFun.
Make fcon vector
make.fconvec(inp, fcon)
make.fconvec(inp, fcon)
inp |
Input list |
fcon |
Constant to add to F |
Input list containing fconvec
Make ffac vector
make.ffacvec(inp, ffac)
make.ffacvec(inp, ffac)
inp |
Input list |
ffac |
Factor to multiply current F by |
Input list containing ffacvec
Create TMB obj using TMB::MakeADFun and squelch screen printing.
make.obj(datin, pl, inp, phase = 1)
make.obj(datin, pl, inp, phase = 1)
datin |
Data list. |
pl |
Parameter list. |
inp |
List of input variables as output by check.inp. |
phase |
Estimation phase, integer. |
List to be used as data input to TMB.
Creates a pdf file containing the summary output and result plots
make.report( rep, reporttitle = "", reportfile = "report.tex", summaryoutfile = "summaryout.txt", keep.figurefiles = FALSE, keep.txtfiles = FALSE, keep.texfiles = FALSE )
make.report( rep, reporttitle = "", reportfile = "report.tex", summaryoutfile = "summaryout.txt", keep.figurefiles = FALSE, keep.txtfiles = FALSE, keep.texfiles = FALSE )
rep |
A valid result from fit.spict with OSA residuals. |
reporttitle |
This character string will be printed as the first line of the report. |
reportfile |
A connection, or a character string naming the file ('.tex' file) to print
to. If not a connection, |
summaryoutfile |
Summary output filename. |
keep.figurefiles |
If TRUE generated figure files will not be cleaned up. |
keep.txtfiles |
If TRUE generated txt files will not be cleaned up. |
keep.texfiles |
If TRUE generated tex file will not be cleaned up. |
This function probably requires that you are running linux and that you have latex functions installed (pdflatex).
Nothing.
Calculate confidence ellipsis for reference points.
make.rpellipse(rep)
make.rpellipse(rep)
rep |
A result report as generated by running fit.spict. |
Calculates the confidence ellipsis of logBmsy and logFmsy (last if multiple)
A matrix with two columns containing the x and y coordinates of the ellipsis.
Make a spline design matrix
make.splinemat(nseasons, order, dtfine = 1/100)
make.splinemat(nseasons, order, dtfine = 1/100)
nseasons |
Number of seasons |
order |
Order of the spline |
dtfine |
Time between points where spline is evaluated |
Spline design matrix.
Load color of management scenarios.
man.cols()
man.cols()
Color vector
Select management scenarios
man.select(rep, scenarios = "all", spictcls = FALSE, verbose = TRUE)
man.select(rep, scenarios = "all", spictcls = FALSE, verbose = TRUE)
rep |
A result report as generated by running |
scenarios |
Selection of scenarios in preferred order. Can be a vector
with the names of the selected scenarios or numbers indicating their
position in |
spictcls |
Should selected scenario be a standard spictcls object?
Default is |
verbose |
Should detailed outputs be provided (default: |
A fitted spict object wit selected management scenarios in preferred
order in rep$man
. This function can also be used to select a
specific scenarios in rep$man
as the new main spictcls object. By
setting the argument spictcls
to TRUE
, management related
catch observations are removed and the retaped spict object of class
'spictcls' is returned, comparable to the object returned by
fit.spict
. This only works if one scenario is selected
(length(scnearios) == 1
).
data(pol) rep <- fit.spict(pol$albacore) rep <- manage(rep, c(2,4,6)) ## based on names names(rep$man) rep1 <- man.select(rep, c("currentF","noF")) ## based on indices length(rep$man) rep2 <- man.select(rep, c(1,3)) ## select specific scenario as new spictcls object rep3 <- man.select(rep, 1, spictcls = TRUE)
data(pol) rep <- fit.spict(pol$albacore) rep <- manage(rep, c(2,4,6)) ## based on names names(rep$man) rep1 <- man.select(rep, c("currentF","noF")) ## based on indices length(rep$man) rep2 <- man.select(rep, c(1,3)) ## select specific scenario as new spictcls object rep3 <- man.select(rep, 1, spictcls = TRUE)
Get the TAC for the management scenarios
man.tac(rep, fractileCatch = 0.5, exp = TRUE, verbose = TRUE)
man.tac(rep, fractileCatch = 0.5, exp = TRUE, verbose = TRUE)
rep |
A result report as generated by running |
fractileCatch |
Fractile of predicted catch distribution. By default (0.5), the median is being used. |
exp |
Should tac be reported on natural scale (default: TRUE). |
verbose |
Should detailed outputs be provided (default: TRUE). |
rep wit selected management scenarios
data(pol) rep <- fit.spict(pol$albacore) rep <- manage(rep, c(3,4,5)) ## Median of predicted catch distributions man.tac(rep) ## 30th percentile of catch distributions man.tac(rep, fractileCatch = 0.3)
data(pol) rep <- fit.spict(pol$albacore) rep <- manage(rep, c(3,4,5)) ## Median of predicted catch distributions man.tac(rep) ## 30th percentile of catch distributions man.tac(rep, fractileCatch = 0.3)
Print a schematic to the console visualising the management timeline
man.timeline(x, verbose = TRUE, obsonly = FALSE)
man.timeline(x, verbose = TRUE, obsonly = FALSE)
x |
Either an input list from |
verbose |
Should detailed outputs be provided (default: TRUE). |
obsonly |
Display observation period only |
Nothing
data(pol) inp <- check.inp(pol$albacore) inp$maninterval <- c(1991,1992) rep <- fit.spict(inp) ## based on an input list man.timeline(inp) ## based on an output list man.timeline(rep)
data(pol) inp <- check.inp(pol$albacore) inp$maninterval <- c(1991,1992) rep <- fit.spict(inp) ## based on an input list man.timeline(inp) ## based on an output list man.timeline(rep)
Calculate predictions under 8 default management scenarios
manage( rep, scenarios = "all", maninterval = NULL, maneval = NULL, intermediatePeriodCatch = NULL, intermediatePeriodCatchSDFac = 1, intermediatePeriodCatchList = NULL, verbose = TRUE, dbg = 0 )
manage( rep, scenarios = "all", maninterval = NULL, maneval = NULL, intermediatePeriodCatch = NULL, intermediatePeriodCatchSDFac = 1, intermediatePeriodCatchList = NULL, verbose = TRUE, dbg = 0 )
rep |
A result report as generated by running |
scenarios |
Vector of integers specifying which scenarios to run or 'all' to run all scenarios. Default: 'all'. |
maninterval |
Two floats representing the start and end of the management period. Example: maninterval = c(2020.25,2021.25). Default: NULL. |
maneval |
Time at which to evaluate model states. Example: maneval = 2021.25. Default: NULL. |
intermediatePeriodCatch |
Catch during intermediate period, e.g. last year's TAC (default:
|
intermediatePeriodCatchSDFac |
Factor for the multiplication of the standard deviation of the catch during the intermediate period (default: 1). |
intermediatePeriodCatchList |
List defining catch in the intermediate period obtaining the elements 'obsC', 'timeC', and 'dtc' (optional element 'stdevfacC' which is 1 if not provided) |
verbose |
Should detailed outputs be provided (default: TRUE). |
dbg |
Debug flag, dbg=1 some output, dbg=2 more output. |
The 8 default scenarios are:
"1""currentCatch": Keep the catch of the current year (i.e. the last observed catch).
"2""currentF": Keep the F of the current year.
"3""Fmsy": Fish at Fmsy i.e. F=Fmsy.
"4""noF": No fishing, reduce to 1% of current F.
"5""reduceF25": Reduce F by X%. Default X = 25.
"6""increaseF25": Increase F by X%. Default X = 25.
"7""msyHockeyStick": Use ICES MSY hockey-stick advice rule (ICES, 2017).
"8""ices": Use ICES MSY 35th hockey-stick advice rule (ICES, 2019).
Scenario 7 implements the ICES MSY advice rule for stocks that are assessed using spict (ICES 2017). MSY B_trigger is set equal to B_MSY / 2. Then fishing mortality in the short forecast is calculated as:
F(y+1) = F(y) * min 1, median[B(y+1) / MSY B_trigger] / median[F(y)/F_MSY
Scenario 8 is similar to scenario 7, but includes assessment uncertainty in the predictions by using the 35th percentile of the distributions of the predicted catch, B/B_MSY and F/F_MSY.
Dependent on the start of the management period (e.g. advice year), there might be a time lag between the last observation and the start of the management period, often referred to as the intermediate period. If this is the case, an assumption about the catch during intermediate time period (e.g. assessment year) has to be made. Two meaningful assumptions are:
1:The catch in the intermediate period is based on the fishing mortality which is extrapolated from the previous year. This is the default assumption;
2:The catch in the intermediate period is directly specified. This
could for example be the TAC recommended in the previous year. The catch can
be specified by means of the argument intermediatePeriodCatch
. Be
aware that this catch might correspond to several years or a fraction of a
year depending on the time between the last observation and the start of the
management period. The function man.timeline
can help
visualising the default or specified intermediate period in your data. The
argument intermediatePeriodCatchSDFac
allows to specify the factor
with which to multiply the standard deviation of the catch ()
with. It is thus a measure of the certainty around the catch in the
intermediate period. The argument
intermediatePeriodCatchList
allows
to define a list with catches and their intervals. It is a list with the
elements 'obsC', 'timeC', 'dtc' and the optional element 'stdevfacC' (which
is equal to 1 if not provided).
List containing results of management calculations.
ICES. 2017. Report of the Workshop on the Development of the ICES approach to providing MSY advice for category 3 and 4 stocks (WKMSYCat34), 6-10 March 2017, Copenhagen, Denmark. ICES CM 2017/ACOM:47. 53 pp.
data(pol) rep <- fit.spict(pol$albacore) repman <- manage(rep, c(2,4,8)) sumspict.manage(repman) # To print projections
data(pol) rep <- fit.spict(pol$albacore) repman <- manage(rep, c(2,4,8)) sumspict.manage(repman) # To print projections
Convert mean and variance to shape and rate of gamma distribution
meanvar2shaperate(mean, var)
meanvar2shaperate(mean, var)
mean |
Mean value. |
var |
Variance. |
Vector containing shape and rate parameters.
Convert mode and fractile to shape and rate in Gamma distribution (only for mode>0, i.e. shape >= 1)
modefrac2shaperate(mode, xf, f = 0.9)
modefrac2shaperate(mode, xf, f = 0.9)
mode |
x for which f(x) is at the maximum |
xf |
x for which P(X<=x) = f |
f |
fractile |
Vector containing shape and rate parameters.
Calculate Mohn's rho for different estimates
mohns_rho(rep, what = c("FFmsy", "BBmsy"), annualfunc = mean)
mohns_rho(rep, what = c("FFmsy", "BBmsy"), annualfunc = mean)
rep |
A valid result from fit.spict |
what |
character vector specifying the quantities |
annualfunc |
function used to convert subannual data into annual |
A function that calculates Mohn's rho for selected estimated quantities. The function allows the user to define the method of aggrgating from the subannual time steps (1/dteuler) into annual values; the default is to take the mean.
A named vector with the Monh's rho value for each quantity.
data(pol) inp <- pol$albacore rep <- fit.spict(inp) rep <- retro(rep, nretroyear = 4) mohns_rho(rep)
data(pol) inp <- pol$albacore rep <- fit.spict(inp) rep <- retro(rep, nretroyear = 4) mohns_rho(rep)
Plot osar acf
osar.acf.plot(res, lag.max, pval, ylab)
osar.acf.plot(res, lag.max, pval, ylab)
res |
Residuals |
lag.max |
Maximum lag to use in acf calculations. |
pval |
P value |
ylab |
Y-axis label |
Nothing.
Plot osar qq
osar.qq.plot(res, pval)
osar.qq.plot(res, pval)
res |
Residuals |
pval |
P value |
Nothing.
Plot model points colored depending on the quarter to which they belong.
## S3 method for class 'col' plot( time, obs, obsx = NULL, pch = 1, add = FALSE, typ = "p", do.line = TRUE, add.legend = FALSE, add.vline.at = NULL, ... )
## S3 method for class 'col' plot( time, obs, obsx = NULL, pch = 1, add = FALSE, typ = "p", do.line = TRUE, add.legend = FALSE, add.vline.at = NULL, ... )
time |
Time vector. |
obs |
Observation vector (or residual vector). |
obsx |
Second observation vector for use as independent variable instead of time. |
pch |
Point character. |
add |
If TRUE plot is added to the current plot. |
typ |
Plot type. |
do.line |
If TRUE draw a line between points. |
add.legend |
If TRUE add legend containing information on quarters. |
add.vline.at |
If not NULL will draw a vertical line at the given time point. |
... |
Additional plotting arguments. |
Nothing.
Plot summarising spict results.
## S3 method for class 'spictcls' plot(x, stamp = get.version(), verbose = TRUE, CI = 0.95, ...)
## S3 method for class 'spictcls' plot(x, stamp = get.version(), verbose = TRUE, CI = 0.95, ...)
x |
A result report as generated by running fit.spict. |
stamp |
Stamp plot with this character string. |
verbose |
Should detailed outputs be provided (default: TRUE). |
CI |
Confidence intervals to be calculated, e.g. 0.9 for the 90% confidence intervals. By default (CI = 0.95), the 95% confidence intervals are estimated. |
... |
additional arguments affecting the summary produced. |
Create a plot containing the following:
1. Estimated biomass using plotspict.biomass().
2. Estimated fishing mortality using plotspict.f().
3. Observed versus predicted catches using plotspict.catch().
4. Estimated biomass relative to Bmsy using plotspict.bbmsy().
5. Estimated fishing mortality relative to Fmsy using plotspict.ffmsy().
6. Estimated F versus estimated B using plotspict.fb().
7. Observed versus theoretical production using plotspict.production().
Optional plots included if relevant:
Estimated seasonal spline using plotspict.season().
Calculated time-constant using plotspict.tc().
First prior and corresponding posterior distribution using plotspict.priors().
One-step-ahead residuals of catches using plotspict.osar().
One-step-ahead residuals of catches using plotspict.osar().
If no management scenarios are included in rep$man
, the grey vertical
line corresponds to the time of the last observation. If management scenarios
are included in rep$man
, the prediction and confidence intervals of
the base scenario (rep
) are omitted and instead the projections of the
different management scenarios are drawn in different colours. Dotted lines
of the management scenarios reflect the intermediate period, while solid
lines reflect the management period. Additionally, two vertical lines
correspond to the start and end of the management period.
Be aware that potential catch intervals of more a year, e.g. biennial assessment so that the intermediate period spans two years, or management period spans two years, are equally split up into annual intervals.
Be aware of the fact that the catches represent intervals, where the length
of the interval is indicated by dtc
, e.g. with . In the plot the catches (and vertical lines) correspond to the
beginning of the catch interval. It might thus seem as if the time of the
vertical lines and the management interval would not align.
Nothing.
data(pol) rep <- fit.spict(pol$albacore) plot(rep)
data(pol) rep <- fit.spict(pol$albacore) plot(rep)
Plot summarising spict results (alternative plot composition)
plot2(rep, stamp = get.version(), verbose = TRUE, CI = 0.95, ...)
plot2(rep, stamp = get.version(), verbose = TRUE, CI = 0.95, ...)
rep |
A result report as generated by running fit.spict. |
stamp |
Stamp plot with this character string. |
verbose |
Should detailed outputs be provided (default: TRUE). |
CI |
Confidence intervals to be calculated, e.g. 0.9 for the 90% confidence intervals. By default (CI = 0.95), the 95% confidence intervals are estimated. |
... |
additional arguments affecting the summary produced. |
Create a plot containing the following:
1. Estimated biomass relative to Bmsy using plotspict.bbmsy().
2. Estimated fishing mortality relative to Fmsy using plotspict.ffmsy().
3. Observed versus predicted catches using plotspict.catch().
4. Estimated F versus estimated B using plotspict.fb().
If no management scenarios are included in rep$man
, the grey vertical
line corresponds to the time of the last observation. If management scenarios
are included in rep$man
, the prediction and confidence intervals of
the base scenario (rep
) are omitted and instead the projections of the
different management scenarios are drawn in different colours. Dotted lines
of the management scenarios reflect the intermediate period, while solid
lines reflect the management period. Additionally, two vertical lines
correspond to the start and end of the management period.
Be aware that potential catch intervals of more a year, e.g. biennial assessment so that the intermediate period spans two years, or management period spans two years, are equally split up into annual intervals.
Be aware of the fact that the catches represent intervals, where the length
of the interval is indicated by dtc
, e.g. with . In the plot the catches (and vertical lines) correspond to the
beginning of the catch interval. It might thus seem as if the time of the
vertical lines and the management interval would not align.
Nothing.
data(pol) rep <- fit.spict(pol$albacore) plot2(rep)
data(pol) rep <- fit.spict(pol$albacore) plot2(rep)
Plot priors of Meyer & Millar model
## S3 method for class 'priors' plot(nm, priorsin, add = TRUE, ...)
## S3 method for class 'priors' plot(nm, priorsin, add = TRUE, ...)
nm |
Name of prior |
priorsin |
List of priors, typically inp$meyermillar$priors. |
add |
If TRUE add to current plot. |
... |
Additional arguments to plot. |
Nothing.
Plot estimated B/Bmsy.
plotspict.bbmsy( rep, logax = FALSE, main = "Relative biomass", ylim = NULL, plot.obs = TRUE, qlegend = TRUE, lineat = 1, xlab = "Time", stamp = get.version(), verbose = TRUE, CI = 0.95 )
plotspict.bbmsy( rep, logax = FALSE, main = "Relative biomass", ylim = NULL, plot.obs = TRUE, qlegend = TRUE, lineat = 1, xlab = "Time", stamp = get.version(), verbose = TRUE, CI = 0.95 )
rep |
A result report as generated by running fit.spict. |
logax |
Take log of y-axis? default: FALSE |
main |
Title of plot. |
ylim |
Limits for y-axis. |
plot.obs |
If TRUE observations are plotted. |
qlegend |
If TRUE legend explaining colours of observation data is plotted. |
lineat |
Draw horizontal line at this y-value. |
xlab |
Label of x-axis. |
stamp |
Stamp plot with this character string. |
verbose |
Should detailed outputs be provided (default: TRUE). |
CI |
Confidence intervals to be calculated, e.g. 0.9 for the 90% confidence intervals. By default (CI = 0.95), the 95% confidence intervals are estimated. |
Plots estimated B/Bmsy.
If no management scenarios are included in rep$man
, the grey vertical
line corresponds to the time of the last observation. If management scenarios
are included in rep$man
, the prediction and confidence intervals of
the base scenario (rep
) are omitted and instead the projections of the
different management scenarios are drawn in different colours. Dotted lines
of the management scenarios reflect the intermediate period, while solid
lines reflect the management period. Additionally, two vertical lines
correspond to the start and end of the management period.
Nothing.
data(pol) rep <- fit.spict(pol$albacore) plotspict.bbmsy(rep)
data(pol) rep <- fit.spict(pol$albacore) plotspict.bbmsy(rep)
Plot estimated biomass.
plotspict.biomass( rep, logax = FALSE, main = "Absolute biomass", ylim = NULL, plot.obs = TRUE, qlegend = TRUE, xlab = "Time", ylab = NULL, rel.axes = TRUE, rel.ci = TRUE, stamp = get.version(), verbose = TRUE, CI = 0.95 )
plotspict.biomass( rep, logax = FALSE, main = "Absolute biomass", ylim = NULL, plot.obs = TRUE, qlegend = TRUE, xlab = "Time", ylab = NULL, rel.axes = TRUE, rel.ci = TRUE, stamp = get.version(), verbose = TRUE, CI = 0.95 )
rep |
A result report as generated by running fit.spict. |
logax |
Take log of y-axis? default: FALSE |
main |
Title of plot. |
ylim |
Limits for y-axis. |
plot.obs |
If TRUE observations are plotted. |
qlegend |
If TRUE legend explaining colours of observation data is plotted. |
xlab |
Label of x-axis. |
ylab |
Label of y-axis. |
rel.axes |
Plot secondary y-axis contatning relative level of F. |
rel.ci |
Plot confidence interval for relative level of F. |
stamp |
Stamp plot with this character string. |
verbose |
Should detailed outputs be provided (default: TRUE). |
CI |
Confidence intervals to be calculated, e.g. 0.9 for the 90% confidence intervals. By default (CI = 0.95), the 95% confidence intervals are estimated. |
Plots estimated biomass, Bmsy with confidence limits.
If no management scenarios are included in rep$man
, the grey vertical
line corresponds to the time of the last observation. If management scenarios
are included in rep$man
, the prediction and confidence intervals of
the base scenario (rep
) are omitted and instead the projections of the
different management scenarios are drawn in different colours. Dotted lines
of the management scenarios reflect the intermediate period, while solid
lines reflect the management period. Additionally, two vertical lines
correspond to the start and end of the management period.
Nothing.
data(pol) rep <- fit.spict(pol$albacore) plotspict.biomass(rep)
data(pol) rep <- fit.spict(pol$albacore) plotspict.biomass(rep)
Plot the expected biomass trend
plotspict.btrend(rep, CI = 0.95)
plotspict.btrend(rep, CI = 0.95)
rep |
A result report as generated by running fit.spict. |
CI |
Confidence intervals to be calculated, e.g. 0.9 for the 90% confidence intervals. By default (CI = 0.95), the 95% confidence intervals are estimated. |
Nothing.
Plot observed catch and predictions.
plotspict.catch( rep, main = "Catch", ylim = NULL, qlegend = TRUE, lcol = "blue", xlab = "Time", ylab = NULL, stamp = get.version(), verbose = TRUE, CI = 0.95 )
plotspict.catch( rep, main = "Catch", ylim = NULL, qlegend = TRUE, lcol = "blue", xlab = "Time", ylab = NULL, stamp = get.version(), verbose = TRUE, CI = 0.95 )
rep |
A result report as generated by running fit.spict. |
main |
Title of plot. |
ylim |
Limits for y-axis. |
qlegend |
If TRUE legend explaining colours of observation data is plotted. |
lcol |
Colour of prediction lines. |
xlab |
Label of x-axis. |
ylab |
Label of y-axis. |
stamp |
Stamp plot with this character string. |
verbose |
Should detailed outputs be provided (default: TRUE). |
CI |
Confidence intervals to be calculated, e.g. 0.9 for the 90% confidence intervals. By default (CI = 0.95), the 95% confidence intervals are estimated. |
Plots observed catch and predictions using the current F and Fmsy. The plot
also contains the equilibrium catch if the current F is maintained. If no
management scenarios are included in rep$man
, the grey vertical line
corresponds to the time of the last observation.
If management scenarios are included in rep$man
, the prediction and
confidence intervals of the base scenario (rep
) are omitted and
instead the projections of the different management scenarios are drawn in
different colours. Generally, dotted lines of the management scenarios
reflect the intermediate period, while solid lines reflect the management
period. The catch of management period which are longer than 1 year are split
up equally into annual intervals. Two vertical lines correspond to the start
and end of the management period, respectively. However, there are special
cases in which there is only one or no vertical line drawn, the catch
trajectories are missing completely, or the line of the catch trajectory is
solid even in the intermediate period. These cases and their implications on
the annual catch plot are described in the following:
If the management period is shorter than a year, no catch trajectories are drawn and there is only one vertical line indicating the start of the assessment period.
If the management timeline differs between the scenarios in
rep$man
, no vertical lines are drawn as they would be at different
times for each scenario.
If the management period cannot be split equally into annual intervals, e.g. because it is 1.5 years long, the uneven remains are not displayed, in this example only the catch representative of one year is displayed. Additionally, the second vertical line indicating the end of the management period is omitted.
If the intermediate period is shorter or longer than a year, e.g. 0.5 or 1.25 years, the lines of the management period start at the time of the last observation, because the catch in the intermediate period cannot be aggregated and displayed correctly. Additionally, the first vertical line indicating the start of the management period is omitted.
All catches in SPiCT represent intervals, where the length of the interval is
indicated by dtc
, e.g. with . In
the plot the catches (and vertical lines) correspond to the beginning of the
catch interval. It might thus seem as if the time of the vertical lines and
the management interval would not align.
Nothing.
data(pol) rep <- fit.spict(pol$albacore) plotspict.catch(rep)
data(pol) rep <- fit.spict(pol$albacore) plotspict.catch(rep)
Plot catch and index data.
plotspict.ci(inp, stamp = get.version())
plotspict.ci(inp, stamp = get.version())
inp |
An input list containing data. |
stamp |
Stamp plot with this character string. |
Nothing
Compare different spict fits
plotspict.compare( rep, ..., varname = c("B", "F", "C", "BBmsy", "FFmsy", "P"), exp = TRUE, CI = 0.95, plot.unc = TRUE, col = c("dodgerblue2", "darkorange1", "forestgreen", "goldenrod1", "purple2", "firebrick3", "skyblue4", "darkgreen", "salmon3", "brown2"), asp = 2, plot.legend = TRUE, stamp = get.version() )
plotspict.compare( rep, ..., varname = c("B", "F", "C", "BBmsy", "FFmsy", "P"), exp = TRUE, CI = 0.95, plot.unc = TRUE, col = c("dodgerblue2", "darkorange1", "forestgreen", "goldenrod1", "purple2", "firebrick3", "skyblue4", "darkgreen", "salmon3", "brown2"), asp = 2, plot.legend = TRUE, stamp = get.version() )
rep |
A result report as generated by running |
... |
Optional additional spict fits. |
varname |
Name of the variable to be plotted. The following options are
currently implemented: |
exp |
Logical; indicating whether to plot the results on the natural or
logarithmic scale. By default ( |
CI |
Confidence intervals to be calculated, e.g. 0.9 for the 90
confidence intervals. By default ( |
plot.unc |
Logical or integer indicating whether to include the
uncertainty intervals (CIs). If equal to |
col |
Colours for different spict fits. |
asp |
Positive number deining the target aspect ratio (columns / rows) of the plot arrangement. |
plot.legend |
Logical; Indicating whether to include a legend. Default:
|
stamp |
Stamp plot with this character string. |
This function plots the results of spict fits in a single plot
data(pol) inp <- pol$albacore inp$dteuler <- 1/8 rep1 <- fit.spict(inp) inp$priors$logbkfrac <- c(log(0.3), 0.1, 1) rep2 <- fit.spict(inp) plotspict.compare(list(def = rep1, bkprior = rep2))
data(pol) inp <- pol$albacore inp$dteuler <- 1/8 rep1 <- fit.spict(inp) inp$priors$logbkfrac <- c(log(0.3), 0.1, 1) rep2 <- fit.spict(inp) plotspict.compare(list(def = rep1, bkprior = rep2))
Compare one variable of different spict fits
plotspict.compare.one( rep, ..., varname = c("B", "F", "C", "BBmsy", "FFmsy", "P"), exp = TRUE, CI = 0.95, plot.unc = 1, col = c("dodgerblue2", "darkorange1", "forestgreen", "goldenrod1", "purple2", "firebrick3", "skyblue4", "darkgreen", "salmon3", "brown2"), xlab = NULL, ylab = NULL, main = NULL, plot.legend = TRUE, stamp = get.version() )
plotspict.compare.one( rep, ..., varname = c("B", "F", "C", "BBmsy", "FFmsy", "P"), exp = TRUE, CI = 0.95, plot.unc = 1, col = c("dodgerblue2", "darkorange1", "forestgreen", "goldenrod1", "purple2", "firebrick3", "skyblue4", "darkgreen", "salmon3", "brown2"), xlab = NULL, ylab = NULL, main = NULL, plot.legend = TRUE, stamp = get.version() )
rep |
A result report as generated by running |
... |
Optional additional spict fits. |
varname |
Name of the variable to be plotted. The following options are
currently implemented: |
exp |
Logical; indicating whether to plot the results on the natural or
logarithmic scale. By default ( |
CI |
Confidence intervals to be calculated, e.g. 0.9 for the 90
confidence intervals. By default ( |
plot.unc |
Logical or integer indicating whether to include the
uncertainty intervals (CIs). If equal to |
col |
Colours for different spict fits. |
xlab |
Label for x-axis. By default ( |
ylab |
Label for y-axis. By default ( |
main |
Title of plot. By default ( |
plot.legend |
Logical; Indicating whether to include a legend. Default:
|
stamp |
Stamp plot with this character string. |
This function plots the results of the hindcasting cross validation analysis for each index.
data(pol) inp <- pol$albacore inp$dteuler <- 1/8 rep1 <- fit.spict(inp) inp$priors$logbkfrac <- c(log(0.3), 0.1, 1) rep2 <- fit.spict(inp) ## Not run: plotspict.compare.one(rep1, rep2, varname = "F") ## End(Not run)
data(pol) inp <- pol$albacore inp$dteuler <- 1/8 rep1 <- fit.spict(inp) inp$priors$logbkfrac <- c(log(0.3), 0.1, 1) rep2 <- fit.spict(inp) ## Not run: plotspict.compare.one(rep1, rep2, varname = "F") ## End(Not run)
Plot input data
plotspict.data( inpin, MSY = NULL, one.index = NULL, qlegend = TRUE, stamp = get.version() )
plotspict.data( inpin, MSY = NULL, one.index = NULL, qlegend = TRUE, stamp = get.version() )
inpin |
An input list containing data. |
MSY |
Value of MSY. |
one.index |
Integer indicating the number of the index to plot. |
qlegend |
If TRUE legend explaining colours of observation data is plotted. |
stamp |
Stamp plot with this character string. |
Nothing
Plot model diagnostic (data, residuals, and more)
plotspict.diagnostic( rep, lag.max = 4, qlegend = TRUE, plot.data = TRUE, mfcol = FALSE, stamp = get.version() )
plotspict.diagnostic( rep, lag.max = 4, qlegend = TRUE, plot.data = TRUE, mfcol = FALSE, stamp = get.version() )
rep |
A result report as generated by running fit.spict. |
lag.max |
Maximum lag to use in acf calculations. |
qlegend |
If TRUE plot a legend showing quarter of year information. |
plot.data |
If TRUE plot data in the top row (this option is only applied if osa residuals have been calculated). |
mfcol |
If TRUE plot plots columnwise (FALSE => rowwise). |
stamp |
Stamp plot with this character string. |
Nothing.
data(pol) rep <- fit.spict(pol$albacore) rep <- calc.osa.resid(rep) plotspict.diagnostic(rep)
data(pol) rep <- fit.spict(pol$albacore) rep <- calc.osa.resid(rep) plotspict.diagnostic(rep)
Plot model diagnostics regarding processes and process residuals
plotspict.diagnostic.process( rep, lag.max = 4, qlegend = TRUE, plot.data = TRUE, mfcol = FALSE, add.loess = FALSE, span = 0.75, stamp = get.version() )
plotspict.diagnostic.process( rep, lag.max = 4, qlegend = TRUE, plot.data = TRUE, mfcol = FALSE, add.loess = FALSE, span = 0.75, stamp = get.version() )
rep |
A result report as generated by running |
lag.max |
Maximum lag to use in acf calculations. |
qlegend |
If TRUE plot a legend showing quarter of year information. |
plot.data |
If TRUE plot data in the top row (this option is only applied if osa residuals have been calculated). |
mfcol |
If TRUE plot plots columnwise (FALSE => rowwise). |
add.loess |
Add smooth line (using |
span |
Parameter that controls the degree of smoothing (only used if |
stamp |
Stamp plot with this character string. |
Invisible NULL
process.resid
data(pol) inp <- pol$albacore rep <- fit.spict(inp) rep <- calc.process.resid(rep) plotspict.diagnostic.process(rep)
data(pol) inp <- pol$albacore rep <- fit.spict(inp) rep <- calc.process.resid(rep) plotspict.diagnostic.process(rep)
Plot estimated fishing mortality.
plotspict.f( rep, logax = FALSE, main = "Absolute fishing mortality", ylim = NULL, plot.obs = TRUE, qlegend = TRUE, xlab = "Time", ylab = NULL, rel.axes = TRUE, rel.ci = TRUE, stamp = get.version(), verbose = TRUE, CI = 0.95 )
plotspict.f( rep, logax = FALSE, main = "Absolute fishing mortality", ylim = NULL, plot.obs = TRUE, qlegend = TRUE, xlab = "Time", ylab = NULL, rel.axes = TRUE, rel.ci = TRUE, stamp = get.version(), verbose = TRUE, CI = 0.95 )
rep |
A result report as generated by running fit.spict. |
logax |
Take log of y-axis? default: FALSE |
main |
Title of plot. |
ylim |
Limits for y-axis. |
plot.obs |
If TRUE observations are plotted. |
qlegend |
If TRUE legend explaining colours of observation data is plotted. |
xlab |
Label of x-axis. |
ylab |
Label of y-axis. |
rel.axes |
Plot secondary y-axis contatning relative level of F. |
rel.ci |
Plot confidence interval for relative level of F. |
stamp |
Stamp plot with this character string. |
verbose |
Should detailed outputs be provided (default: TRUE). |
CI |
Confidence intervals to be calculated, e.g. 0.9 for the 90% confidence intervals. By default (CI = 0.95), the 95% confidence intervals are estimated. |
Plots estimated fishing mortality with Fmsy and associated confidence interval.
If no management scenarios are included in rep$man
, the grey vertical
line corresponds to the time of the last observation. If management scenarios
are included in rep$man
, the prediction and confidence intervals of
the base scenario (rep
) are omitted and instead the projections of the
different management scenarios are drawn in different colours. Dotted lines
of the management scenarios reflect the intermediate period, while solid
lines reflect the management period. Additionally, two vertical lines
correspond to the start and end of the management period.
Nothing.
data(pol) rep <- fit.spict(pol$albacore) plotspict.f(rep)
data(pol) rep <- fit.spict(pol$albacore) plotspict.f(rep)
Plot fishing mortality versus biomass.
plotspict.fb( rep, logax = FALSE, plot.legend = TRUE, man.legend = TRUE, ext = TRUE, rel.axes = FALSE, xlim = NULL, ylim = NULL, labpos = c(1, 1), xlabel = NULL, stamp = get.version(), verbose = TRUE, CI = 0.95 )
plotspict.fb( rep, logax = FALSE, plot.legend = TRUE, man.legend = TRUE, ext = TRUE, rel.axes = FALSE, xlim = NULL, ylim = NULL, labpos = c(1, 1), xlabel = NULL, stamp = get.version(), verbose = TRUE, CI = 0.95 )
rep |
A result report as generated by running fit.spict. |
logax |
Take log of x and y-axes? default: FALSE |
plot.legend |
Plot legend explaining triangle. |
man.legend |
Plot legend explaining management scenarios.. |
ext |
Add relative level axis to top and right side. |
rel.axes |
Plot axes in relative levels instead of absolute. |
xlim |
Limits of x-axis. |
ylim |
Limits of y-axis. |
labpos |
Positions of time stamps of start and end points as in pos in text(). |
xlabel |
Label of x-axis. If NULL not used. |
stamp |
Stamp plot with this character string. |
verbose |
Should detailed outputs be provided (default: TRUE). |
CI |
Confidence intervals to be calculated, e.g. 0.9 for the 90% confidence intervals. By default (CI = 0.95), the 95% confidence intervals are estimated. |
Plots estimated fishing mortality as a function of biomass together with reference points and the prediction for next year given a constant F. The equilibrium biomass for F fixed to the current value is also plotted.
The predicted trajectory (or trajectories of different management scenarios) are only plotted for annnual data.
Nothing.
data(pol) rep <- fit.spict(pol$albacore) plotspict.fb(rep)
data(pol) rep <- fit.spict(pol$albacore) plotspict.fb(rep)
Plot estimated relative fishing mortality.
plotspict.ffmsy( rep, logax = FALSE, main = "Relative fishing mortality", ylim = NULL, plot.obs = TRUE, qlegend = TRUE, lineat = 1, xlab = "Time", stamp = get.version(), verbose = TRUE, CI = 0.95 )
plotspict.ffmsy( rep, logax = FALSE, main = "Relative fishing mortality", ylim = NULL, plot.obs = TRUE, qlegend = TRUE, lineat = 1, xlab = "Time", stamp = get.version(), verbose = TRUE, CI = 0.95 )
rep |
A result report as generated by running fit.spict. |
logax |
Take log of y-axis? default: FALSE |
main |
Title of plot. |
ylim |
Limits for y-axis. |
plot.obs |
If TRUE observations are plotted. |
qlegend |
If TRUE legend explaining colours of observation data is plotted. |
lineat |
Draw horizontal line at this y-value. |
xlab |
Label of x-axis. |
stamp |
Stamp plot with this character string. |
verbose |
Should detailed outputs be provided (default: TRUE). |
CI |
Confidence intervals to be calculated, e.g. 0.9 for the 90% confidence intervals. By default (CI = 0.95), the 95% confidence intervals are estimated. |
Plots estimated fishing mortality with Fmsy and associated confidence interval.
If no management scenarios are included in rep$man
, the grey vertical
line corresponds to the time of the last observation. If management scenarios
are included in rep$man
, the prediction and confidence intervals of
the base scenario (rep
) are omitted and instead the projections of the
different management scenarios are drawn in different colours. Dotted lines
of the management scenarios reflect the intermediate period, while solid
lines reflect the management period. Additionally, two vertical lines
correspond to the start and end of the management period.
Nothing.
data(pol) rep <- fit.spict(pol$albacore) plotspict.ffmsy(rep)
data(pol) rep <- fit.spict(pol$albacore) plotspict.ffmsy(rep)
Plot estimated time-varying growth
plotspict.growth( rep, logax = FALSE, main = "Time-varying growth", ylim = NULL, xlim = NULL, xlab = "Time", plot.ci = TRUE, stamp = get.version(), CI = 0.95 )
plotspict.growth( rep, logax = FALSE, main = "Time-varying growth", ylim = NULL, xlim = NULL, xlab = "Time", plot.ci = TRUE, stamp = get.version(), CI = 0.95 )
rep |
A result report as generated by running fit.spict. |
logax |
Take log of y-axis? default: FALSE |
main |
Title of plot. |
ylim |
Limits for y-axis. |
xlim |
Limits for x-axis. |
xlab |
Label of x-axis. |
plot.ci |
If TRUE 95% CIs are included. |
stamp |
Stamp plot with this character string. |
CI |
Confidence intervals to be calculated, e.g. 0.9 for the 90% confidence intervals. By default (CI = 0.95), the 95% confidence intervals are estimated. |
Plots estimated time-varying growth
Nothing.
A comparison of all management scenarios in rep$man
. For
each scenario, the fishing mortality in the management period is shown
against the relative biomass at the point of the harvest control rule
(HCR) evaluation.
plotspict.hcr(rep, xlim = c(0, 3), CI = 0.95)
plotspict.hcr(rep, xlim = c(0, 3), CI = 0.95)
rep |
A result report as generated by running |
xlim |
Numeric vector with the lower and upper x-axis limits |
CI |
Confidence intervals to be calculated, e.g. 0.9 for the 90% confidence intervals. By default (CI = 0.95), the 95% confidence intervals are estimated. |
Invisible NULL
rep <- fit.spict(pol$hake) rep <- manage(rep) plotspict.hcr(rep)
rep <- fit.spict(pol$hake) rep <- manage(rep) plotspict.hcr(rep)
Hindcasting plot for indices
plotspict.hindcast( rep, add.mase = TRUE, CI = 0.95, verbose = TRUE, xlim = NULL, ylim = NULL, xlab = "Year", ylab = NA, plot.log = TRUE, mfrow = NULL, mar = c(2, 2, 3, 1) + 0.1, oma = c(3, 3, 1, 1), legend.title = NULL, legend.pos = "topright", legend.ncol = 1, asp = 2, stamp = get.version() )
plotspict.hindcast( rep, add.mase = TRUE, CI = 0.95, verbose = TRUE, xlim = NULL, ylim = NULL, xlab = "Year", ylab = NA, plot.log = TRUE, mfrow = NULL, mar = c(2, 2, 3, 1) + 0.1, oma = c(3, 3, 1, 1), legend.title = NULL, legend.pos = "topright", legend.ncol = 1, asp = 2, stamp = get.version() )
rep |
A result report as generated by running |
add.mase |
Calculate Mean Absolute Scaled Error (MASE) and add it to the plots. |
CI |
Confidence intervals to be calculated, e.g. 0.9 for the 90% confidence intervals. By default (CI = 0.95), the 95% confidence intervals are estimated. |
verbose |
Should detailed outputs be provided (default: TRUE). |
xlim |
Limits for x-axis. |
ylim |
Limits for y-axis. |
xlab |
Label for x-axis, "Year" by default. |
ylab |
Label for y-axis, "Index" by default. |
plot.log |
Should values be plotted on the log scale (default: TRUE). |
mfrow |
A vector of the form ‘c(nr, nc)’. Subsequent figures will be drawn in an ‘nr’-by-‘nc’ array on the device by _rows_. Default: NULL. |
mar |
A numerical vector of the form ‘c(bottom, left, top, right)’ which gives the number of lines of margin to be specified on the four sides of the plot. The default is ‘c(2, 2, 3, 1) + 0.1’. |
oma |
A vector of the form ‘c(bottom, left, top, right)’ giving the size of the outer margins in lines of text. |
legend.title |
Legend title. By default no title is used: "". |
legend.pos |
Legend position (default: "topright"). If NULL or NA, no legend is plotted. |
legend.ncol |
Legend number of columns (default: 1). |
asp |
positive number; the target aspect ratio (columns / rows) in the graphical output. Default: 2. |
stamp |
Stamp plot with this character string. |
This function plots the results of the hindcasting cross validation analysis for each index.
MASE or Invisible NULL
Carvalho, F., Winker, H., Courtney, D., Kapur, M., Kell, L., Cardinale, M., Schirripa, M., Kitakado, T., Yemane, D., Piner, K.R. Maunder, M.N., Taylor, I., Wetzel, C.R., Doering, K., Johnsonm, K.F., Methot, R. D. (2021). A cookbook for using model diagnostics in integrated stock assessments. Fisheries Research, 240, 105959.
Kell, L. T., Kimoto, A., & Kitakado, T. (2016). Evaluation of the prediction skill of stock assessment using hindcasting. Fisheries research, 183, 119-127.
Kell, L. T., Sharma, R., Kitakado, T., Winker, H., Mosqueira, I., Cardinale, M., & Fu, D. (2021). Validation of stock assessment methods: is it me or my model talking?. ICES Journal of Marine Science, 78(6), 2244-2255.
Winker, H., Carvalho, F., & Kapur, M. (2018). JABBA: just another Bayesian biomass assessment. Fisheries Research, 204, 275-288.
data(pol) inp <- pol$albacore rep <- fit.spict(inp) rep <- hindcast(rep, npeels = 5) plotspict.hindcast(rep)
data(pol) inp <- pol$albacore rep <- fit.spict(inp) rep <- hindcast(rep, npeels = 5) plotspict.hindcast(rep)
Plots influence statistics of observations.
plotspict.infl(rep, stamp = get.version())
plotspict.infl(rep, stamp = get.version())
rep |
A valid result from calc.influence(). |
stamp |
Stamp plot with this character string. |
TBA
Nothing.
Plots summary of influence statistics of observations.
plotspict.inflsum(rep, stamp = get.version())
plotspict.inflsum(rep, stamp = get.version())
rep |
A valid result from calc.influence(). |
stamp |
Stamp plot with this character string. |
TBA
Nothing.
Plots result of likelihood profiling.
plotspict.likprof(input, logpar = FALSE, stamp = get.version(), CI = 0.95)
plotspict.likprof(input, logpar = FALSE, stamp = get.version(), CI = 0.95)
input |
Result of running likprof.spict(). |
logpar |
If TRUE log of parameters are shown. |
stamp |
Stamp plot with this character string. |
CI |
Confidence intervals to be calculated, e.g. 0.9 for the 90% confidence intervals. By default (CI = 0.95), the 95% confidence intervals are estimated. |
TBA
Nothing but shows a plot.
Plot one-step-ahead residuals
plotspict.osar(rep, collapse.I = TRUE, qlegend = TRUE)
plotspict.osar(rep, collapse.I = TRUE, qlegend = TRUE)
rep |
A result report as generated by running fit.spict. |
collapse.I |
Collapse index residuals into one plot. Default: TRUE. |
qlegend |
Plot legend for quarters. |
Plots observed versus predicted catches.
Nothing.
data(pol) rep <- fit.spict(pol$albacore) rep <- calc.osa.resid(rep) plotspict.osar(rep)
data(pol) rep <- fit.spict(pol$albacore) rep <- calc.osa.resid(rep) plotspict.osar(rep)
Plot priors and posterior distribution.
plotspict.priors( rep, do.plot = NULL, stamp = get.version(), automfrow = TRUE, CI = 0.95 )
plotspict.priors( rep, do.plot = NULL, stamp = get.version(), automfrow = TRUE, CI = 0.95 )
rep |
A result from fit.spict. |
do.plot |
Optional integer defining maximum number of priors to plot. Set to NULL to plot all active priors. Default: NULL |
stamp |
Stamp plot with this character string. |
automfrow |
Automatically set 'mfrow' to see all priors in one plot? Not used if do.plot is set. Default: TRUE |
CI |
Confidence intervals to be calculated, e.g. 0.9 for the 90% confidence intervals. By default (CI = 0.95), the 95% confidence intervals are estimated. |
Nothing
Plot theoretical production curve and estimates.
plotspict.production( rep, n.plotyears = 40, main = "Production curve", stamp = get.version(), CI = 0.95 )
plotspict.production( rep, n.plotyears = 40, main = "Production curve", stamp = get.version(), CI = 0.95 )
rep |
A result report as generated by running fit.spict. |
n.plotyears |
Plot years next to points if number of points is below n.plotyears. Default: 40. |
main |
Title of plot. |
stamp |
Stamp plot with this character string. |
CI |
Confidence intervals to be calculated, e.g. 0.9 for the 90% confidence intervals. By default (CI = 0.95), the 95% confidence intervals are estimated. |
Plots the theoretical production curve (production as a function of biomass) as calculated from the estimated model parameters. Overlaid is the estimated production/biomass trajectory.
Nothing.
data(pol) rep <- fit.spict(pol$albacore) plotspict.production(rep)
data(pol) rep <- fit.spict(pol$albacore) plotspict.production(rep)
Plot results of retrospective analysis
plotspict.retro(rep, stamp = get.version(), add.mohn = TRUE, CI = 0.95) plotspict.retro.fixed(rep, CI = 0.95)
plotspict.retro(rep, stamp = get.version(), add.mohn = TRUE, CI = 0.95) plotspict.retro.fixed(rep, CI = 0.95)
rep |
A valid result from fit.spict. |
stamp |
Stamp plot with this character string. |
add.mohn |
Adds Mohn's rho |
CI |
Confidence intervals to be calculated, e.g. 0.9 for the 90% confidence intervals. By default (CI = 0.95), the 95% confidence intervals are estimated. |
Ivisible NULL
. If add.mohn
is TRUE
,
plotspict.retro
returns the Mohn's rho for B/Bmsy and F/Fmsy.
The retrospective runs that did not converge are excluded from the plots and from the calculation of Mohn's rho. A message is displayed in such a case.
Plot the mean F cycle
plotspict.season(rep, stamp = get.version(), CI = 0.95)
plotspict.season(rep, stamp = get.version(), CI = 0.95)
rep |
A result report as generated by running fit.spict. |
stamp |
Stamp plot with this character string. |
CI |
Confidence intervals to be calculated, e.g. 0.9 for the 90% confidence intervals. By default (CI = 0.95), the 95% confidence intervals are estimated. |
If seasonal data are available the seasonal cycle in the fishing mortality can be estimated. This function plots this mean F cycle.
Nothing.
Plot time constant.
plotspict.tc(rep, main = "Time to Bmsy", stamp = get.version(), CI = 0.95)
plotspict.tc(rep, main = "Time to Bmsy", stamp = get.version(), CI = 0.95)
rep |
A result report as generated by running fit.spict. |
main |
Title of plot. |
stamp |
Stamp plot with this character string. |
CI |
Confidence intervals to be calculated, e.g. 0.9 for the 90% confidence intervals. By default (CI = 0.95), the 95% confidence intervals are estimated. |
Plots the time required for the biomass to reach a certain proportion of Bmsy. The time required to reach 95% of Bmsy is highlighted.
Nothing.
data(pol) rep <- fit.spict(pol$albacore) plotspict.tc(rep)
data(pol) rep <- fit.spict(pol$albacore) plotspict.tc(rep)
Fisheries data included in Polacheck et al. (1993).
data(pol)
data(pol)
Data are lists containing data and initial values for estimation formatted to be used as an input to fit.spict().
Fisheries data for South Atlantic albacore, northern Namibian hake, and New Zealand rock lobster.
Polacheck et al. (1993), Canadian Journal of Fisheries and Aquatic Science, vol 50, pp. 2597-2607.
data(pol) rep <- fit.spict(inp=pol$albacore) rep <- fit.spict(inp=pol$hake) rep <- fit.spict(inp=pol$lobster)
data(pol) rep <- fit.spict(inp=pol$albacore) rep <- fit.spict(inp=pol$hake) rep <- fit.spict(inp=pol$lobster)
Helper function for sim.spict().
## S3 method for class 'b' predict(B0, F0, gamma, m, K, n, dt, sdb, btype)
## S3 method for class 'b' predict(B0, F0, gamma, m, K, n, dt, sdb, btype)
B0 |
Initial biomass. |
F0 |
Fishing mortality. |
gamma |
gamma parameter in Fletcher's Pella-Tomlinson formulation. |
m |
m parameter in Fletcher's Pella-Tomlinson formulation. |
K |
Carrying capacity. |
n |
Pella-Tomlinson exponent. |
dt |
Time step. |
sdb |
Standard deviation of biomass process. |
btype |
If 'lamperti' use Lamperti transformed equation, if 'naive' use naive formulation. |
Predicted biomass at the end of dt.
Helper function for sim.spict().
## S3 method for class 'logf' predict(logF0, dt, sdf, efforttype)
## S3 method for class 'logf' predict(logF0, dt, sdf, efforttype)
logF0 |
Fishing mortality. |
dt |
Time step. |
sdf |
Standard deviation of F process. |
efforttype |
If 1 use diffusion on logF, if 2 use diffusion of F with state dependent noise (this induces the drift term -0.5*sdf^2 in log domain) |
Predicted F at the end of dt.
Helper function for sim.spict().
## S3 method for class 'logmre' predict(logmre0, dt, sdm, psi, logm)
## S3 method for class 'logmre' predict(logmre0, dt, sdm, psi, logm)
logmre0 |
Initial value |
dt |
Time step. |
sdm |
Standard deviation of mre process. |
psi |
Degree of attraction toward mean. |
logm |
Mean logm. |
Predicted mre at the end of dt.
Output a summary of a fit.spict() run.
## S3 method for class 'spictcls' print(x, ...)
## S3 method for class 'spictcls' print(x, ...)
x |
A result report as generated by running fit.spict. |
... |
additional arguments affecting the summary produced. |
Nothing.
Estimate deviation between targeted and realised probability of specified model variable hitting a specified reference level under given fishing mortality
probdev( ffac = 1, rep, var = "logBpBmsy", ref = 1, problevel = 0.95, reportmode = 1, getFrac = FALSE, verbose = FALSE )
probdev( ffac = 1, rep, var = "logBpBmsy", ref = 1, problevel = 0.95, reportmode = 1, getFrac = FALSE, verbose = FALSE )
ffac |
Factor to multiply current fishing mortality by (default: 1) |
rep |
A result report as generated by running |
var |
A variable of the spict model (default: "logBpBmsy"). |
ref |
Reference level relative to specified variable (default: 1) |
problevel |
Probability level of the risk aversion (default: 0.95). |
reportmode |
Integer between 0 and 2 determining which objects will be adreported (default: 1). |
getFrac |
logical; return realised fraction of relative state (default: FALSE). |
verbose |
logical; print realised fraction of relative state, fishing mortality factor, and deviation (default: FALSE). |
Returns deviation between targeted and realised probability of hitting specified reference levels under given fishing mortality
Prune a fitted spict object to the core elements
prune.baserun(rep)
prune.baserun(rep)
rep |
Result of fit.spict(). |
Fitted spict core object.
Adds the x-axis to influence plots
put.xax(rep)
put.xax(rep)
rep |
A valid result from calc.influence(). |
TBA
Nothing.
Reads ASPIC input file.
read.aspic(filename)
read.aspic(filename)
filename |
Path of the ASPIC input file. |
Reads an input file following the ASPIC 7 format described in the ASPIC manual (found here http://www.mhprager.com/aspic.html).
A list of input variables that can be used as input to fit.spict().
## Not run: filename <- 'YFT-SSE.a7inp' # or some other ASPIC 7 input file inp <- read.aspic(filename) rep <- fit.spict(inp) summary(rep) plot(rep) ## End(Not run)
## Not run: filename <- 'YFT-SSE.a7inp' # or some other ASPIC 7 input file inp <- read.aspic(filename) rep <- fit.spict(inp) summary(rep) plot(rep) ## End(Not run)
Reads the parameter estimates of an Aspic result file.
read.aspic.res(filename)
read.aspic.res(filename)
filename |
Name of the Aspic result file to read |
TBA
Vector containing the parameter estimates.
Draw CI around a reference point using polygon
refpointci(t, ll, ul, cicol = "ivory2")
refpointci(t, ll, ul, cicol = "ivory2")
t |
Time vector. |
ll |
Lower limit. |
ul |
Upper limit. |
cicol |
Colour of polygon |
Spline design matrix.
Helper function for calc.osar.resid that calculates residual statistics.
res.diagn(resid, id, name = "")
res.diagn(resid, id, name = "")
resid |
Residuals from either catches or indices. |
id |
Identifier for residuals e.g. "C". |
name |
Identifier that will be used in warning messages. |
List containing residual statistics in 'diagn', shapiro output in 'shapiro', and bias output in 'bias'.
Retape a fitted spict model based on an updated input list
retape.spict(rep, inp, verbose = FALSE, dbg = 0, mancheck = TRUE)
retape.spict(rep, inp, verbose = FALSE, dbg = 0, mancheck = TRUE)
rep |
A result report as generated by running |
inp |
Input list with updated settings |
verbose |
logical; print informative text (default: FALSE) |
dbg |
Debug flag, dbg=0 no output, dbg=1 some output, dbg=2 more output (default: 0). |
mancheck |
Logical; Should the time-dependent objects in |
This function reevaluates derived variables of a fitted spict model after updating model settings, such as the prediction horizon or fishing mortality during the predicted time period.
Retaped spict model
Conduct retrospective analysis
retro(rep, nretroyear = 5, reduce_output_size = TRUE, mc.cores = 1)
retro(rep, nretroyear = 5, reduce_output_size = TRUE, mc.cores = 1)
rep |
A valid result from fit.spict. |
nretroyear |
Number of years of data to remove (this is also the total number of model runs). |
reduce_output_size |
logical, if |
mc.cores |
Number of cores for |
A retrospective analysis consists of estimating the model with later data points removed sequentially one year at a time.
A rep list with the added key retro containing the results of the retrospective analysis. Use plotspict.retro() to plot these results.
data(pol) inp <- pol$albacore rep <- fit.spict(inp) rep <- retro(rep, nretroyear=6) plotspict.retro(rep)
data(pol) inp <- pol$albacore rep <- fit.spict(inp) rep <- retro(rep, nretroyear=6) plotspict.retro(rep)
Load season colors.
season.cols(modin)
season.cols(modin)
modin |
Time vector modulo 1. |
Vector containing season colors.
Convert shape and rate of gamma distribution to mean and variance
shaperate2meanvar(shape, rate)
shaperate2meanvar(shape, rate)
shape |
Shape parameter |
rate |
Rate parameter (scale = 1/rate). |
Vector containing mean and var parameters.
Shorten time series of input data to specified range
shorten.inp(inp, mintime = NULL, maxtime = NULL)
shorten.inp(inp, mintime = NULL, maxtime = NULL)
inp |
An input list containing data. |
mintime |
Starting time. If |
maxtime |
Ending time. If |
Time is given in decimal notation (e.g. 2005.3). If both start
and end
are NULL
, inp
is returned after running check.inp
.
If codemaxtime is not set, i.e. the first part of the time series is cut, then management settings are not changed. Otherwise default values are used (see check.inp
). The ir
vector, which sets up different regimes, is always overwritten.
List of shortened input time series and input variables as it is returned by check.inp
T.K. Mildenberger <[email protected]>
inp <- pol$albacore ## Keep only years from 1973 onwards shorten.inp(inp, mintime = 1973) ## Keep years until 1985 shorten.inp(inp, maxtime = 1985) ## Not run: ## Empty data set gives an error shorten.inp(inp, mintime = 1910, maxtime = 1930) ## End(Not run)
inp <- pol$albacore ## Keep only years from 1973 onwards shorten.inp(inp, mintime = 1973) ## Keep years until 1985 shorten.inp(inp, maxtime = 1985) ## Not run: ## Empty data set gives an error shorten.inp(inp, mintime = 1910, maxtime = 1930) ## End(Not run)
Simulate data from Pella-Tomlinson model
sim.spict(input, nobs = 100, use.tmb = FALSE, verbose = TRUE)
sim.spict(input, nobs = 100, use.tmb = FALSE, verbose = TRUE)
input |
Either an inp list with an ini key (see ?check.inp) or a rep list where rep is the output of running fit.spict(). |
nobs |
Optional specification of the number of simulated observations. |
use.tmb |
Should the TMB functionality be used for simulation? (Default: FALSE) |
verbose |
Should detailed outputs be provided? (Default: TRUE) |
Simulates data using either manually specified parameters values or parameters estimated by fit.spict().
Manual specification: To specify parameters manually use the inp$ini format similar to when specifying initial values for running fit.spict(). Observations can be simulated at specific times using inp$timeC and inp$timeI. If these are not specified then the length of inp$obsC or inp$obsI is used to determine the number of observations of catches and indices respectively. If none of these are specified then nobs observations of catch and index will be simulated evenly distributed in time.
Estimated parameters: Simply take the output from a fit.spict() run and use as input to sim.spict().
A list containing the simulated data.
data(pol) repin <- fit.spict(pol$albacore) # Simulate a specific number of observations inp <- list() inp$dteuler <- 1/4 # To reduce calculation time inp$ini <- repin$inp$ini inp$ini$logF <- NULL inp$ini$logB <- NULL set.seed(1) sim <- sim.spict(inp, nobs=150) repsim <- fit.spict(sim) summary(repsim) # Note true values are listed in the summary plot(repsim) # Note true states are shown with orange colour # Simulate data with seasonal F inp <- list() inp$dteuler <- 1/4 inp$nseasons <- 2 inp$splineorder <- 1 inp$obsC <- 1:80 inp$obsI <- 1:80 inp$ini <- repin$inp$ini inp$ini$logF <- NULL inp$ini$logB <- NULL inp$ini$logphi <- log(2) # Seasonality introduced here inp <- check.inp(inp) sim2 <- sim.spict(inp) par(mfrow=c(2, 1)) plot(sim2$obsC, typ='l') plot(sim2$obsI[[1]], typ='l')
data(pol) repin <- fit.spict(pol$albacore) # Simulate a specific number of observations inp <- list() inp$dteuler <- 1/4 # To reduce calculation time inp$ini <- repin$inp$ini inp$ini$logF <- NULL inp$ini$logB <- NULL set.seed(1) sim <- sim.spict(inp, nobs=150) repsim <- fit.spict(sim) summary(repsim) # Note true values are listed in the summary plot(repsim) # Note true states are shown with orange colour # Simulate data with seasonal F inp <- list() inp$dteuler <- 1/4 inp$nseasons <- 2 inp$splineorder <- 1 inp$obsC <- 1:80 inp$obsI <- 1:80 inp$ini <- repin$inp$ini inp$ini$logF <- NULL inp$ini$logB <- NULL inp$ini$logphi <- log(2) # Seasonality introduced here inp <- check.inp(inp) sim2 <- sim.spict(inp) par(mfrow=c(2, 1)) plot(sim2$obsC, typ='l') plot(sim2$obsI[[1]], typ='l')
Fits a continuous-time surplus production model to data.
Martin W. Pedersen [email protected]
https://github.com/DTUAqua/spict
rep <- test.spict()
rep <- test.spict()
An S4 class to represent output from a SPiCT fit.
Output a summary of a fit.spict() run.
## S3 method for class 'spictcls' summary(object, CI = 0.95, ...)
## S3 method for class 'spictcls' summary(object, CI = 0.95, ...)
object |
A result report as generated by running fit.spict. |
CI |
Confidence intervals to be calculated, e.g. 0.9 for the 90% confidence intervals. By default (CI = 0.95), the 95% confidence intervals are estimated. |
... |
additional arguments affecting the summary produced. |
The output includes the parameter estimates with 95% confidence intervals, estimates of derived parameters (Bmsy, Fmsy, MSY) with 95% confidence intervals, and predictions of biomass, fishing mortality, and catch.
Nothing. Prints a summary to the screen.
data(pol) rep <- fit.spict(pol$albacore) summary(rep)
data(pol) rep <- fit.spict(pol$albacore) summary(rep)
Diagnostics table
sumspict.diagnostics(rep, ndigits = 8)
sumspict.diagnostics(rep, ndigits = 8)
rep |
A result report as generated by running fit.spict. |
ndigits |
Present values with this number of digits after the dot. |
data.frame containing diagnostics information.
Deternistic reference points of a fit.spict() run.
sumspict.drefpoints(rep, ndigits = 8, CI = 0.95)
sumspict.drefpoints(rep, ndigits = 8, CI = 0.95)
rep |
A result report as generated by running fit.spict. |
ndigits |
Present values with this number of digits after the dot. |
data.frame containing deterministic reference points.
Fixed parameters table.
sumspict.fixedpars(rep, ndigits = 8)
sumspict.fixedpars(rep, ndigits = 8)
rep |
A result report as generated by running fit.spict. |
ndigits |
Present values with this number of digits after the dot. |
data.frame containing fixed parameter information.
Sensitivity to the initial parameter values
sumspict.ini(rep, numdigits)
sumspict.ini(rep, numdigits)
rep |
A result report as generated by running fit.spict. |
numdigits |
Present values with this number of digits after the dot. |
list containing diagnostics information.
Print management summary.
sumspict.manage( rep, include.EBinf = FALSE, include.unc = FALSE, include.abs = FALSE, timeline = TRUE, verbose = TRUE ) mansummary( repin, include.EBinf = FALSE, include.unc = FALSE, include.abs = FALSE, timeline = TRUE, verbose = TRUE )
sumspict.manage( rep, include.EBinf = FALSE, include.unc = FALSE, include.abs = FALSE, timeline = TRUE, verbose = TRUE ) mansummary( repin, include.EBinf = FALSE, include.unc = FALSE, include.abs = FALSE, timeline = TRUE, verbose = TRUE )
rep , repin
|
A result object as generated by running |
include.EBinf |
Include EBinf/Bmsy in the output. |
include.unc |
Include uncertainty of management quantities. |
include.abs |
Include absolute B and F in management summary. |
timeline |
(default: FALSE) |
verbose |
Should detailed outputs be provided (default: TRUE). |
List with data frame containing management summary ('est') and data
frame containing uncertainty of management quantities ('unc') if
include.unc = TRUE
.
## Not run: data(pol) rep <- fit.spict(pol$albacore) rep <- manage(rep, c(2,4,8)) sumspict.manage(rep) ## End(Not run)
## Not run: data(pol) rep <- fit.spict(pol$albacore) rep <- manage(rep, c(2,4,8)) sumspict.manage(rep) ## End(Not run)
Parameter estimates of a fit.spict() run.
sumspict.parest(rep, ndigits = 8, CI = 0.95)
sumspict.parest(rep, ndigits = 8, CI = 0.95)
rep |
A result report as generated by running fit.spict. |
ndigits |
Present values with this number of digits after the dot. |
CI |
Confidence intervals to be calculated, e.g. 0.9 for the 90% confidence intervals. By default (CI = 0.95), the 95% confidence intervals are estimated. |
data.frame containing parameter estimates.
Predictions of a fit.spict() run.
sumspict.predictions(rep, ndigits = 8, CI = 0.95)
sumspict.predictions(rep, ndigits = 8, CI = 0.95)
rep |
A result report as generated by running fit.spict. |
ndigits |
Present values with this number of digits after the dot. |
data.frame containing predictions.
Fixed parameters table.
sumspict.priors(rep, ndigits = 8)
sumspict.priors(rep, ndigits = 8)
rep |
A result report as generated by running fit.spict. |
ndigits |
Present values with this number of digits after the dot. |
data.frame containing fixed parameter information.
Stochastic reference points of a fit.spict() run.
sumspict.srefpoints(rep, ndigits = 8, CI = 0.95)
sumspict.srefpoints(rep, ndigits = 8, CI = 0.95)
rep |
A result report as generated by running fit.spict. |
ndigits |
Present values with this number of digits after the dot. |
CI |
Confidence intervals to be calculated, e.g. 0.9 for the 90% confidence intervals. By default (CI = 0.95), the 95% confidence intervals are estimated. |
data.frame containing stochastic reference points.
State estimates of a fit.spict() run.
sumspict.states(rep, ndigits = 8, CI = 0.95)
sumspict.states(rep, ndigits = 8, CI = 0.95)
rep |
A result report as generated by running fit.spict. |
ndigits |
Present values with this number of digits after the dot. |
data.frame containing state estimates.
Example of a spict analysis.
test.spict(dataset = "albacore")
test.spict(dataset = "albacore")
dataset |
Specify one of the three test data sets: 'albacore', 'hake', 'lobster'. These can be accessed with the command data(pol). |
Loads a data set, fits the model, calculates one-step-ahead residuals, plots the results.
A result report as given by fit.spict().
rep <- test.spict()
rep <- test.spict()
Get real parameter values from transformed ones.
trans2real(vals, nms, chgnms = TRUE)
trans2real(vals, nms, chgnms = TRUE)
vals |
Parameters in transformed domain. |
nms |
Names of transformed parameters (including log etc.) |
chgnms |
Remove transformation indication from the parameter names (e.g. remove log from logK). |
Parameter values in the natural domain.
Load color of true values from simulation.
true.col()
true.col()
Color vector
Add spict version to plot
txt.stamp(string = get.version(), cex = 0.5, do.flag = NULL)
txt.stamp(string = get.version(), cex = 0.5, do.flag = NULL)
string |
Character string to stamp. |
cex |
Stamp cex. |
do.flag |
If NULL stamp will be added if not in a multi plot, i.e. mean(par()$mfrow) > 1 |
Nothing
Simulate data and reestimate parameters
validate.spict( inp, nsim = 50, invec = c(15, 60, 240), estinp = NULL, backup = NULL, df.out = FALSE, summ.ex.file = NULL, type = "nobs", parnames = NULL, exp = NULL, mc.cores = 1, model = "spict" )
validate.spict( inp, nsim = 50, invec = c(15, 60, 240), estinp = NULL, backup = NULL, df.out = FALSE, summ.ex.file = NULL, type = "nobs", parnames = NULL, exp = NULL, mc.cores = 1, model = "spict" )
inp |
An inp list with an ini key (see ?check.inp). If you want to use estimated parameters for the simulation create the inp$ini from the pl key of a result of fit.spict(). |
nsim |
Number of simulated data sets in each batch. |
invec |
Vector containing the number of simulated observations of each data set in each batch. |
estinp |
The estimation uses the true parameters as starting guess. Other initial values to be used for estimation can be specified in estinp$ini. |
backup |
Since this procedure can be slow a filename can be specified in backup where the most recent results will be available. |
df.out |
Output data frame instead of list. |
summ.ex.file |
Save a summary example to this file (to check that parameters have correct priors or are fixed). |
type |
Specify what type of information is contained in invec. If type == 'nobs' then invec is assumed to be a vector containing the number of simulated observations of each data set in each batch. If type == 'logsdc' then invec is assumed to be a vector containing values of logsdc over which to loop. |
parnames |
Vector of parameter names to extract stats for. |
exp |
Should exp be taken of parameters? |
mc.cores |
Number of cores for |
model |
If 'spict' estimate using SPiCT. If 'meyermillar' estimate using the model of Meyer & Millar (1999), this requires rjags and coda packages. |
Given input parameters simulate a number of data sets. Then estimate the parameters from the simulated data and compare with the true values. Specifically, the one-step-ahead residuals are checked for autocorrelation and the confidence intervals of the estimated Fmsy and Bmsy are checked for consistency.
WARNING: One should simulate at least 50 data sets and preferably more than 100 to obtain reliable results. This will take some time (potentially hours).
A list containing the results of the validation with the following keys:
"osarpvals" P-values of the Ljung-Box test for uncorrelated one-step-ahead residuals.
"*msyci"Logical. TRUE if the true value of B/Fmsy was inside the 95% confidence interval for the estimate, otherwise FALSE
"*msyciw" Width of the 95% confidence interval of the estimate of Bmsy/Fmsy.
data(pol) rep0 <- fit.spict(pol$albacore) inp <- list() inp$ini <- rep0$pl set.seed(1234) validate.spict(inp, nsim=10, invec=c(30, 60), backup='validate.RData')
data(pol) rep0 <- fit.spict(pol$albacore) inp <- list() inp$ini <- rep0$pl set.seed(1234) validate.spict(inp, nsim=10, invec=c(30, 60), backup='validate.RData')
Collect results from the output of running validate.spict.
validation.data.frame(ss)
validation.data.frame(ss)
ss |
Output from validation.spict. |
A data frame containing the formatted validation results.
Add warning sign to plot
warning.stamp()
warning.stamp()
Nothing
Takes a SPiCT input list and writes it as an Aspic input file.
write.aspic(input, filename = "spictout.a7inp", verbose = FALSE)
write.aspic(input, filename = "spictout.a7inp", verbose = FALSE)
input |
List of input variables or the output of a simulation using sim.spict(). |
filename |
Name of the file to write. |
verbose |
If true write information to screen. |
TBA
Noting.
data(pol) sim <- (pol$albacore) write.aspic(sim)
data(pol) sim <- (pol$albacore) write.aspic(sim)
Write the BUGS code to a text file
write.bug.file(priors, fn = "tmp.bug")
write.bug.file(priors, fn = "tmp.bug")
priors |
List of priors, typically coming from inp$meyermillar$priors. |
fn |
Filename of to put BUGS code in. |
The .bug file generated by this function contains code published in Meyer & Millar (1999).
Nothing.
Meyer, R., & Millar, R. B. (1999). BUGS in Bayesian stock assessments. Canadian Journal of Fisheries and Aquatic Sciences, 56(6), 1078-1087.