Skip to contents

Computes likelihood for CPUE-based length compositions using age-length keys (ALKs).

Usage

get_cpue_length_like(
  lf_switch = 1,
  cpue_years,
  cpue_lfs,
  cpue_n,
  par_log_lf_alpha,
  number_ysa,
  sel_fya,
  alk_ysal
)

Arguments

lf_switch

Integer specifying likelihood type (1=multinomial, 2=Dirichlet, 3=Dirichlet-multinomial, 9=KL divergence).

cpue_years

A vector of year indices for each CPUE length composition observation.

cpue_lfs

A matrix of observed CPUE length composition proportions with rows as observations and columns as length bins.

cpue_n

A vector of effective sample sizes for each observation.

par_log_lf_alpha

A vector of log-scale concentration parameters for Dirichlet likelihoods, indexed by fishery.

number_ysa

A 3D array of numbers-at-age with dimensions year by season by age.

sel_fya

A 3D array of selectivity values with dimensions fishery by year by age.

alk_ysal

A 4D array of age-length keys with dimensions year by season by age by length bin.

Value

A list containing:

pred

Matrix of predicted length composition proportions.

lp

Vector of negative log-likelihood contributions for each observation.