Runs optimization on the TMB model using stats::nlminb.
If specified, takes additional Newton steps and calculates standard deviations.
Internal function called by fit_wham.
Usage
fit_tmb(
model,
n.newton = 3,
do.sdrep = TRUE,
do.check = FALSE,
save.sdrep = FALSE,
use.optim = FALSE,
opt.control = NULL
)Arguments
- model
Output from
TMB::MakeADFun.- n.newton
Integer, number of additional Newton steps after optimization. Default =
3.- do.sdrep
T/F, calculate standard deviations of model parameters? See
TMB::sdreport. Default =TRUE.- do.check
T/F, check if model parameters are identifiable? Runs internal
check_estimability, originally provided by the TMBhelper package. Default =TRUE.- save.sdrep
T/F, save the full
TMB::sdreportobject? IfFALSE, only savesummary.sdreport)to reduce model object file size. Default =FALSE.- use.optim
T/F, use
stats::optiminstead ofstats::nlminb? Default =FALSE.- opt.control
list of control parameters to pass to optimizer. For nlminb default = list(iter.max = 1000, eval.max = 1000). For optim default = list(maxit=1000).
Value
model, appends the following:
model$optOutput from
stats::nlminbmodel$dateSystem date
model$dirCurrent working directory
model$repmodel$report(model$env$last.par.best)
model$TMB_versionVersion of TMB installed
model$parListList of parameters,
model$env$parList(x = model$opt$par, par = model$env$last.par.best)model$final_gradientFinal gradient,
model$gr(model$opt$par)model$sdrepEstimated standard deviations for model parameters,
TMB::sdreportorsummary.sdreport)