FIMS  v0.10.0
Loading...
Searching...
No Matches
fims_popdy::AgeSpecificSelectivity< Type > Struct Template Reference

Age-specific selectivity calculated using one parameter per age bin. More...

#include <age_specific.hpp>

Inheritance diagram for fims_popdy::AgeSpecificSelectivity< Type >:
fims_popdy::SelectivityBase< Type > fims_model_object::FIMSObject< Type > fims_model_object::FIMSMemoryTracker

Public Member Functions

virtual const Type evaluate (const Type &x)
 Calculates selectivity for an age using its age-specific parameter.
 
virtual const Type evaluate (const Type &x, size_t pos)
 Calculates selectivity for an age using its age-specific parameter.
 
- Public Member Functions inherited from fims_popdy::SelectivityBase< Type >
 SelectivityBase ()
 Constructor.
 
- Public Member Functions inherited from fims_model_object::FIMSObject< Type >
uint32_t GetId () const
 Getter that returns the unique id for parameters in the model.
 
bool CheckDimensions (size_t actual, size_t expected)
 Check the dimensions of an object.
 
- Public Member Functions inherited from fims_model_object::FIMSMemoryTracker
void register_self (const uint32_t id)
 Registers a FIMSObject instance with the memory tracker.
 

Public Attributes

fims::Vector< Typelogit_sel_at_age
 Stores the age-specific selectivity parameters on the logit scale.
 
size_t n_ages
 Stores the number of modeled age bins.
 
size_t min_age
 Minimum modeled age, used to map input age to logit_sel_at_age.
 
- Public Attributes inherited from fims_model_object::FIMSObject< Type >
uint32_t id
 
std::vector< Type * > parameters
 
std::vector< Type * > random_effects_parameters
 
std::vector< Type * > fixed_effects_parameters
 

Additional Inherited Members

- Static Public Attributes inherited from fims_popdy::SelectivityBase< Type >
static uint32_t id_g = 0
 
- Static Public Attributes inherited from fims_model_object::FIMSMemoryTracker
static int total_active_objects = 0
 Total number of active FIMSObject instances currently in memory.
 

Detailed Description

template<typename Type>
struct fims_popdy::AgeSpecificSelectivity< Type >

Age-specific selectivity calculated using one parameter per age bin.

AgeSpecificSelectivity estimates a separate selectivity value for each age bin. The values stored in logit_sel_at_age are on the logit scale and are transformed to the interval [0, 1]:

\[ s_a = \frac{1}{1 + \exp(-logit\_sel\_at\_age)} \]

where \(logit\_sel\_at\_age\) is the logit-scale parameter for age \(a\) and \(s_a\) is the resulting selectivity.

The parameter at age \(a\) is selected using the zero-based index \(a - min\_age\). Therefore, logit_sel_at_age[0] corresponds to min_age, logit_sel_at_age[1] corresponds to min_age + 1, and so on. The parameter vector should normally contain one element for each age class, with n_ages matching the number of modeled ages.

Age-specific selectivity is highly flexible because it does not impose a smooth parametric curve across ages. This flexibility can create identifiability problems, especially when estimating both selectivity and fishing mortality. Users should ensure that at least one age-specific selectivity parameter is "constant", i.e., not estimated, and is equal to or near 1, or otherwise impose suitable constraints. This can be achieved by setting at least one age-specific parameter (logit_sel_at_age), which are on the logit scale, to a value greater than 10 with estimation_type == "constant".

Member Function Documentation

◆ evaluate() [1/2]

template<typename Type >
virtual const Type fims_popdy::AgeSpecificSelectivity< Type >::evaluate ( const Type x)
inlinevirtual

Calculates selectivity for an age using its age-specific parameter.

The input age is converted to a zero-based parameter index by subtracting min_age. This zero-based index, based on x, is then used to select the appropriate element of logit_sel_at_age, which is a logit-scale parameter, and it is transformed to a selectivity value between zero and one using fims_math::inv_logit with lower and upper bounds of zero and one. Consequently, logit_sel_at_age[0] corresponds to min_age, and each subsequent element corresponds to the next modeled age.

See also
fims_math::inv_logit
Parameters
xThe age at which selectivity is evaluated. The value is expected to be an integer-valued age greater than or equal to min_age.
Returns
The selectivity for age x.
Exceptions
std::invalid_argumentif the calculated age index is outside logit_sel_at_age.

Implements fims_popdy::SelectivityBase< Type >.

◆ evaluate() [2/2]

template<typename Type >
virtual const Type fims_popdy::AgeSpecificSelectivity< Type >::evaluate ( const Type x,
size_t  pos 
)
inlinevirtual

Calculates selectivity for an age using its age-specific parameter.

The input age is converted to a zero-based parameter index by subtracting min_age. This zero-based index, based on x, is then used to select the appropriate element of logit_sel_at_age, which is a logit-scale parameter, and it is transformed to a selectivity value between zero and one using fims_math::inv_logit with lower and upper bounds of zero and one. Consequently, logit_sel_at_age[0] corresponds to min_age, and each subsequent element corresponds to the next modeled age.

See also
fims_math::inv_logit
Parameters
xThe age at which selectivity is evaluated. The value is expected to be an integer-valued age greater than or equal to min_age.
Returns
The selectivity for age x.
Exceptions
std::invalid_argumentif the calculated age index is outside logit_sel_at_age.
Parameters
posPosition index, e.g., which year.

Implements fims_popdy::SelectivityBase< Type >.

Member Data Documentation

◆ logit_sel_at_age

Stores the age-specific selectivity parameters on the logit scale.

Each element corresponds to one modeled age, beginning with min_age.


The documentation for this struct was generated from the following file: