Extends the class ContinuousDistribution for a piecewise-linear approximation of the empirical distribution function, based on the observations \(X_{(1)},…,X_{(n)}\) (sorted by increasing order), and defined as follows (e.g., [114] (page 318)). More...
Public Member Functions | |
| PiecewiseLinearEmpiricalDist (double[] obs) | |
| Constructs a new piecewise-linear distribution using all the observations stored in obs. | |
| PiecewiseLinearEmpiricalDist (Reader in) throws IOException | |
| Constructs a new empirical distribution using the observations read from the reader in. | |
| double | density (double x) |
| Returns \(f(x)\), the density evaluated at \(x\). | |
| double | cdf (double x) |
| Returns the distribution function \(F(x)\). | |
| double | barF (double x) |
| Returns the complementary distribution function. | |
| double | inverseF (double u) |
| Returns the inverse distribution function \(x = F^{-1}(u)\). | |
| double | getMean () |
| Returns the mean. | |
| double | getVariance () |
| Returns the variance. | |
| double | getStandardDeviation () |
| Returns the standard deviation. | |
| int | getN () |
| Returns \(n\), the number of observations. | |
| double | getObs (int i) |
| Returns the value of \(X_{(i)}\). | |
| 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[] | 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.ContinuousDistribution | |
| double | inverseBrent (double a, double b, double u, double tol) |
| Computes the inverse distribution function \(x = F^{-1}(u)\), using the Brent-Dekker method. | |
| double | inverseBisection (double u) |
| Computes and returns the inverse distribution function \(x = F^{-1}(u)\), using bisection. | |
| double | getXinf () |
| Returns \(x_a\) such that the probability density is 0 everywhere outside the interval \([x_a, x_b]\). | |
| double | getXsup () |
| Returns \(x_b\) such that the probability density is 0 everywhere outside the interval \([x_a, x_b]\). | |
| void | setXinf (double xa) |
| Sets the value \(x_a=\) xa, such that the probability density is 0 everywhere outside the interval \([x_a, x_b]\). | |
| void | setXsup (double xb) |
| Sets the value \(x_b=\) xb, such that the probability density is 0 everywhere outside the interval \([x_a, x_b]\). | |
Extends the class ContinuousDistribution for a piecewise-linear approximation of the empirical distribution function, based on the observations \(X_{(1)},…,X_{(n)}\) (sorted by increasing order), and defined as follows (e.g., [114] (page 318)).
The distribution function starts at \(X_{(1)}\) and climbs linearly by
\(1/(n-1)\) between any two successive observations. The density is
\[ f(x) = \frac{1}{(n-1)(X_{(i+1)} - X_{(i)})} \mbox{ for }X_{(i)}\le x < X_{(i+1)}\mbox{ and } i=1,2,…,n-1. \]
The distribution function is
\[ F(x) = \left\{\begin{array}{ll} 0 & \mbox{ for } x < X_{(1)}, \\ \displaystyle\frac{i-1}{n-1} + \frac{x - X_{(i)}}{(n-1)(X_{(i+1)} - X_{(i)})} & \mbox{ for } X_{(i)} \le x < X_{(i+1)} \mbox{ and } i<n, \\ 1 & \mbox{ for } x \ge X_{(n)}, \end{array}\right. \]
whose inverse is
\[ F^{-1}(u) = X_{(i)} + ((n-1)u - i + 1)(X_{(i+1)} - X_{(i)}) \]
for \((i-1)/(n-1)\le u \le i/(n-1)\) and \(i=1,…,n-1\).
Definition at line 58 of file PiecewiseLinearEmpiricalDist.java.
| umontreal.ssj.probdist.PiecewiseLinearEmpiricalDist.PiecewiseLinearEmpiricalDist | ( | double[] | obs | ) |
Constructs a new piecewise-linear distribution using all the observations stored in obs.
These observations are copied into an internal array and then sorted.
Definition at line 71 of file PiecewiseLinearEmpiricalDist.java.
| umontreal.ssj.probdist.PiecewiseLinearEmpiricalDist.PiecewiseLinearEmpiricalDist | ( | 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. The file is read until its end. One must be careful about lines starting with a blank. This format is the same as in UNURAN.
Definition at line 88 of file PiecewiseLinearEmpiricalDist.java.
| double umontreal.ssj.probdist.PiecewiseLinearEmpiricalDist.barF | ( | double | x | ) |
Returns the complementary distribution function.
The default implementation computes \(\bar{F}(x) = 1 - F(x)\).
| x | value at which the complementary distribution function is evaluated |
Reimplemented from umontreal.ssj.probdist.ContinuousDistribution.
Definition at line 142 of file PiecewiseLinearEmpiricalDist.java.
| double umontreal.ssj.probdist.PiecewiseLinearEmpiricalDist.cdf | ( | double | x | ) |
Returns the distribution function \(F(x)\).
| x | value at which the distribution function is evaluated |
Implements umontreal.ssj.probdist.Distribution.
Definition at line 129 of file PiecewiseLinearEmpiricalDist.java.
| double umontreal.ssj.probdist.PiecewiseLinearEmpiricalDist.density | ( | double | x | ) |
Returns \(f(x)\), the density evaluated at \(x\).
| x | value at which the density is evaluated |
Reimplemented from umontreal.ssj.probdist.ContinuousDistribution.
Definition at line 118 of file PiecewiseLinearEmpiricalDist.java.
| double umontreal.ssj.probdist.PiecewiseLinearEmpiricalDist.getMean | ( | ) |
Returns the mean.
Reimplemented from umontreal.ssj.probdist.ContinuousDistribution.
Definition at line 170 of file PiecewiseLinearEmpiricalDist.java.
| int umontreal.ssj.probdist.PiecewiseLinearEmpiricalDist.getN | ( | ) |
Returns \(n\), the number of observations.
Definition at line 208 of file PiecewiseLinearEmpiricalDist.java.
| double umontreal.ssj.probdist.PiecewiseLinearEmpiricalDist.getObs | ( | int | i | ) |
Returns the value of \(X_{(i)}\).
Definition at line 215 of file PiecewiseLinearEmpiricalDist.java.
| double[] umontreal.ssj.probdist.PiecewiseLinearEmpiricalDist.getParams | ( | ) |
Return a table containing parameters of the current distribution.
Implements umontreal.ssj.probdist.Distribution.
Definition at line 243 of file PiecewiseLinearEmpiricalDist.java.
| double umontreal.ssj.probdist.PiecewiseLinearEmpiricalDist.getSampleMean | ( | ) |
Returns the sample mean of the observations.
Definition at line 222 of file PiecewiseLinearEmpiricalDist.java.
| double umontreal.ssj.probdist.PiecewiseLinearEmpiricalDist.getSampleStandardDeviation | ( | ) |
Returns the sample standard deviation of the observations.
Definition at line 236 of file PiecewiseLinearEmpiricalDist.java.
| double umontreal.ssj.probdist.PiecewiseLinearEmpiricalDist.getSampleVariance | ( | ) |
Returns the sample variance of the observations.
Definition at line 229 of file PiecewiseLinearEmpiricalDist.java.
| double umontreal.ssj.probdist.PiecewiseLinearEmpiricalDist.getStandardDeviation | ( | ) |
Returns the standard deviation.
Reimplemented from umontreal.ssj.probdist.ContinuousDistribution.
Definition at line 178 of file PiecewiseLinearEmpiricalDist.java.
| double umontreal.ssj.probdist.PiecewiseLinearEmpiricalDist.getVariance | ( | ) |
Returns the variance.
Reimplemented from umontreal.ssj.probdist.ContinuousDistribution.
Definition at line 174 of file PiecewiseLinearEmpiricalDist.java.
| double umontreal.ssj.probdist.PiecewiseLinearEmpiricalDist.inverseF | ( | double | u | ) |
Returns the inverse distribution function \(x = F^{-1}(u)\).
Restrictions: \(u \in[0,1]\).
| u | value at which the inverse distribution function is evaluated |
| IllegalArgumentException | if \(u\) is not in the interval \([0,1]\) |
Reimplemented from umontreal.ssj.probdist.ContinuousDistribution.
Definition at line 155 of file PiecewiseLinearEmpiricalDist.java.
| String umontreal.ssj.probdist.PiecewiseLinearEmpiricalDist.toString | ( | ) |
Returns a String containing information about the current distribution.
Definition at line 252 of file PiecewiseLinearEmpiricalDist.java.