Skip to contents

Runs optimization on the TMB model using stats::nlminb. If specified, takes additional Newton steps and calculates standard deviations. Internal function called by fit_rema. Source code and documentation modified from wham::fit_tmb.

Usage

fit_tmb(
  model,
  n.newton = 0,
  do.sdrep = TRUE,
  do.check = FALSE,
  save.sdrep = FALSE
)

Arguments

model

Output from TMB::MakeADFun.

n.newton

Integer, number of additional Newton steps after optimization. Default = 0.

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 https://github.com/kaskr/TMB_contrib_R/TMBhelper. Default = TRUE.

save.sdrep

T/F, save the full TMB::sdreport object? If FALSE, only save summary.sdreport) to reduce model object file size. Default = FALSE.

Value

model, appends the following:

model$opt

Output from stats::nlminb

model$date

System date

model$dir

Current working directory

model$rep

model$report()

model$TMB_version

Version of TMB installed

model$parList

List of parameters, model$env$parList()

model$final_gradient

Final gradient, model$gr()

model$sdrep

Estimated standard deviations for model parameters, TMB::sdreport or summary.sdreport)

See also

fit_rema, TMBhelper::check_estimability