fit_wham | R Documentation |
Fits the compiled WHAM model using TMB::MakeADFun
and
stats::nlminb
. Runs retrospective analysis if specified.
fit_wham(
input,
n.newton = 3,
do.sdrep = TRUE,
do.retro = TRUE,
n.peels = 7,
do.osa = TRUE,
osa.opts = list(method = "oneStepGaussianOffMode", parallel = TRUE),
do.post.samp = TRUE,
model = NULL,
do.check = FALSE,
MakeADFun.silent = FALSE,
retro.silent = FALSE,
do.proj = FALSE,
proj.opts = list(n.yrs = 3, use.last.F = TRUE, use.avg.F = FALSE, use.FXSPR = FALSE,
proj.F = NULL, proj.catch = NULL, avg.yrs = NULL, cont.ecov = TRUE, use.last.ecov =
FALSE, avg.ecov.yrs = NULL, proj.ecov = NULL, cont.Mre = NULL, avg.rec.yrs = NULL,
percentFXSPR = 100),
do.fit = TRUE,
save.sdrep = TRUE,
do.brps = TRUE,
fit.tmb.control = NULL,
TMB.bias.correct = FALSE,
TMB.jointPrecision = FALSE
)
input |
Named list with components:
|
n.newton |
integer, number of additional Newton steps after optimization. Passed to |
do.sdrep |
T/F, calculate standard deviations of model parameters? See |
do.retro |
T/F, do retrospective analysis? Default = |
n.peels |
integer, number of peels to use in retrospective analysis. Default = |
do.osa |
T/F, calculate one-step-ahead (OSA) residuals? Default = |
osa.opts |
list of 2 options (method, parallel) for calculating OSA residuals, passed to |
do.post.samp |
T/F, obtain sample from posterior of random effects? Default = |
model |
(optional), a previously fit wham model. |
do.check |
T/F, check if model parameters are identifiable? Passed to |
MakeADFun.silent |
T/F, Passed to silent argument of |
retro.silent |
T/F, Passed to argument of internal retro function. Determines whether peel number is printed to screen. Default = |
do.proj |
T/F, do projections? Default = |
proj.opts |
a named list with the following components:
|
do.fit |
T/F, fit the model using |
save.sdrep |
T/F, save the full |
do.brps |
T/F, calculate and report biological reference points. Default = |
fit.tmb.control |
list of optimizer controlling attributes passed to |
TMB.bias.correct |
T/F whether to use the bias.correct feature of TMB::sdreport. Default = |
TMB.jointPrecision |
T/F whether TMB::sdreport should return the joint precision matrix for the fixed and random effects. Default = |
Standard residuals are not appropriate for models with random effects. Instead, one-step-ahead (OSA) residuals
can be used for evaluating model goodness-of-fit (Thygeson et al. (2017),
implemented in TMB::oneStepPredict
). Additional OSA residual options
are passed to TMB::oneStepPredict
in a list osa.opts
. For example,
to use the (much faster, ~1 sec instead of 2 min) full Gaussian approximation instead of the (default)
generic method, you can use osa.opts=list(method="fullGaussian")
.
a fit TMB model with additional output if specified:
$rep
List of derived quantity estimates (see examples)
$sdrep
Parameter estimates (and standard errors if do.sdrep=TRUE
)
$peels
Retrospective analysis (if do.retro=TRUE
)
$osa
One-step-ahead residuals (if do.osa=TRUE
)
fit_tmb
, retro
, TMB::oneStepPredict
, project_wham
## Not run:
data("input4_SNEMAYT") # load SNEMA yellowtail flounder data and parameter settings
mod = fit_wham(input4_SNEMAYT) # using default values
mod = fit_wham(input4_SNEMAYT, do.retro=FALSE, osa.opts=list(method="oneStepGeneric")) # slower OSA method.
names(mod$rep) # list of derived quantities
mod$rep$SSB # get SSB estimates (weight, not numbers)
m1$rep$NAA[,1] # get recruitment estimates (numbers, first column of numbers-at-age matrix)
m1$rep$F[,1] # get F estimates for fleet 1
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.