ErlangDensity Struct Reference

CPP API: mio::ErlangDensity Struct Reference

Class that defines the probability density function corresponding to the Erlang distribution with the parameters shape and scale depending on the state age. More...

#include <state_age_function.h>

Inheritance diagram for mio::ErlangDensity:
Collaboration diagram for mio::ErlangDensity:

Public Member Functions

 ErlangDensity (unsigned int init_shape, ScalarType init_scale)
 Constructs a new ErlangDensity object. More...
 
ScalarType eval (ScalarType state_age) override
 Defines ErlangDensity depending on state_age. More...
 
ScalarType get_mean (ScalarType dt=1.0, ScalarType tol=1e-10) override
 Computes the mean value of the function. More...
 
ScalarType get_support_max (ScalarType dt, ScalarType tol=1e-10) override
 Computes the maximum of the support 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...
 
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 ErlangDensity. 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 the probability density function corresponding to the Erlang distribution with the parameters shape and scale depending on the state age.

Class is needed for the initialization of the subcompartments for LCT model. ErlangDensity is derived from StateAgeFunction. The shape parameter of the Erlang function is the distribution parameter of the StateAgeFunction. Attention: The density is not a survival function and does not have the characteristics of a TransitionDistribution!! The function is of the StateAgeFunction-Type b).

Constructor & Destructor Documentation

◆ ErlangDensity()

mio::ErlangDensity::ErlangDensity ( unsigned int  init_shape,
ScalarType  init_scale 
)
inline

Constructs a new ErlangDensity object.

Parameters
[in]init_shapeParameter shape of the ErlangDensity. For the Erlang distribution, shape has to be a positive integer.
[in]init_scaleParameter scale of the ErlangDensity. Corresponds to the inverse rate parameter.

Member Function Documentation

◆ clone_impl()

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

Implements clone for ErlangDensity.

Returns
Pointer to StateAgeFunction.

Implements mio::StateAgeFunction< ScalarType >.

◆ eval()

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

Defines ErlangDensity depending on state_age.

Parameters scale and shape are used.

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::ErlangDensity::get_mean ( ScalarType  dt = 1.0,
ScalarType  tol = 1e-10 
)
inlineoverridevirtual

Computes the mean value of the function.

For the Erlang distribution, the mean value is the m_distribution_parameter * m_scale.

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

Reimplemented from mio::StateAgeFunction< ScalarType >.

◆ get_support_max()

ScalarType mio::ErlangDensity::get_support_max ( ScalarType  dt,
ScalarType  tol = 1e-10 
)
inlineoverridevirtual

Computes the maximum of the support of the function.

Calculates the smallest time value t where function(tau)=0 for all tau>t.

Parameters
[in]dtTime step size.
[in]tolTolerance used for cutting the support if the function value falls below.
Returns
ScalarType support_max

Reimplemented from mio::StateAgeFunction< ScalarType >.