|
Rceattle C++ template
The CEATTLE likelihood: src/TMB/ceattle.cpp and its headers
|
Go to the source code of this file.
Functions | |
| template<class Type> | |
| void | normalize_and_project_selectivity (const int &flt, const int &nyrs_hind, const int &nyrs, const vector< int > &flt_spp, const vector< int > &flt_sel_type, const vector< int > &flt_sel_dim, const vector< int > &bin_first_selected, const vector< int > &nages, const vector< int > &nlengths_pop, const vector< int > &nsex, const vector< int > &sel_norm_bin1, const vector< int > &sel_norm_bin2, const vector< int > &sel_norm_scope, array< Type > &selectivity) |
| Zeroes, normalizes and projects ONE fleet's selectivity (age or length based). | |
| template<class Type> | |
| void | convert_length_selectivity (const int &flt, const int &sp, const int &sex, const int &yr, const int &wtind, const vector< int > &nages, const vector< int > &nlengths_pop, array< Type > &sel_length, array< Type > &growth_matrix, array< Type > &sel_at_age) |
| Converts one fleet/sex/year of length-based selectivity to ages: the sum over population length bins of selectivity-at-length x Prob(length | age). | |
| template<class Type> | |
| void | calculate_selectivity (const int &nspp, const int &n_flt, const int &nyrs, const int &nyrs_hind, const int &styr, const vector< int > &nsex, const vector< int > &nages, const vector< int > &nlengths, matrix< Type > &lengths, const vector< int > &nlengths_pop, matrix< Type > &lengths_pop, const vector< int > &flt_spp, const vector< int > &flt_sel_type, const vector< int > &flt_varying_sel, const vector< int > &flt_sel_dim, const vector< int > &bin_first_selected, const vector< int > &flt_n_sel_bins, const vector< int > &flt_sel_cap_bin, const vector< int > &sel_norm_bin1, const vector< int > &sel_norm_bin2, const vector< int > &sel_norm_scope, const vector< int > &flt_sel_start_yr, matrix< Type > &emp_sel_obs, matrix< int > &emp_sel_ctl, array< Type > &log_sel_slp, array< Type > &log_sel_slp_dev, array< Type > &sel_inf, array< Type > &sel_inf_dev, array< Type > &sel_coff, array< Type > &sel_coff_dev, array< Type > &avg_sel, array< Type > &non_par_sel, array< Type > &log_non_par_sel, array< Type > &sel_at_length, array< Type > &sel_at_age, array< Type > &growth_matrix, array< Type > &sel_slp_off, array< Type > &sel_slp_off_nat, array< Type > &sel_inf_off, array< Type > &sel_inf_off_nat, array< Type > &sel_coff_off, array< Type > &sel_coff_off_nat, const int &sel_apical_on, array< Type > &log_sel_apical, array< Type > &sel_apical_off, array< Type > &sel_apical_off_nat, array< Type > &sel_dn6, array< Type > &sel_dn6_off, array< Type > &sel_dn6_off_nat, matrix< int > &sel_dn6_ends) |
| Calculates selectivity for every fleet, sex, bin (age or length) and year. | |
| void calculate_selectivity | ( | const int & | nspp, |
| const int & | n_flt, | ||
| const int & | nyrs, | ||
| const int & | nyrs_hind, | ||
| const int & | styr, | ||
| const vector< int > & | nsex, | ||
| const vector< int > & | nages, | ||
| const vector< int > & | nlengths, | ||
| matrix< Type > & | lengths, | ||
| const vector< int > & | nlengths_pop, | ||
| matrix< Type > & | lengths_pop, | ||
| const vector< int > & | flt_spp, | ||
| const vector< int > & | flt_sel_type, | ||
| const vector< int > & | flt_varying_sel, | ||
| const vector< int > & | flt_sel_dim, | ||
| const vector< int > & | bin_first_selected, | ||
| const vector< int > & | flt_n_sel_bins, | ||
| const vector< int > & | flt_sel_cap_bin, | ||
| const vector< int > & | sel_norm_bin1, | ||
| const vector< int > & | sel_norm_bin2, | ||
| const vector< int > & | sel_norm_scope, | ||
| const vector< int > & | flt_sel_start_yr, | ||
| matrix< Type > & | emp_sel_obs, | ||
| matrix< int > & | emp_sel_ctl, | ||
| array< Type > & | log_sel_slp, | ||
| array< Type > & | log_sel_slp_dev, | ||
| array< Type > & | sel_inf, | ||
| array< Type > & | sel_inf_dev, | ||
| array< Type > & | sel_coff, | ||
| array< Type > & | sel_coff_dev, | ||
| array< Type > & | avg_sel, | ||
| array< Type > & | non_par_sel, | ||
| array< Type > & | log_non_par_sel, | ||
| array< Type > & | sel_at_length, | ||
| array< Type > & | sel_at_age, | ||
| array< Type > & | growth_matrix, | ||
| array< Type > & | sel_slp_off, | ||
| array< Type > & | sel_slp_off_nat, | ||
| array< Type > & | sel_inf_off, | ||
| array< Type > & | sel_inf_off_nat, | ||
| array< Type > & | sel_coff_off, | ||
| array< Type > & | sel_coff_off_nat, | ||
| const int & | sel_apical_on, | ||
| array< Type > & | log_sel_apical, | ||
| array< Type > & | sel_apical_off, | ||
| array< Type > & | sel_apical_off_nat, | ||
| array< Type > & | sel_dn6, | ||
| array< Type > & | sel_dn6_off, | ||
| array< Type > & | sel_dn6_off_nat, | ||
| matrix< int > & | sel_dn6_ends ) |
Calculates selectivity for every fleet, sex, bin (age or length) and year.
An age-based curve is evaluated at the bin number bin + 1, without minage, so an inflection or peak is on the bin scale; a length-based one at bin midpoints (cm).
Forms (fleet_control$Selectivity; R/0-switches.R is the authority):
Which linkage offsets a form accepts is checked in R, by .check_sel_linkage_support().
Definition at line 151 of file selectivity.hpp.
References convert_length_selectivity(), isNA(), log_mean_exp(), max2(), normalize_and_project_selectivity(), and square().
| void convert_length_selectivity | ( | const int & | flt, |
| const int & | sp, | ||
| const int & | sex, | ||
| const int & | yr, | ||
| const int & | wtind, | ||
| const vector< int > & | nages, | ||
| const vector< int > & | nlengths_pop, | ||
| array< Type > & | sel_length, | ||
| array< Type > & | growth_matrix, | ||
| array< Type > & | sel_at_age ) |
Converts one fleet/sex/year of length-based selectivity to ages: the sum over population length bins of selectivity-at-length x Prob(length | age).
Definition at line 106 of file selectivity.hpp.
Referenced by calculate_selectivity().
| void normalize_and_project_selectivity | ( | const int & | flt, |
| const int & | nyrs_hind, | ||
| const int & | nyrs, | ||
| const vector< int > & | flt_spp, | ||
| const vector< int > & | flt_sel_type, | ||
| const vector< int > & | flt_sel_dim, | ||
| const vector< int > & | bin_first_selected, | ||
| const vector< int > & | nages, | ||
| const vector< int > & | nlengths_pop, | ||
| const vector< int > & | nsex, | ||
| const vector< int > & | sel_norm_bin1, | ||
| const vector< int > & | sel_norm_bin2, | ||
| const vector< int > & | sel_norm_scope, | ||
| array< Type > & | selectivity ) |
Zeroes, normalizes and projects ONE fleet's selectivity (age or length based).
Normalization never applies to Hake (5), LogisticPM (11) or DoubleNormalSS3 (15). Under Sel_norm_scope = AcrossSexes the less-selected sex peaks below 1.
| sel_norm_bin1 | Normalization bin, 0-based; -99 = the maximum, -999 = off. |
| sel_norm_bin2 | Upper bin for the mean over a range; negative = no range. |
| sel_norm_scope | 0 = WithinSex (a reference per sex), 1 = AcrossSexes (pooled). |
| selectivity | [fleet, sex, age or length bin, year], modified in place. |
Definition at line 16 of file selectivity.hpp.
References max2().
Referenced by calculate_selectivity().