Skip to contents

Profiles the joint negative log-likelihood and all individual likelihood components across a range of fixed values for a single parameter. Supports both sequential and parallel execution.

Usage

do_likelihood_profile(
  data,
  parameters,
  mapping,
  random = NULL,
  what,
  idx = NULL,
  min_val,
  max_val,
  inc = 0.05,
  do_par = FALSE,
  n_cores = NULL
)

Arguments

data

Data list from the fitted model.

parameters

Parameter list from the fitted model.

mapping

Mapping list from the fitted model. The profile keeps this map for every position other than the ones it fixes, so positions the fitted model kept fixed stay fixed and positions it estimated as one shared parameter stay shared, leaving the profile with the same free parameters as the model being profiled.

random

Character vector of random effects to estimate. Default NULL.

what

Character string. Name of the parameter to profile. Profiling ln_fish_q or ln_srv_q requires the matching fish_q_type or srv_q_type to be "est" for the fleets being profiled, since the analytic forms overwrite catchability before it reaches the likelihood.

idx

Vector pointing to the specific elements to fix when parameters[[what]] is an array. NULL for scalar parameters.

min_val

Numeric. Minimum value of the profile range.

max_val

Numeric. Maximum value of the profile range.

inc

Numeric. Increment between profile values. Default 0.05.

do_par

Logical. Whether to use parallel processing. Default FALSE.

n_cores

Integer. Number of parallel workers. If NULL (default), parallel::detectCores() - 1 is used.

Value

A named list containing one dataframe per likelihood component, each with a prof_val column indicating the profiled parameter value, plus agg_nLL which aggregates all components across their respective dimensions. Components include:

Scalar penalties and priors

jnLL_df, rec_nLL_df (the recruitment, initial age, initial-age sex tie, recruitment level, and stock-recruit penalties together, each with its weight), M_nLL_df, sel_nLL_df, srv_sel_block_nLL_df, srv_q_block_nLL_df, fish_sel_block_nLL_df, fish_q_block_nLL_df, rec_prop_nLL_df, Movement_nLL_df, h_nLL_df, R0_nLL_df, TagRep_nLL_df, NAA_state_nLL_df, Fmort_nLL_df, fish_q_nLL_df, srv_q_nLL_df.

Pooled data likelihoods

Catch_nLL_df [Region × Year × Seas × Fleet], FishIdx_nLL_df and SrvIdx_nLL_df, and their age-disaggregated counterparts CatchAA_nLL_df, DiscardAA_nLL_df and SrvIdxAA_nLL_df with _pop variants, each summed over ages within a cell before its weight is applied [Region × Year × Seas × Fleet], FishAge_nLL_df, FishLen_nLL_df, SrvAge_nLL_df, SrvLen_nLL_df [Region × Year × Seas × Sex × Fleet], conv_fish_tag_nLL_df [Recap_Year × Recap_Seas × Tag_Cohort × Region × Fleet].

Population-specific data likelihoods

Catch_pop_nLL_df, FishIdx_pop_nLL_df, SrvIdx_pop_nLL_df [Pop × Region × Year × Seas × Fleet], FishAge_pop_nLL_df, FishLen_pop_nLL_df, SrvAge_pop_nLL_df, SrvLen_pop_nLL_df [Pop × Region × Year × Seas × Sex × Fleet].