STK++ 0.9.13

Geometric probability law. More...

#include <STK_Law_Geometric.h>

Inheritance diagram for STK::Law::Geometric:
Inheritance graph

Public Types

typedef IUnivLaw< Integer > Base
 

Public Member Functions

 Geometric (Real const &prob=0.5)
 constructor
 
virtual ~Geometric ()
 destructor
 
Real const & prob () const
 
void setProb (Real const &prob)
 
virtual Integer rand () const
 
virtual Real pdf (Integer const &x) const
 compute the probability distribution function (density) Give the value of the pdf at the point x.
 
virtual Real lpdf (Integer 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
 compute the cumulative distribution function Give the probability that a Geometric random variate is less or equal to t.
 
virtual Integer icdf (Real const &p) const
 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.
 
- Public Member Functions inherited from STK::Law::IUnivLaw< Integer >
virtual ~IUnivLaw ()
 Virtual destructor.
 
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 const & name () const
 

Static Public Member Functions

static Integer rand (Real const &prob)
 
static Real pdf (Integer x, Real const &prob)
 compute the probability distribution function (density) Give the value of the pdf at the point x.
 
static Real lpdf (Integer x, Real const &prob)
 compute the log probability distribution function Give the value of the log-pdf at the point x.
 
static Real cdf (Real const &t, Real const &prob)
 compute the cumulative distribution function Give the probability that a Geometric random variate is less or equal to t.
 
static Integer icdf (Real const &p, Real const &prob)
 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.
 

Protected Attributes

Real prob_
 probability of success in a Bernoulli trial
 
- Protected Attributes inherited from STK::Law::ILawBase
String name_
 Name of the Law.
 

Additional Inherited Members

- Protected Member Functions inherited from STK::Law::IUnivLaw< Integer >
 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.
 

Detailed Description

Geometric probability law.

In probability theory and statistics, the Geometric distribution with parameter p is the discrete probability distribution of the number of failures of Bernoulli trials before the first success.

In general, if the random variable X follows the geometric distribution with parameters p, we write $ X \sim \mathcal{G}(p)$. The probability of getting exactly k failures befor a success in Bernoulli trials is given by the probability mass function:

\[ f(k;p) = \mathbb{P}(X = k) = p(1-p)^{k} \mbox{ for } k=0,1,\ldots \]

Definition at line 58 of file STK_Law_Geometric.h.

Member Typedef Documentation

◆ Base

Constructor & Destructor Documentation

◆ Geometric()

STK::Law::Geometric::Geometric ( Real const &  prob = 0.5)
inline

constructor

Parameters
probprobability of success in a Bernoulli trial

Definition at line 65 of file STK_Law_Geometric.h.

65 : Base(_T("Geometric")), prob_(prob)
66 {}
#define _T(x)
Let x unmodified.
IUnivLaw< Integer > Base
Real const & prob() const
Real prob_
probability of success in a Bernoulli trial

◆ ~Geometric()

virtual STK::Law::Geometric::~Geometric ( )
inlinevirtual

destructor

Definition at line 68 of file STK_Law_Geometric.h.

68{}

Member Function Documentation

◆ cdf() [1/2]

Real STK::Law::Geometric::cdf ( Real const &  t) const
virtual

compute the cumulative distribution function Give the probability that a Geometric random variate is less or equal to t.

Parameters
ta real value
Returns
the value of the cdf

Implements STK::Law::IUnivLaw< Integer >.

Definition at line 77 of file STK_Law_Geometric.cpp.

78{
79 return 0;
80}

◆ cdf() [2/2]

Real STK::Law::Geometric::cdf ( Real const &  t,
Real const &  prob 
)
static

compute the cumulative distribution function Give the probability that a Geometric random variate is less or equal to t.

Parameters
ta real value
probthe probability of success in a Bernoulli trial
Returns
the value of the cdf

Definition at line 124 of file STK_Law_Geometric.cpp.

125{
126 return 0;
127}

◆ icdf() [1/2]

Integer STK::Law::Geometric::icdf ( Real const &  p) const
virtual

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.

Parameters
pa probability number

Implements STK::Law::IUnivLaw< Integer >.

Definition at line 86 of file STK_Law_Geometric.cpp.

87{
88 return 0;
89}

◆ icdf() [2/2]

Integer STK::Law::Geometric::icdf ( Real const &  p,
Real const &  prob 
)
static

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.

Parameters
pa probability number
probthe probability of success in a Bernoulli trial

Definition at line 133 of file STK_Law_Geometric.cpp.

134{
135 return 0;
136}

◆ lpdf() [1/2]

Real STK::Law::Geometric::lpdf ( Integer const &  x) const
virtual

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

Parameters
xa binary value
Returns
the value of the log-pdf

Reimplemented from STK::Law::IUnivLaw< Integer >.

Definition at line 67 of file STK_Law_Geometric.cpp.

68{
69 return 0;
70}

◆ lpdf() [2/2]

Real STK::Law::Geometric::lpdf ( Integer  x,
Real const &  prob 
)
static

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

Parameters
xa binary value
probthe probability of success in a Bernoulli trial
Returns
the value of the log-pdf

Definition at line 114 of file STK_Law_Geometric.cpp.

115{
116 return 0;
117}

◆ pdf() [1/2]

Real STK::Law::Geometric::pdf ( Integer const &  x) const
virtual

compute the probability distribution function (density) Give the value of the pdf at the point x.

Parameters
xa binary value
Returns
the value of the pdf

Implements STK::Law::IUnivLaw< Integer >.

Definition at line 58 of file STK_Law_Geometric.cpp.

59{
60 return 0;
61}

◆ pdf() [2/2]

Real STK::Law::Geometric::pdf ( Integer  x,
Real const &  prob 
)
static

compute the probability distribution function (density) Give the value of the pdf at the point x.

Parameters
xa binary value
probthe probability of success in a Bernoulli trial
Returns
the value of the pdf

Definition at line 104 of file STK_Law_Geometric.cpp.

105{
106 return 0;
107}

◆ prob()

Real const & STK::Law::Geometric::prob ( ) const
inline
Returns
the probability of success

Definition at line 70 of file STK_Law_Geometric.h.

70{ return prob_;}

References prob_.

Referenced by setProb().

◆ rand() [1/2]

Integer STK::Law::Geometric::rand ( ) const
virtual
Returns
a Integer random variate .

Implements STK::Law::IUnivLaw< Integer >.

Definition at line 49 of file STK_Law_Geometric.cpp.

50{
51 return 0;
52}

◆ rand() [2/2]

Integer STK::Law::Geometric::rand ( Real const &  prob)
static
Parameters
probthe probability of success in a Bernoulli trial
Returns
a Integer random variate.

Definition at line 94 of file STK_Law_Geometric.cpp.

95{
96 return 0;
97}

◆ setProb()

void STK::Law::Geometric::setProb ( Real const &  prob)
inline
Parameters
probthe probability of success to set

Definition at line 72 of file STK_Law_Geometric.h.

73 {
76 prob_ = prob;
77 }
#define STKDOMAIN_ERROR_1ARG(Where, Arg, Error)
Definition STK_Macros.h:165
void setProb(Real const &prob)

References prob(), prob_, setProb(), and STKDOMAIN_ERROR_1ARG.

Referenced by setProb().

Member Data Documentation

◆ prob_

Real STK::Law::Geometric::prob_
protected

probability of success in a Bernoulli trial

Definition at line 152 of file STK_Law_Geometric.h.

Referenced by prob(), and setProb().


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