|
STK++ 0.9.13
|
class for the Uniform law distribution. More...
#include <STK_Law_UniformDiscrete.h>

Public Types | |
| typedef IUnivLaw< int > | Base |
Public Member Functions | |
| UniformDiscrete (int a, int b) | |
| constructor. | |
| UniformDiscrete (UniformDiscrete const &law) | |
| copy constructor. | |
| virtual | ~UniformDiscrete () |
| destructor. | |
| int const & | a () const |
| int const & | b () const |
| Real const & | n () const |
| void | setA (int a) |
| void | setB (int b) |
| virtual int | rand () const |
| Generate a pseudo Uniform random variate. | |
| virtual Real | pdf (int const &x) const |
| Give the value of the pdf at x. | |
| virtual Real | lpdf (int const &x) const |
| Give the value of the log-pdf at x. | |
| virtual Real | cdf (Real const &t) const |
| The cumulative distribution function is. | |
| virtual int | icdf (Real const &p) const |
| The inverse cumulative distribution function is. | |
Public Member Functions inherited from STK::Law::IUnivLaw< int > | |
| 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 int | rand (int a, int b) |
| Generate a pseudo Uniform random variate. | |
| static Real | pdf (Real const &x, int a, int b) |
| Give the value of the pdf at x. | |
| static Real | lpdf (Real const &p, int a, int b) |
| Give the value of the log-pdf at x. | |
| static Real | cdf (Real const &t, int a, int b) |
| Give the value of the cdf at t. | |
| static int | icdf (Real const &p, int a, int b) |
| Give the value of the quantile at p. | |
Protected Attributes | |
| int | a_ |
| The lower bound. | |
| int | b_ |
| The upper bound. | |
Protected Attributes inherited from STK::Law::ILawBase | |
| String | name_ |
| Name of the Law. | |
Private Attributes | |
| Real | n_ |
Additional Inherited Members | |
Protected Member Functions inherited from STK::Law::IUnivLaw< int > | |
| 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. | |
class for the Uniform law distribution.
In probability theory and statistics, the discrete uniform distribution is a probability distribution whereby a finite number of values are equally likely to be observed; every one of n values has equal probability 1/n. Another way of saying "discrete uniform distribution" would be "a known, finite number of outcomes equally likely to happen".
The probability density function of the discrete uniform distribution is:
![\[
f(x; a, b) = \frac{1}{b-a+1} 1_{ a \leq x \leq b}, \quad a,b,x\in\mathbb{N}.
\]](form_259.png)
Definition at line 58 of file STK_Law_UniformDiscrete.h.
Definition at line 61 of file STK_Law_UniformDiscrete.h.
constructor.
| a,b | the lower and upper bounds |
Definition at line 65 of file STK_Law_UniformDiscrete.h.
References a_, b_, n_, STKINVALIDARGUMENT_ERROR_2ARG, and UniformDiscrete().
Referenced by UniformDiscrete().
|
inline |
|
inlinevirtual |
The cumulative distribution function is.
![\[
F(t; a,b)= \frac{t - a}{b-a}
\]](form_257.png)
| t | a real value |
Implements STK::Law::IUnivLaw< int >.
Definition at line 75 of file STK_Law_UniformDiscrete.cpp.
The inverse cumulative distribution function is.
![\[
F^{-1}(p; \lambda) = p (b-a) + a.
\]](form_258.png)
| p | a probability |
Implements STK::Law::IUnivLaw< int >.
Definition at line 89 of file STK_Law_UniformDiscrete.cpp.
References a_, b_, STK::Law::Exponential::icdf(), and STKDOMAIN_ERROR_1ARG.
Give the value of the log-pdf at x.
| x | a real value |
Reimplemented from STK::Law::IUnivLaw< int >.
Definition at line 63 of file STK_Law_UniformDiscrete.cpp.
Give the value of the log-pdf at x.
| p | a probablility |
| a,b | the lower and upper bounds |
Definition at line 123 of file STK_Law_UniformDiscrete.cpp.
Give the value of the pdf at x.
| x | a real value |
Implements STK::Law::IUnivLaw< int >.
Definition at line 54 of file STK_Law_UniformDiscrete.cpp.
Give the value of the pdf at x.
| x | a real value |
| a,b | the lower and upper bounds |
Definition at line 112 of file STK_Law_UniformDiscrete.cpp.
|
virtual |
Generate a pseudo Uniform random variate.
Implements STK::Law::IUnivLaw< int >.
Definition at line 49 of file STK_Law_UniformDiscrete.cpp.
Referenced by STK::CvHandler::partition(), STK::PartitionHandler::partition(), STK::HDMatrixGaussianModel< IdRow_, IdCol_, Array_ >::randomInit(), STK::DiagGaussianBase< Derived >::randomMean(), and STK::HDGaussianBase< Derived >::randomMean().
|
protected |
|
protected |
The upper bound.
Definition at line 143 of file STK_Law_UniformDiscrete.h.
Referenced by b(), cdf(), icdf(), lpdf(), pdf(), setA(), setB(), and UniformDiscrete().
|
private |
Definition at line 146 of file STK_Law_UniformDiscrete.h.
Referenced by cdf(), lpdf(), n(), pdf(), rand(), setA(), setB(), and UniformDiscrete().