Extends the class DiscreteDistributionInt for the discrete uniform distribution over the range \([i,j]\). More...
Public Member Functions | |
| UniformIntDist (int i, int j) | |
| Constructs a discrete uniform distribution over the interval \([i,j]\). | |
| 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 | getI () |
| Returns the parameter \(i\). | |
| int | getJ () |
| Returns the parameter \(j\). | |
| void | setParams (int i, int j) |
| Sets the parameters \(i\) and \(j\) for this object. | |
| double[] | getParams () |
| Return a table containing the parameters of the current distribution. | |
| 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 i, int j, int x) |
Computes the discrete uniform probability \(p(x)\) defined in ( fmassuniformint ). | |
| static double | cdf (int i, int j, int x) |
Computes the discrete uniform distribution function defined in ( cdfuniformint ). | |
| static double | barF (int i, int j, int x) |
| Computes the discrete uniform complementary distribution function. | |
| static int | inverseF (int i, int j, double u) |
Computes the inverse of the discrete uniform distribution function ( invuniformint ). | |
| static double[] | getMLE (int[] x, int n) |
| Estimates the parameters \((i, j)\) of the uniform distribution over integers using the maximum likelihood method, from the \(n\) observations \(x[k]\), \(k = 0, 1, …, n-1\). | |
| static UniformIntDist | getInstanceFromMLE (int[] x, int n) |
| Creates a new instance of a discrete uniform distribution over integers with parameters \(i\) and \(j\) estimated using the maximum likelihood method based on the \(n\) observations. | |
| static double | getMean (int i, int j) |
| Computes and returns the mean \(E[X] = (i + j)/2\) of the discrete uniform distribution. | |
| static double | getVariance (int i, int j) |
| Computes and returns the variance \(\mbox{Var}[X] = [(j - i + 1)^2 -
1]/{12}\) of the discrete uniform distribution. | |
| static double | getStandardDeviation (int i, int j) |
| Computes and returns the standard deviation of the discrete uniform distribution. | |
Additional Inherited Members | |
| 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. | |
Extends the class DiscreteDistributionInt for the discrete uniform distribution over the range \([i,j]\).
Its mass function is given by
\[ p(x) = \frac{1}{j - i + 1} \qquad\mbox{ for } x = i, i + 1, …, j \tag{fmassuniformint} \]
and 0 elsewhere. The distribution function is
\[ F(x) = \left\{\begin{array}{ll} 0, & \mbox{ for } x < i \\ \displaystyle\frac{\lfloor x\rfloor-i+1}{j-i+1}, & \mbox{ for } i\le x < j \\ 1, & \mbox{ for } x \ge j. \end{array}\right. \tag{cdfuniformint} \]
\[ F^{-1}(u) = i + \lfloor(j - i + 1)u\rfloor\qquad\mbox{for }0 \le u \le1. \tag{invuniformint} \]
Definition at line 46 of file UniformIntDist.java.
| umontreal.ssj.probdist.UniformIntDist.UniformIntDist | ( | int | i, |
| int | j ) |
Constructs a discrete uniform distribution over the interval \([i,j]\).
Definition at line 53 of file UniformIntDist.java.
|
static |
Computes the discrete uniform complementary distribution function.
\(\bar{F}(x)\). WARNING: The complementary distribution function is defined as \(\bar{F}(x) = P[X \ge x]\).
Definition at line 119 of file UniformIntDist.java.
| double umontreal.ssj.probdist.UniformIntDist.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.
| x | value at which the complementary distribution function must be evaluated |
Reimplemented from umontreal.ssj.probdist.DiscreteDistributionInt.
Definition at line 65 of file UniformIntDist.java.
|
static |
Computes the discrete uniform distribution function defined in ( cdfuniformint ).
Definition at line 102 of file UniformIntDist.java.
| double umontreal.ssj.probdist.UniformIntDist.cdf | ( | int | x | ) |
Returns the distribution function \(F\) evaluated at \(x\) (see ( FDistDisc )).
| x | value at which the distribution function must be evaluated |
Reimplemented from umontreal.ssj.probdist.DiscreteDistributionInt.
Definition at line 61 of file UniformIntDist.java.
| int umontreal.ssj.probdist.UniformIntDist.getI | ( | ) |
Returns the parameter \(i\).
Definition at line 236 of file UniformIntDist.java.
|
static |
Creates a new instance of a discrete uniform distribution over integers with parameters \(i\) and \(j\) estimated using the maximum likelihood method based on the \(n\) observations.
\(x[k]\), \(k = 0, 1, …, n-1\).
| x | the list of observations to use to evaluate parameters |
| n | the number of observations to use to evaluate parameters |
Definition at line 190 of file UniformIntDist.java.
| int umontreal.ssj.probdist.UniformIntDist.getJ | ( | ) |
Returns the parameter \(j\).
Definition at line 243 of file UniformIntDist.java.
| double umontreal.ssj.probdist.UniformIntDist.getMean | ( | ) |
Returns the mean of the distribution function.
Implements umontreal.ssj.probdist.Distribution.
Definition at line 73 of file UniformIntDist.java.
|
static |
Computes and returns the mean \(E[X] = (i + j)/2\) of the discrete uniform distribution.
Definition at line 203 of file UniformIntDist.java.
|
static |
Estimates the parameters \((i, j)\) of the uniform distribution over integers using the maximum likelihood method, from the \(n\) observations \(x[k]\), \(k = 0, 1, …, n-1\).
The estimates are returned in a two-element array, in regular order: [ \(i\), \(j\)]. The maximum likelihood estimators are the values
\((\hat{\imath}\), \(\hat{\jmath})\) that satisfy the equations
\begin{align*} \hat{\imath} & = \mbox{min} \{x_k\} \\ \hat{\jmath} & = \mbox{max} \{x_k\} \end{align*}
where \(\bar{x}_n\) is the average of \(x[0],…,x[n-1]\).
| x | the list of observations used to evaluate parameters |
| n | the number of observations used to evaluate parameters |
Definition at line 165 of file UniformIntDist.java.
| double[] umontreal.ssj.probdist.UniformIntDist.getParams | ( | ) |
Return a table containing the parameters of the current distribution.
This table is put in regular order: [ \(i\), \(j\)].
Implements umontreal.ssj.probdist.Distribution.
Definition at line 262 of file UniformIntDist.java.
| double umontreal.ssj.probdist.UniformIntDist.getStandardDeviation | ( | ) |
Returns the standard deviation of the distribution function.
Implements umontreal.ssj.probdist.Distribution.
Definition at line 81 of file UniformIntDist.java.
|
static |
Computes and returns the standard deviation of the discrete uniform distribution.
Definition at line 229 of file UniformIntDist.java.
| double umontreal.ssj.probdist.UniformIntDist.getVariance | ( | ) |
Returns the variance of the distribution function.
Implements umontreal.ssj.probdist.Distribution.
Definition at line 77 of file UniformIntDist.java.
|
static |
Computes and returns the variance \(\mbox{Var}[X] = [(j - i + 1)^2 - 1]/{12}\) of the discrete uniform distribution.
Definition at line 216 of file UniformIntDist.java.
|
static |
Computes the inverse of the discrete uniform distribution function ( invuniformint ).
Definition at line 134 of file UniformIntDist.java.
| int umontreal.ssj.probdist.UniformIntDist.inverseFInt | ( | double | u | ) |
Returns the inverse distribution function \(F^{-1}(u)\), where.
\(0\le u\le1\). The default implementation uses binary search.
| u | value in the interval \((0,1)\) for which the inverse distribution function is evaluated |
| IllegalArgumentException | if \(u\) is not in the interval \((0,1)\) |
| ArithmeticException | if 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 69 of file UniformIntDist.java.
|
static |
Computes the discrete uniform probability \(p(x)\) defined in ( fmassuniformint ).
Definition at line 89 of file UniformIntDist.java.
| double umontreal.ssj.probdist.UniformIntDist.prob | ( | int | x | ) |
Returns \(p(x)\), the probability of \(x\).
| x | value at which the mass function must be evaluated |
Reimplemented from umontreal.ssj.probdist.DiscreteDistributionInt.
Definition at line 57 of file UniformIntDist.java.
| void umontreal.ssj.probdist.UniformIntDist.setParams | ( | int | i, |
| int | j ) |
Sets the parameters \(i\) and \(j\) for this object.
Definition at line 250 of file UniformIntDist.java.
| String umontreal.ssj.probdist.UniformIntDist.toString | ( | ) |
Returns a String containing information about the current distribution.
Reimplemented in umontreal.ssj.probdist.ConstantIntDist.
Definition at line 270 of file UniformIntDist.java.