|
STK++ 0.9.13
|
HyperGeometric probability law. More...
#include <STK_Law_HyperGeometric.h>

Public Types | |
| typedef IUnivLaw< Integer > | Base |
Public Member Functions | |
| HyperGeometric (int nbSuccesses, int nbFailures, int nbDraws) | |
| constructor | |
| virtual | ~HyperGeometric () |
| destructor | |
| int | nbSuccesses () const |
| int | nbFailures () const |
| int | nbDraws () const |
| void | setNbSuccesses (int nbSuccesses) |
| void | setNbFailures (int nbFailures) |
| void | setNbDraws (int nbDraws) |
| 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 HyperGeometric 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 (int nbSuccesses, int nbFailures, int nbDraws) |
| random hypergeometric variate generation. | |
| static Real | pdf (Integer x, int nbSuccesses, int nbFailures, int nbDraws) |
| compute the probability distribution function. | |
| static Real | lpdf (Integer x, int nbSuccesses, int nbFailures, int nbDraws) |
| compute the log probability distribution function. | |
| static Real | cdf (Real const &t, int nbSuccesses, int nbFailures, int nbDraws) |
| compute the cumulative distribution function Give the probability that a HyperGeometric random variate is less or equal to t. | |
| static Integer | icdf (Real const &p, int nbSuccesses, int nbFailures, int nbDraws) |
| 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 | |
| int | nbSuccesses_ |
| number of successes | |
| int | nbFailures_ |
| number of failures | |
| int | nbDraws_ |
| number of draws | |
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. | |
HyperGeometric probability law.
In probability theory and statistics, the hypergeometric distribution is a discrete probability distribution that describes the probability of x successes in k draws, without replacement, from a finite population of size m+n that contains exactly m successes, wherein each draw is either a success or a failure. In contrast, the binomial distribution describes the probability of k successes inn draws with replacement.
The hypergeometric distribution is used for sampling without replacement. The density of this distribution with parameters m, n and k is given by
![\[
p(x;m,n,k) = \frac{\binom{m}{x} \binom{n}{k-x}}{\binom{m+n}{k}}
\quad x=0,\ldots,k, \quad m\geq 0,\quad n\geq 0,\quad 0\leq k \leq m+n.
\]](form_239.png)
Definition at line 64 of file STK_Law_HyperGeometric.h.
Definition at line 67 of file STK_Law_HyperGeometric.h.
constructor
| nbSuccesses,nbFailures,nbDraws | number of successes, failures, draws |
Definition at line 71 of file STK_Law_HyperGeometric.h.
|
inlinevirtual |
compute the cumulative distribution function Give the probability that a HyperGeometric random variate is less or equal to t.
| t | a real value |
Implements STK::Law::IUnivLaw< Integer >.
Definition at line 77 of file STK_Law_HyperGeometric.cpp.
|
static |
compute the cumulative distribution function Give the probability that a HyperGeometric random variate is less or equal to t.
| t | a real value |
| nbSuccesses,nbFailures,nbDraws | number of successes, failures, draws |
Definition at line 124 of file STK_Law_HyperGeometric.cpp.
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.
| p | a probability number |
Implements STK::Law::IUnivLaw< Integer >.
Definition at line 86 of file STK_Law_HyperGeometric.cpp.
|
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.
| p | a probability number |
| nbSuccesses,nbFailures,nbDraws | number of successes, failures, draws |
Definition at line 133 of file STK_Law_HyperGeometric.cpp.
compute the log probability distribution function Give the value of the log-pdf at the point x.
| x | an Integer value |
Reimplemented from STK::Law::IUnivLaw< Integer >.
Definition at line 67 of file STK_Law_HyperGeometric.cpp.
|
static |
compute the log probability distribution function.
| x | an Integer value |
| nbSuccesses,nbFailures,nbDraws | number of successes, failures, draws |
Definition at line 114 of file STK_Law_HyperGeometric.cpp.
|
inline |
Definition at line 84 of file STK_Law_HyperGeometric.h.
References nbDraws_.
Referenced by setNbDraws().
|
inline |
Definition at line 82 of file STK_Law_HyperGeometric.h.
References nbFailures_.
Referenced by setNbDraws(), and setNbFailures().
|
inline |
Definition at line 80 of file STK_Law_HyperGeometric.h.
References nbSuccesses_.
Referenced by setNbDraws(), and setNbSuccesses().
compute the probability distribution function (density) Give the value of the pdf at the point x.
| x | an Integer value |
Implements STK::Law::IUnivLaw< Integer >.
Definition at line 58 of file STK_Law_HyperGeometric.cpp.
|
static |
compute the probability distribution function.
Give the value of the pdf at the point x.
| x | an Integer value |
| nbSuccesses,nbFailures,nbDraws | number of successes, failures, draws |
Definition at line 105 of file STK_Law_HyperGeometric.cpp.
|
virtual |
Implements STK::Law::IUnivLaw< Integer >.
Definition at line 49 of file STK_Law_HyperGeometric.cpp.
random hypergeometric variate generation.
| nbSuccesses,nbFailures,nbDraws | number of successes, failures, draws |
Definition at line 95 of file STK_Law_HyperGeometric.cpp.
| nbDraws | the number of draws to set |
Definition at line 100 of file STK_Law_HyperGeometric.h.
References nbDraws(), nbDraws_, nbFailures(), nbFailures_, nbSuccesses(), nbSuccesses_, setNbDraws(), and STKDOMAIN_ERROR_1ARG.
Referenced by setNbDraws().
| nbFailures | the number of failures to set |
Definition at line 93 of file STK_Law_HyperGeometric.h.
References nbFailures(), nbFailures_, setNbFailures(), and STKDOMAIN_ERROR_1ARG.
Referenced by setNbFailures().
| nbSuccesses | the number of successes to set |
Definition at line 86 of file STK_Law_HyperGeometric.h.
References nbSuccesses(), nbSuccesses_, setNbSuccesses(), and STKDOMAIN_ERROR_1ARG.
Referenced by setNbSuccesses().
|
protected |
number of draws
Definition at line 185 of file STK_Law_HyperGeometric.h.
Referenced by nbDraws(), and setNbDraws().
|
protected |
number of failures
Definition at line 183 of file STK_Law_HyperGeometric.h.
Referenced by nbFailures(), setNbDraws(), and setNbFailures().
|
protected |
number of successes
Definition at line 181 of file STK_Law_HyperGeometric.h.
Referenced by nbSuccesses(), setNbDraws(), and setNbSuccesses().