SSJ
3.3.1
Stochastic Simulation in Java
|
This class implements discrete distributions over a finite set of real numbers (also over integers as a particular case). More...
Public Member Functions | |
DiscreteDistribution (double[] values, double[] prob, int n) | |
Constructs a discrete distribution over the \(n\) values contained in array values , with probabilities given in array prob . More... | |
DiscreteDistribution (int[] values, double[] prob, int n) | |
Similar to DiscreteDistribution(double[], double[], int). | |
double | cdf (double x) |
double | barF (double x) |
double | inverseF (double u) |
double | getMean () |
Computes the mean \(E[X] = \sum_i^{} p_i x_i\) of the distribution. | |
double | getVariance () |
Computes the variance \(\mbox{Var}[X] = \sum_i^{} p_i (x_i - E[X])^2\) of the distribution. | |
double | getStandardDeviation () |
Computes the standard deviation of the distribution. | |
double [] | getParams () |
Returns a table containing the parameters of the current distribution. More... | |
int | getN () |
Returns the number of possible values \(x_i\). | |
double | prob (int i) |
Returns \(p_i\), the probability of the \(i\)-th value, for. More... | |
double | getValue (int i) |
Returns the \(i\)-th value \(x_i\), for \(0\le i<n\). | |
double | getXinf () |
Returns the lower limit \(x_0\) of the support of the distribution. More... | |
double | getXsup () |
Returns the upper limit \(x_{n-1}\) of the support of the distribution. More... | |
String | toString () |
Returns a String containing information about the current distribution. | |
This class implements discrete distributions over a finite set of real numbers (also over integers as a particular case).
We assume that the random variable \(X\) of interest can take one of the \(n\) values
\(x_0 < \cdots< x_{n-1}\), which must be sorted by increasing order. \(X\) can take the value \(x_k\) with probability \(p_k = P[X = x_k]\). In addition to the methods specified in the interface umontreal.ssj.probdist.Distribution, a method that returns the probability \(p_k\) is supplied.
DiscreteDistribution | ( | double [] | values, |
double [] | prob, | ||
int | n | ||
) |
Constructs a discrete distribution over the \(n\) values contained in array values
, with probabilities given in array prob
.
Both arrays must have at least \(n\) elements, the probabilities must sum to 1, and the values are assumed to be sorted by increasing order.
double barF | ( | double | x | ) |
x | value at which the complementary distribution function is evaluated |
x
Implements Distribution.
double cdf | ( | double | x | ) |
x | value at which the cdf is evaluated |
x
Implements Distribution.
double [] getParams | ( | ) |
Returns a table containing the parameters of the current distribution.
This table is built in regular order, according to constructor DiscreteDistribution(double[] params)
order.
Implements Distribution.
double getXinf | ( | ) |
Returns the lower limit \(x_0\) of the support of the distribution.
double getXsup | ( | ) |
Returns the upper limit \(x_{n-1}\) of the support of the distribution.
double inverseF | ( | double | u | ) |
u | value in the interval \((0,1)\) for which the inverse distribution function is evaluated |
u
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 theoretical context |
Implements Distribution.
double prob | ( | int | i | ) |
Returns \(p_i\), the probability of the \(i\)-th value, for.
\(0\le i<n\).
i | value number, \(0\le i < n\) |
i