R/utils-extract-params-tab.R

Defines functions extract_params_tmb

Documented in extract_params_tmb

#' Extract parameter estimates from the linear par vector returned by TMB
#' to a list with parameter names and values
#'
#' @param obj The output from the TMB model
#'
#' @return A named [list] of parameter estimates extracted from `obj$par`
extract_params_tmb <- function(obj){

  par <- obj$par
  nms <- unique(names(par))

  map(nms, ~{
    par[names(par) == .x] |>
      unname()
  }) |>
    set_names(nms)
}
pacific-hake/pacifichakemse documentation built on June 11, 2024, 4:07 a.m.