STK++ 0.9.13
STK::Law::IUnivLaw< Type > Class Template Referenceabstract

Interface base class for all the univariate distributions. More...

#include <STK_Law_IUnivLaw.h>

Inheritance diagram for STK::Law::IUnivLaw< Type >:
Inheritance graph

Public Member Functions

virtual ~IUnivLaw ()
 Virtual destructor.
 
virtual Type rand () const =0
 
virtual Real pdf (Type const &x) const =0
 compute the probability distribution function (density) in the continuous case and the probability mass function in the discrete case.
 
virtual Type icdf (Real const &p) const =0
 inverse cumulative distribution function The quantile is defined as the smallest value x such that F(x) >= p , where F is the cumulative distribution function.
 
virtual Real lpdf (Type const &x) const
 compute the log probability distribution function Give the value of the log-pdf at the point x.
 
virtual Real cdf (Real const &t) const =0
 compute the lower tail cumulative distribution function Give the probability that a random variate is less or equal to t.
 
virtual Real lcdf (Real const &t) const
 compute the lower tail log-cumulative distribution function Give the log-probability that a random variate is less or equal to t.
 
virtual Real cdfc (Real const &t) const
 calculate the complement of cumulative distribution function, called in statistics the survival function.
 
virtual Real lcdfc (Real const &t) const
 calculate the log-complement of cumulative distribution function Give the log-probability that a random variate is greater than t.
 
- Public Member Functions inherited from STK::Law::ILawBase
String constname () const
 

Protected Member Functions

 IUnivLaw (String const &name)
 Constructor.
 
 IUnivLaw (IUnivLaw const &law)
 copy Constructor.
 
- Protected Member Functions inherited from STK::Law::ILawBase
 ILawBase (String const &name)
 Constructor.
 
 ~ILawBase ()
 destructor.
 

Additional Inherited Members

- Protected Attributes inherited from STK::Law::ILawBase
String name_
 Name of the Law.
 

Detailed Description

template<class Type>
class STK::Law::IUnivLaw< Type >

Interface base class for all the univariate distributions.

A general probability law (discrete or real) possess a probability distribution function (pdf), a cumulative distribution function (cdt) and an inverse cumulative distribution function (icdf). It can be simulated (random number generation).

Interface base class for the univariate distributions. Every derived class have to furnish :

The derived objects should also furnish the same static functions. Instantiation of a derived object is interesting when one want to simulate independent identical distributed random variates: at creation, the object initializes all parameter-dependent variables.

Definition at line 71 of file STK_Law_IUnivLaw.h.

Constructor & Destructor Documentation

◆ IUnivLaw() [1/2]

template<class Type >
STK::Law::IUnivLaw< Type >::IUnivLaw ( String const name)
inlineprotected

Constructor.

Parameters
namethe name of the law

Definition at line 77 of file STK_Law_IUnivLaw.h.

77: ILawBase(name) {}
ILawBase(String const &name)
Constructor.
String const & name() const

◆ IUnivLaw() [2/2]

template<class Type >
STK::Law::IUnivLaw< Type >::IUnivLaw ( IUnivLaw< Type > const law)
inlineprotected

copy Constructor.

Parameters
lawthe law to copy

Definition at line 81 of file STK_Law_IUnivLaw.h.

81: ILawBase(law.name_) {}

◆ ~IUnivLaw()

template<class Type >
virtual STK::Law::IUnivLaw< Type >::~IUnivLaw ( )
inlinevirtual

Virtual destructor.

Definition at line 85 of file STK_Law_IUnivLaw.h.

85{}

Member Function Documentation

◆ cdf()

◆ cdfc()

template<class Type >
virtual Real STK::Law::IUnivLaw< Type >::cdfc ( Real const t) const
inlinevirtual

calculate the complement of cumulative distribution function, called in statistics the survival function.

Give the probability that a random variate is greater than t.

Parameters
ta real number
Returns
the value of the cdf

Definition at line 126 of file STK_Law_IUnivLaw.h.

126{ return(1. - cdf(t));}
virtual Real cdf(Real const &t) const =0
compute the lower tail cumulative distribution function Give the probability that a random variate is...

References STK::Law::IUnivLaw< Type >::cdf().

Referenced by STK::Law::IUnivLaw< Type >::lcdfc(), and main().

◆ icdf()

template<class Type >
virtual Type STK::Law::IUnivLaw< Type >::icdf ( Real const p) const
pure virtual

◆ lcdf()

template<class Type >
virtual Real STK::Law::IUnivLaw< Type >::lcdf ( Real const t) const
inlinevirtual

compute the lower tail log-cumulative distribution function Give the log-probability that a random variate is less or equal to t.

Parameters
ta real number
Returns
the value of the cdf

Definition at line 120 of file STK_Law_IUnivLaw.h.

120{ return(std::log(cdf(t)));}

References STK::Law::IUnivLaw< Type >::cdf().

Referenced by main().

◆ lcdfc()

template<class Type >
virtual Real STK::Law::IUnivLaw< Type >::lcdfc ( Real const t) const
inlinevirtual

calculate the log-complement of cumulative distribution function Give the log-probability that a random variate is greater than t.

Parameters
ta real number
Returns
the value of the cdf

Definition at line 132 of file STK_Law_IUnivLaw.h.

132{ return(std::log(cdfc(t)));}
virtual Real cdfc(Real const &t) const
calculate the complement of cumulative distribution function, called in statistics the survival funct...

References STK::Law::IUnivLaw< Type >::cdfc().

Referenced by main().

◆ lpdf()

template<class Type >
virtual Real STK::Law::IUnivLaw< Type >::lpdf ( Type const x) const
inlinevirtual

compute the log probability distribution function Give the value of the log-pdf at the point x.

Parameters
xthe value to compute the lpdf.
Returns
the value of the log-pdf

Reimplemented in STK::Law::Bernoulli, STK::Law::Categorical, STK::Law::Poisson, STK::Law::UniformDiscrete, STK::Law::Binomial, STK::Law::Geometric, STK::Law::HyperGeometric, STK::Law::NegativeBinomial, STK::Law::Beta, STK::Law::Cauchy, STK::Law::ChiSquared, STK::Law::Exponential, STK::Law::FisherSnedecor, STK::Law::Gamma, STK::Law::Logistic, STK::Law::LogNormal, STK::Law::Normal, STK::Law::Student, STK::Law::Uniform, and STK::Law::Weibull.

Definition at line 108 of file STK_Law_IUnivLaw.h.

108{ return(std::log(pdf(x)));}

References STK::Law::IUnivLaw< Type >::pdf().

◆ pdf()

template<class Type >
virtual Real STK::Law::IUnivLaw< Type >::pdf ( Type const x) const
pure virtual

compute the probability distribution function (density) in the continuous case and the probability mass function in the discrete case.

Parameters
xthe value to compute the pdf.
Returns
the value of the pdf

Implemented in STK::Law::Bernoulli, STK::Law::Categorical, STK::Law::Poisson, STK::Law::UniformDiscrete, STK::Law::Binomial, STK::Law::Geometric, STK::Law::HyperGeometric, STK::Law::NegativeBinomial, STK::Law::Beta, STK::Law::Cauchy, STK::Law::ChiSquared, STK::Law::Exponential, STK::Law::FisherSnedecor, STK::Law::Gamma, STK::Law::Logistic, STK::Law::LogNormal, STK::Law::Normal, STK::Law::Student, STK::Law::Uniform, and STK::Law::Weibull.

Referenced by STK::Law::IUnivLaw< Type >::lpdf().

◆ rand()


The documentation for this class was generated from the following files: