SSJ
3.3.1
Stochastic Simulation in Java
|
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) |
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 | 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. More... | |
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 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 \(\bar{F}(x)\). More... | |
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\). More... | |
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 \(x[k]\), \(k = 0, 1, …, n-1\). More... | |
static double | getMean (int i, int j) |
Computes and returns the mean \(E[X] = (i + j)/2\) of the discrete uniform distribution. More... | |
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. More... | |
static double | getStandardDeviation (int i, int j) |
Computes and returns the standard deviation of the discrete uniform distribution. More... | |
Protected Attributes | |
int | i |
int | j |
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 |
Additional Inherited Members | |
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... | |
Static Protected Attributes inherited from DiscreteDistributionInt | |
static final double | EPS_EXTRA = 1.0e-6 |
Extends the class DiscreteDistributionInt for the discrete uniform distribution over the range \([i,j]\).
\[ 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} \]
|
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]\).
|
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 |
|
static |
Computes and returns the mean \(E[X] = (i + j)/2\) of the discrete uniform distribution.
|
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 |
double [] getParams | ( | ) |
Return a table containing the parameters of the current distribution.
This table is put in regular order: [ \(i\), \(j\)].
Implements Distribution.
|
static |
Computes and returns the standard deviation of the discrete uniform distribution.
|
static |
Computes and returns the variance \(\mbox{Var}[X] = [(j - i + 1)^2 - 1]/{12}\) of the discrete uniform distribution.