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. | |
| EmpiricalDist (Reader in) throws IOException | |
| Constructs a new empirical distribution using the observations read from the reader in. | |
| double | prob (int i) |
| Returns \(p_i\), the probability of the \(i\)-th value, for. | |
| 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 | getStandardDeviation () |
| Computes the standard deviation of the distribution. | |
| double | getVariance () |
| Computes the variance \(\mbox{Var}[X] = \sum_i^{} p_i (x_i - E[X])^2\) of the distribution. | |
| double | getMedian () |
| Returns the median. | |
| 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 umontreal.ssj.probdist.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. | |
| DiscreteDistribution (int[] values, double[] prob, int n) | |
Similar to DiscreteDistribution(double[], double[], int). | |
| 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. | |
| double | getXsup () |
| Returns the upper limit \(x_{n-1}\) of the support of the distribution. | |
Static Public Member Functions | |
| static double | getMedian (double obs[], int n) |
| Returns the median. | |
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.
Definition at line 47 of file EmpiricalDist.java.
| umontreal.ssj.probdist.EmpiricalDist.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.
Definition at line 60 of file EmpiricalDist.java.
| umontreal.ssj.probdist.EmpiricalDist.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.
Definition at line 77 of file EmpiricalDist.java.
| double umontreal.ssj.probdist.EmpiricalDist.barF | ( | double | x | ) |
| x | value at which the complementary distribution function is evaluated |
Reimplemented from umontreal.ssj.probdist.DiscreteDistribution.
Definition at line 129 of file EmpiricalDist.java.
| double umontreal.ssj.probdist.EmpiricalDist.cdf | ( | double | x | ) |
| x | value at which the cdf is evaluated |
Reimplemented from umontreal.ssj.probdist.DiscreteDistribution.
Definition at line 117 of file EmpiricalDist.java.
| double umontreal.ssj.probdist.EmpiricalDist.getInterQuartileRange | ( | ) |
Returns the interquartile range of the observations, defined as the difference between the third and first quartiles.
Definition at line 250 of file EmpiricalDist.java.
| double umontreal.ssj.probdist.EmpiricalDist.getMean | ( | ) |
Computes the mean \(E[X] = \sum_i^{} p_i x_i\) of the distribution.
Reimplemented from umontreal.ssj.probdist.DiscreteDistribution.
Definition at line 170 of file EmpiricalDist.java.
| double umontreal.ssj.probdist.EmpiricalDist.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.
Definition at line 189 of file EmpiricalDist.java.
|
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 |
Definition at line 207 of file EmpiricalDist.java.
| int umontreal.ssj.probdist.EmpiricalDist.getN | ( | ) |
Returns \(n\), the number of observations.
Reimplemented from umontreal.ssj.probdist.DiscreteDistribution.
Definition at line 214 of file EmpiricalDist.java.
| double umontreal.ssj.probdist.EmpiricalDist.getObs | ( | int | i | ) |
Returns the value of \(X_{(i)}\), for \(i=0, 1, …, n-1\).
Definition at line 221 of file EmpiricalDist.java.
| double[] umontreal.ssj.probdist.EmpiricalDist.getParams | ( | ) |
Return a table containing parameters of the current distribution.
Reimplemented from umontreal.ssj.probdist.DiscreteDistribution.
Definition at line 269 of file EmpiricalDist.java.
| double umontreal.ssj.probdist.EmpiricalDist.getSampleMean | ( | ) |
Returns the sample mean of the observations.
Definition at line 228 of file EmpiricalDist.java.
| double umontreal.ssj.probdist.EmpiricalDist.getSampleStandardDeviation | ( | ) |
Returns the sample standard deviation of the observations.
Definition at line 242 of file EmpiricalDist.java.
| double umontreal.ssj.probdist.EmpiricalDist.getSampleVariance | ( | ) |
Returns the sample variance of the observations.
Definition at line 235 of file EmpiricalDist.java.
| double umontreal.ssj.probdist.EmpiricalDist.getStandardDeviation | ( | ) |
Computes the standard deviation of the distribution.
Reimplemented from umontreal.ssj.probdist.DiscreteDistribution.
Definition at line 174 of file EmpiricalDist.java.
| double umontreal.ssj.probdist.EmpiricalDist.getVariance | ( | ) |
Computes the variance \(\mbox{Var}[X] = \sum_i^{} p_i (x_i - E[X])^2\) of the distribution.
Reimplemented from umontreal.ssj.probdist.DiscreteDistribution.
Definition at line 178 of file EmpiricalDist.java.
| double umontreal.ssj.probdist.EmpiricalDist.inverseF | ( | double | u | ) |
| 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 theoretical context |
Reimplemented from umontreal.ssj.probdist.DiscreteDistribution.
Definition at line 141 of file EmpiricalDist.java.
| double umontreal.ssj.probdist.EmpiricalDist.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\) |
Reimplemented from umontreal.ssj.probdist.DiscreteDistribution.
Definition at line 111 of file EmpiricalDist.java.
| String umontreal.ssj.probdist.EmpiricalDist.toString | ( | ) |
Returns a String containing information about the current distribution.
Reimplemented from umontreal.ssj.probdist.DiscreteDistribution.
Definition at line 278 of file EmpiricalDist.java.