SSJ API Documentation
Stochastic Simulation in Java
Loading...
Searching...
No Matches
umontreal.ssj.probdist.HypergeometricDist Class Reference

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

Inheritance diagram for umontreal.ssj.probdist.HypergeometricDist:
umontreal.ssj.probdist.DiscreteDistributionInt umontreal.ssj.probdist.Distribution

Public Member Functions

 HypergeometricDist (int m, int l, int k)
 Constructs an hypergeometric distribution with parameters \(m\),.
double prob (int x)
 Returns \(p(x)\), the probability of \(x\).
double cdf (int x)
 Returns the distribution function \(F\) evaluated at \(x\) (see ( FDistDisc )).
double barF (int x)
 Returns \(\bar{F}(x)\), the complementary distribution function.
int inverseFInt (double u)
 Returns the inverse distribution function \(F^{-1}(u)\), where.
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.
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 umontreal.ssj.probdist.DiscreteDistributionInt
double cdf (double x)
 Returns the distribution function \(F\) evaluated at \(x\) (see ( FDistDisc )).
double barF (double x)
 Returns \(\bar{F}(x)\), the complementary distribution function.
int getXinf ()
 Returns the lower limit \(x_a\) of the support of the probability mass function.
int getXsup ()
 Returns the upper limit \(x_b\) of the support of the probability mass function.
double inverseF (double u)
 Returns the inverse distribution function \(F^{-1}(u)\), where.

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.
static int inverseF (int m, int l, int k, double u)
 Computes \(F^{-1}(u)\) for the hypergeometric distribution without using precomputed tables.
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.
static double getVariance (int m, int l, int k)
 Computes and returns the variance.
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\).

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 umontreal.ssj.probdist.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.

Detailed Description

Extends the class DiscreteDistributionInt for the hypergeometric distribution [64]  (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} \]

Definition at line 43 of file HypergeometricDist.java.

Constructor & Destructor Documentation

◆ HypergeometricDist()

umontreal.ssj.probdist.HypergeometricDist.HypergeometricDist ( int m,
int l,
int k )

Constructs an hypergeometric distribution with parameters \(m\),.

\(l\) and \(k\).

Definition at line 70 of file HypergeometricDist.java.

Member Function Documentation

◆ barF() [1/2]

double umontreal.ssj.probdist.HypergeometricDist.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]\).

Definition at line 210 of file HypergeometricDist.java.

◆ barF() [2/2]

double umontreal.ssj.probdist.HypergeometricDist.barF ( int x)

Returns \(\bar{F}(x)\), the complementary distribution function.

See the WARNING above. The default implementation returns 1.0 - cdf(x - 1), which is not accurate when \(F(x)\) is near 1.

Parameters
xvalue at which the complementary distribution function must be evaluated
Returns
the complementary distribution function evaluated at x

Reimplemented from umontreal.ssj.probdist.DiscreteDistributionInt.

Definition at line 101 of file HypergeometricDist.java.

◆ cdf() [1/2]

double umontreal.ssj.probdist.HypergeometricDist.cdf ( int m,
int l,
int k,
int x )
static

Computes the distribution function \(F(x)\).

Definition at line 183 of file HypergeometricDist.java.

◆ cdf() [2/2]

double umontreal.ssj.probdist.HypergeometricDist.cdf ( int x)

Returns the distribution function \(F\) evaluated at \(x\) (see ( FDistDisc )).

Parameters
xvalue at which the distribution function must be evaluated
Returns
the distribution function evaluated at x

Reimplemented from umontreal.ssj.probdist.DiscreteDistributionInt.

Definition at line 82 of file HypergeometricDist.java.

◆ getK()

int umontreal.ssj.probdist.HypergeometricDist.getK ( )

Returns the \(k\) associated with this object.

Definition at line 331 of file HypergeometricDist.java.

◆ getL()

int umontreal.ssj.probdist.HypergeometricDist.getL ( )

Returns the \(l\) associated with this object.

