Rceattle C++ template
The CEATTLE likelihood: src/TMB/ceattle.cpp and its headers
Loading...
Searching...
No Matches
diet_data.hpp File Reference

Go to the source code of this file.

Functions

template<class Type>
void organize_diet_obs (const int &nspp, const int &nyrs, const int &nyrs_hind, const int &styr, const vector< int > &minage, const vector< int > &nsex, matrix< Type > &diet_obs, matrix< int > &diet_ctl, array< Type > &diet_prop)
 Parses empirical diet observations and maps them into a 5D proportion array.
template<class Type>
void calculate_other_food_diet_prop (const int &nspp, const int &nyrs, const vector< int > &nsex, const vector< int > &nages, const vector< Type > &other_food, array< Type > &diet_prop, array< Type > &other_food_diet_prop)
 Residual stomach content: the "other food" not explicitly modeled.
template<class Type>
void predict_stomach_content (const int &nspp, const int &nyrs_hind, const int &styr, const vector< int > &suit_styr, const vector< int > &suit_endyr, const vector< int > &minage, const vector< int > &nsex, const vector< int > &nages, matrix< Type > &diet_obs, matrix< int > &diet_ctl, array< Type > &avgN_at_age, array< Type > &diet_prop_hat, matrix< Type > &diet_hat)
 Expected stomach content proportions given the modeled population state.

Function Documentation

◆ calculate_other_food_diet_prop()

template<class Type>
void calculate_other_food_diet_prop ( const int & nspp,
const int & nyrs,
const vector< int > & nsex,
const vector< int > & nages,
const vector< Type > & other_food,
array< Type > & diet_prop,
array< Type > & other_food_diet_prop )

Residual stomach content: the "other food" not explicitly modeled.

The unattributed diet share divided by other_food (mt) is on the same per-biomass scale as stom_div_bio, which calculate_msvpa_suitability() sums over prey and adds it to.

Definition at line 97 of file diet_data.hpp.

◆ organize_diet_obs()

template<class Type>
void organize_diet_obs ( const int & nspp,
const int & nyrs,
const int & nyrs_hind,
const int & styr,
const vector< int > & minage,
const vector< int > & nsex,
matrix< Type > & diet_obs,
matrix< int > & diet_ctl,
array< Type > & diet_prop )

Parses empirical diet observations and maps them into a 5D proportion array.

Maps diet_obs proportions onto the 5D diet_prop array used for MSVPA based suitability, handling 1-sex and 2-sex indexing. A row with flt_yr == 0 is written to every modeled year. Rows aggregated over predator or prey ages are skipped: only diet-data type 1 (a prey age in a predator age) can be used for MSVPA suitability.

Parameters
nsppNumber of species.
nyrsYears, hindcast plus projection.
nyrs_hindYears in the hindcast.
styrFirst year of the model.
minageMinimum modeled age per species.
nsexSexes modelled per species: 1 = combined, 2 = both.
diet_obsDiet observations; column 0 sample size, column 1 the proportion.
diet_ctlMaps each observation row to predator, prey, sexes, ages, and year.
diet_prop[Output] Observed diet proportions (pred_idx, prey_idx, pred_age, prey_age, yr). Modified by reference.

Definition at line 24 of file diet_data.hpp.

◆ predict_stomach_content()

template<class Type>
void predict_stomach_content ( const int & nspp,
const int & nyrs_hind,
const int & styr,
const vector< int > & suit_styr,
const vector< int > & suit_endyr,
const vector< int > & minage,
const vector< int > & nsex,
const vector< int > & nages,
matrix< Type > & diet_obs,
matrix< int > & diet_ctl,
array< Type > & avgN_at_age,
array< Type > & diet_prop_hat,
matrix< Type > & diet_hat )

Expected stomach content proportions given the modeled population state.

Maps diet_prop_hat back onto the rows of the empirical diet_obs, which are often aggregated over ages or sexes. The four diet-data types, as the ages encode them:

  • Type 1: Specific predator age and prey age (weighted across sexes if combined).
  • Type 2: Specific predator age, summed across all prey ages.
  • Type 3: Unweighted mean over predator ages, summed over prey ages (r_age > -500).
  • Type 4: As Type 3, but weighted by predator numbers-at-age (r_age < -500).
Parameters
nsppNumber of species.
nyrs_hindYears in the hindcast.
styrFirst year of the model.
suit_styrStart year index of the suitability window, per predator.
suit_endyrEnd year index of the suitability window, per predator.
minageMinimum modeled age per species.
nsexSexes modelled per species: 1 = combined, 2 = both.
nagesAge bins per species.
diet_obsEmpirical diet observations, used here for row-matching.
diet_ctlMaps each observation row to its aggregation levels.
avgN_at_ageAverage numbers-at-age (thousands of fish), used for weighting.
diet_prop_hatPredicted diet proportions for specific ages/sexes.
diet_hat[Output] Predicted diet proportions matching diet_obs.

Definition at line 161 of file diet_data.hpp.