GammaSurvivalFunction Struct Reference

CPP API: mio::GammaSurvivalFunction Struct Reference
mio::GammaSurvivalFunction Struct Reference

Class that defines an GammaSurvivalFunction function depending on the state age. More...

#include <state_age_function.h>

Inheritance diagram for mio::GammaSurvivalFunction:
Collaboration diagram for mio::GammaSurvivalFunction:

Public Member Functions

ScalarType eval (ScalarType state_age) override
 Defines GammaSurvivalFunction depending on state_age. More...
 
 GammaSurvivalFunction (ScalarType init_shape=1, ScalarType init_location=0, ScalarType init_scale=1)
 Constructs a new GammaSurvivalFunction object. More...
 
ScalarType get_mean (ScalarType dt=1.0, ScalarType tol=1e-10) override
 Computes the mean value of the function. More...
 
- Public Member Functions inherited from mio::StateAgeFunction< ScalarType >
std::unique_ptr< StateAgeFunction< ScalarType > > clone () const
 Clones unique pointer to a StateAgeFunction. More...
 
ScalarType get_distribution_parameter () const
 Get the m_distribution_parameter object. More...
 
ScalarType get_location () const
 Get the m_location object. More...
 
ScalarType get_scale () const
 Get the m_scale object. More...
 
std::string get_state_age_function_type () const
 Get type of StateAgeFunction, i.e.which derived class is used. More...
 
virtual ScalarType get_support_max (ScalarType dt, ScalarType tol=1e-10)
 Computes the maximum of the support of the function using the time step size dt and some tolerance tol. More...
 
StateAgeFunction< ScalarType > & operator= (const StateAgeFunction< ScalarType > &other)=default
 Copy assignment operator. More...
 
StateAgeFunction< ScalarType > & operator= (StateAgeFunction< ScalarType > &&other)=default
 Move assignment operator. More...
 
bool operator== (const StateAgeFunction< ScalarType > &other) const
 Comparison operator. More...
 
void set_distribution_parameter (ScalarType new_distribution_parameter)
 Set the m_distribution_parameter object. More...
 
void set_location (ScalarType new_location)
 Set the m_location object. More...
 
void set_scale (ScalarType new_scale)
 Set the m_scale object. More...
 
 StateAgeFunction (const StateAgeFunction< ScalarType > &other)=default
 Copy constructor. More...
 
 StateAgeFunction (ScalarType init_distribution_parameter, ScalarType init_location=0, ScalarType init_scale=1)
 Constructs a new StateAgeFunction object. More...
 
 StateAgeFunction (StateAgeFunction< ScalarType > &&other)=default
 Move constructor. More...
 
virtual ~StateAgeFunction ()=default
 Virtual destructor. More...
 

Protected Member Functions

StateAgeFunction< ScalarType > * clone_impl () const override
 Implements clone for GammaSurvivalFunction. More...
 

Additional Inherited Members

- Protected Attributes inherited from mio::StateAgeFunction< ScalarType >
ScalarType m_distribution_parameter
 Parameter for function in derived class. More...
 
ScalarType m_location
 Location parameter for function in derived class. More...
 
ScalarType m_mean
 Mean value of the function. More...
 
ScalarType m_mean_tol
 Tolerance for computation of the mean (initialize as not set). More...
 
ScalarType m_scale
 Scale parameter for function in derived class. More...
 
ScalarType m_support_max
 Maximum of the support of the function. More...
 
ScalarType m_support_tol
 Tolerance for computation of the support (initialize as not set). More...
 

Detailed Description

Class that defines an GammaSurvivalFunction function depending on the state age.

A survival function is defined as 1 - cumulative density function. GammaSurvivalFunction is derived from StateAgeFunction. The shape parameter of the Gamma function is the parameter of the StateAgeFunction. If shape is an unsigned integer, the Gamma distribution simplifies to an Erlang distribution. Does not support automatic differentiation.

Constructor & Destructor Documentation

◆ GammaSurvivalFunction()

mio::GammaSurvivalFunction::GammaSurvivalFunction ( ScalarType  init_shape = 1,
ScalarType  init_location = 0,
ScalarType  init_scale = 1 
)
inline

Constructs a new GammaSurvivalFunction object.

Parameters
[in]init_shapeParameter shape of the GammaSurvivalFunction. For the Erlang distribution, shape has to be a positive integer. Choosing shape = 1 leads to an exponential function with parameter 1/scale.
[in]init_locationLocation paramter to shift the GammaSurvivalFunction. Should be a positive number to fulfill characteristics of a TransitionDistribution.
[in]init_scaleParameter shape of the GammaSurvivalFunction. Corresponds to the inverse of the rate parameter of a Gamma distribution.

Member Function Documentation

◆ clone_impl()

StateAgeFunction<ScalarType>* mio::GammaSurvivalFunction::clone_impl ( ) const
inlineoverrideprotectedvirtual

Implements clone for GammaSurvivalFunction.

Returns
Pointer to StateAgeFunction.

Implements mio::StateAgeFunction< ScalarType >.

◆ eval()

ScalarType mio::GammaSurvivalFunction::eval ( ScalarType  state_age)
inlineoverridevirtual

Defines GammaSurvivalFunction depending on state_age.

Parameters
[in]state_ageTime at which the function is evaluated.
Returns
Evaluation of the function at state_age.

Implements mio::StateAgeFunction< ScalarType >.

◆ get_mean()

ScalarType mio::GammaSurvivalFunction::get_mean ( ScalarType  dt = 1.0,
ScalarType  tol = 1e-10 
)
inlineoverridevirtual

Computes the mean value of the function.

For the gamma distribution, the mean value is m_distribution_parameter*m_scale+m_location, where m_distribution_parameter is the shape parameter.

Parameters
[in]dtTime step size used for the numerical integration (unused for GammaSurvivalFunction).
[in]tolThe maximum support used for numerical integration is calculated using this tolerance (unused for GammaSurvivalFunction).
Returns
ScalarType mean value.

Reimplemented from mio::StateAgeFunction< ScalarType >.