Definition at line 324 of file HypergeometricDist.java.

◆ getM()

int umontreal.ssj.probdist.HypergeometricDist.getM ( )

Returns the \(m\) associated with this object.

Definition at line 317 of file HypergeometricDist.java.

◆ getMean() [1/2]

double umontreal.ssj.probdist.HypergeometricDist.getMean ( )

Returns the mean of the distribution function.

Implements umontreal.ssj.probdist.Distribution.

Definition at line 140 of file HypergeometricDist.java.

◆ getMean() [2/2]

double umontreal.ssj.probdist.HypergeometricDist.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\)

Definition at line 272 of file HypergeometricDist.java.

◆ getParams()

double[] umontreal.ssj.probdist.HypergeometricDist.getParams ( )

Return a table containing the parameters of the current distribution.

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

Implements umontreal.ssj.probdist.Distribution.

Definition at line 401 of file HypergeometricDist.java.

◆ getStandardDeviation() [1/2]

double umontreal.ssj.probdist.HypergeometricDist.getStandardDeviation ( )

Returns the standard deviation of the distribution function.

Implements umontreal.ssj.probdist.Distribution.

Definition at line 148 of file HypergeometricDist.java.

◆ getStandardDeviation() [2/2]

double umontreal.ssj.probdist.HypergeometricDist.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

Definition at line 310 of file HypergeometricDist.java.

◆ getVariance() [1/2]

double umontreal.ssj.probdist.HypergeometricDist.getVariance ( )

Returns the variance of the distribution function.

Implements umontreal.ssj.probdist.Distribution.

Definition at line 144 of file HypergeometricDist.java.

◆ getVariance() [2/2]

double umontreal.ssj.probdist.HypergeometricDist.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)\)

Definition at line 292 of file HypergeometricDist.java.

◆ inverseF()

int umontreal.ssj.probdist.HypergeometricDist.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 [98] .

Definition at line 237 of file HypergeometricDist.java.

◆ inverseFInt()

int umontreal.ssj.probdist.HypergeometricDist.inverseFInt ( double u)

Returns the inverse distribution function \(F^{-1}(u)\), where.

\(0\le u\le1\). The default implementation uses binary search.

Parameters
uvalue in the interval \((0,1)\) for which the inverse distribution function is evaluated
Returns
the inverse distribution function evaluated at u
Exceptions
IllegalArgumentExceptionif \(u\) is not in the interval \((0,1)\)
ArithmeticExceptionif the inverse cannot be computed, for example if it would give infinity in a theoritical context

Reimplemented from umontreal.ssj.probdist.DiscreteDistributionInt.

Definition at line 120 of file HypergeometricDist.java.

◆ prob() [1/2]

double umontreal.ssj.probdist.HypergeometricDist.prob ( int m,
int l,
int k,
int x )
static

Computes the hypergeometric probability \(p(x)\) given by ( fheperg ).

Definition at line 156 of file HypergeometricDist.java.

◆ prob() [2/2]

double umontreal.ssj.probdist.HypergeometricDist.prob ( int x)

Returns \(p(x)\), the probability of \(x\).

Parameters
xvalue at which the mass function must be evaluated
Returns
the mass function evaluated at x

Reimplemented from umontreal.ssj.probdist.DiscreteDistributionInt.

Definition at line 74 of file HypergeometricDist.java.

◆ setParams()

void umontreal.ssj.probdist.HypergeometricDist.setParams ( int m,
int l,
int k )

Resets the parameters of this object to \(m\), \(l\) and \(k\).

Definition at line 409 of file HypergeometricDist.java.

◆ toString()

String umontreal.ssj.probdist.HypergeometricDist.toString ( )

Returns a String containing information about the current distribution.

Definition at line 430 of file HypergeometricDist.java.

Member Data Documentation

◆ MAXN

double umontreal.ssj.probdist.HypergeometricDist.MAXN = 100000
static

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.

Definition at line 59 of file HypergeometricDist.java.


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