|
SSJ
3.3.1
Stochastic Simulation in Java
|
Extends DiscreteDistribution to an empirical distribution function, based on the observations \(X_{(1)},…,X_{(n)}\) (sorted by increasing order). More...
Public Member Functions | |
| EmpiricalDist (double[] obs) | |
Constructs a new empirical distribution using all the observations stored in obs, and which are assumed to have been sorted in increasing numerical order. More... | |
| EmpiricalDist (Reader in) throws IOException | |
Constructs a new empirical distribution using the observations read from the reader in. More... | |
| double | prob (int i) |
| double | cdf (double x) |
| Returns the distribution function \(F(x)\). More... | |
| double | barF (double x) |
| Returns \(\bar{F}(x) = 1 - F(x)\). More... | |
| double | inverseF (double u) |
| Returns the inverse distribution function \(F^{-1}(u)\), defined in ( inverseF ). More... | |
| double | getMean () |
| Returns the mean of the distribution function. | |
| double | getStandardDeviation () |
| Returns the standard deviation of the distribution function. | |
| double | getVariance () |
| Returns the variance of the distribution function. | |
| double | getMedian () |
| Returns the median. More... | |
| int | getN () |
| Returns \(n\), the number of observations. | |
| double | getObs (int i) |
| Returns the value of \(X_{(i)}\), for \(i=0, 1, …, n-1\). | |
| double | getSampleMean () |
| Returns the sample mean of the observations. | |
| double | getSampleVariance () |
| Returns the sample variance of the observations. | |
| double | getSampleStandardDeviation () |
| Returns the sample standard deviation of the observations. | |
| double | getInterQuartileRange () |
| Returns the interquartile range of the observations, defined as the difference between the third and first quartiles. | |
| double [] | getParams () |
| Return a table containing parameters of the current distribution. | |
| String | toString () |
Returns a String containing information about the current distribution. | |
Public Member Functions inherited from DiscreteDistribution | |
| 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. | |
Static Public Member Functions | |
| static double | getMedian (double obs[], int n) |
| Returns the median. More... | |
Additional Inherited Members | |
Protected Attributes inherited from DiscreteDistribution | |
| double | cdf [] = null |
| double | pr [] = null |
| int | xmin = 0 |
| int | xmax = 0 |
| int | xmed = 0 |
| int | nVal |
| double | sortedVal [] |
| double | supportA = Double.NEGATIVE_INFINITY |
| double | supportB = Double.POSITIVE_INFINITY |
Extends DiscreteDistribution to an empirical distribution function, based on the observations \(X_{(1)},…,X_{(n)}\) (sorted by increasing order).
The distribution is uniform over the \(n\) observations, so the distribution function has a jump of \(1/n\) at each of the \(n\) observations.
| EmpiricalDist | ( | double [] | obs | ) |
Constructs a new empirical distribution using all the observations stored in obs, and which are assumed to have been sorted in increasing numerical order.
[1] These observations are copied into an internal array.
| EmpiricalDist | ( | Reader | in | ) | throws IOException |
Constructs a new empirical distribution using the observations read from the reader in.
This constructor will read the first double of each line in the stream. Any line that does not start with a +, -, or a decimal digit, is ignored. One must be careful about lines starting with a blank. This format is the same as in UNURAN. The observations read are assumed to have been sorted in increasing numerical order.
| double barF | ( | double | x | ) |
Returns \(\bar{F}(x) = 1 - F(x)\).
| x | value at which the complementary distribution function is evaluated |
x Implements Distribution.
| double cdf | ( | double | x | ) |
Returns the distribution function \(F(x)\).
| x | value at which the distribution function is evaluated |
x Implements Distribution.
| double getMedian | ( | ) |
Returns the median.
Returns the \(n/2^{\mbox{th}}\) item of the sorted observations when the number of items is odd, and the mean of the \(n/2^{\mbox{th}}\) and the \((n/2 + 1)^{\mbox{th}}\) items when the number of items is even.
|
static |
Returns the median.
Returns the \(n/2^{\mbox{th}}\) item of the array obs when the number of items is odd, and the mean of the \(n/2^{\mbox{th}}\) and the \((n/2 + 1)^{\mbox{th}}\) items when the number of items is even. The array does not have to be sorted.
| obs | the array of observations |
| n | the number of observations |
| double inverseF | ( | double | u | ) |
Returns the inverse distribution function \(F^{-1}(u)\), defined in ( inverseF ).
| u | value in the interval \((0,1)\) for which the inverse distribution function is evaluated |
u Implements Distribution.
1.8.14