SSJ  3.3.1
Stochastic Simulation in Java
Public Member Functions | Static Public Member Functions | List of all members
HypergeometricDist Class Reference

Extends the class DiscreteDistributionInt for the hypergeometric distribution [66]  (page 101) with \(k\) elements chosen among \(l\), \(m\) being of one type, and \(l-m\) of the other. More...

Inheritance diagram for HypergeometricDist:
[legend]
Collaboration diagram for HypergeometricDist:
[legend]

Public Member Functions

 HypergeometricDist (int m, int l, int k)
 Constructs an hypergeometric distribution with parameters \(m\), \(l\) and \(k\).
 
double prob (int x)
 
double cdf (int x)
 
double barF (int x)
 
int inverseFInt (double u)
 
double getMean ()
 Returns the mean of the distribution function.
 
double getVariance ()
 Returns the variance of the distribution function.
 
double getStandardDeviation ()
 Returns the standard deviation of the distribution function.
 
int getM ()
 Returns the \(m\) associated with this object.
 
int getL ()
 Returns the \(l\) associated with this object.
 
int getK ()
 Returns the \(k\) associated with this object.
 
double [] getParams ()
 Return a table containing the parameters of the current distribution. More...
 
void setParams (int m, int l, int k)
 Resets the parameters of this object to \(m\), \(l\) and \(k\).
 
String toString ()
 Returns a String containing information about the current distribution.
 
- Public Member Functions inherited from DiscreteDistributionInt
abstract double prob (int x)
 Returns \(p(x)\), the probability of \(x\). More...
 
double cdf (double x)
 Returns the distribution function \(F\) evaluated at \(x\) (see ( FDistDisc )). More...
 
abstract double cdf (int x)
 Returns the distribution function \(F\) evaluated at \(x\) (see ( FDistDisc )). More...
 
double barF (double x)
 Returns \(\bar{F}(x)\), the complementary distribution function. More...
 
double barF (int x)
 Returns \(\bar{F}(x)\), the complementary distribution function. More...
 
int getXinf ()
 Returns the lower limit \(x_a\) of the support of the probability mass function. More...
 
int getXsup ()
 Returns the upper limit \(x_b\) of the support of the probability mass function. More...
 
double inverseF (double u)
 Returns the inverse distribution function \(F^{-1}(u)\), where. More...
 
int inverseFInt (double u)
 Returns the inverse distribution function \(F^{-1}(u)\), where. More...
 

Static Public Member Functions

static double prob (int m, int l, int k, int x)
 Computes the hypergeometric probability \(p(x)\) given by ( fheperg ).
 
static double cdf (int m, int l, int k, int x)
 Computes the distribution function \(F(x)\).
 
static double barF (int m, int l, int k, int x)
 Computes the complementary distribution function. More...
 
static int inverseF (int m, int l, int k, double u)
 Computes \(F^{-1}(u)\) for the hypergeometric distribution without using precomputed tables. More...
 
static double getMean (int m, int l, int k)
 Computes and returns the mean \(E[X] = km/l\) of the Hypergeometric distribution with parameters \(m\), \(l\) and \(k\). More...
 
static double getVariance (int m, int l, int k)
 Computes and returns the variance \(\mbox{Var}[X] = \frac{(km/l)(1 - m/l)(l - k)}{l - 1}\) of the hypergeometric distribution with parameters \(m\), \(l\) and \(k\). More...
 
static double getStandardDeviation (int m, int l, int k)
 Computes and returns the standard deviation of the hypergeometric distribution with parameters \(m\), \(l\) and \(k\). More...
 

Static Public Attributes

Constant
static double MAXN = 100000
 If the number of integers in the interval \([\max(0,k-l+m), \min(k,m)]\) is larger than this constant, the tables will not be precomputed by the constructor.
 
- Static Public Attributes inherited from DiscreteDistributionInt
static double EPSILON = 1.0e-16
 Environment variable that determines what probability terms can be considered as negligible when building precomputed tables for distribution and mass functions. More...
 

Additional Inherited Members

- Protected Attributes inherited from DiscreteDistributionInt
double cdf [] = null
 
double pdf [] = null
 
int xmin = 0
 
int xmax = 0
 
int xmed = 0
 
int supportA = Integer.MIN_VALUE
 
int supportB = Integer.MAX_VALUE
 
- Static Protected Attributes inherited from DiscreteDistributionInt
static final double EPS_EXTRA = 1.0e-6
 

Detailed Description

Extends the class DiscreteDistributionInt for the hypergeometric distribution [66]  (page 101) with \(k\) elements chosen among \(l\), \(m\) being of one type, and \(l-m\) of the other.

The parameters \(m\), \(k\) and \(l\) are positive integers where \(1\le m\le l\) and \(1\le k\le l\). Its mass function is given by

\[ p(x) = \frac{ \binom{m}{x} \binom{l - m}{k-x}}{\binom{l}{k}} \qquad\mbox{for } \max(0,k-l+m)\le x\le\min(k, m). \tag{fheperg} \]

Member Function Documentation

◆ barF()

static double barF ( int  m,
int  l,
int  k,
int  x 
)
static

Computes the complementary distribution function.

WARNING: The complementary distribution function is defined as \(\bar{F}(x) = P[X \ge x]\).

◆ getMean()

static double getMean ( int  m,
int  l,
int  k 
)
static

Computes and returns the mean \(E[X] = km/l\) of the Hypergeometric distribution with parameters \(m\), \(l\) and \(k\).

Returns
the mean of the hypergeometric distribution \(E[X] = km / l\)

◆ getParams()

double [] getParams ( )

Return a table containing the parameters of the current distribution.

This table is put in regular order: [ \(m\), \(l\), \(k\)].

Implements Distribution.

◆ getStandardDeviation()

static double getStandardDeviation ( int  m,
int  l,
int  k 
)
static

Computes and returns the standard deviation of the hypergeometric distribution with parameters \(m\), \(l\) and \(k\).

Returns
the standard deviation of the hypergeometric distribution

◆ getVariance()

static double getVariance ( int  m,
int  l,
int  k 
)
static

Computes and returns the variance \(\mbox{Var}[X] = \frac{(km/l)(1 - m/l)(l - k)}{l - 1}\) of the hypergeometric distribution with parameters \(m\), \(l\) and \(k\).

Returns
the variance of the Hypergeometric distribution \(\mbox{Var}[X] = (km / l)(1 - m / l)(l - k) / (l - 1)\)

◆ inverseF()

static int inverseF ( int  m,
int  l,
int  k,
double  u 
)
static

Computes \(F^{-1}(u)\) for the hypergeometric distribution without using precomputed tables.

The inversion is computed using the chop-down algorithm [102] .


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