SSJ
V. 1.1.9.

umontreal.iro.lecuyer.probdist
Class ContinuousEmpiricalDist

java.lang.Object
  extended by umontreal.iro.lecuyer.probdist.ContinuousDistribution
      extended by umontreal.iro.lecuyer.probdist.ContinuousEmpiricalDist
All Implemented Interfaces:
Distribution

public class ContinuousEmpiricalDist
extends ContinuousDistribution

Extends the ContinuousDistribution for the empirical distribution with known individual observations. Let X1,..., Xn be the empirical observations and X(1),..., X(n), the same observations sorted in increasing order. The empirical distribution has density

f (x) = 1/[(n - 1)(X(I+1) - X(I))] for X(I) <= x < X(I+1) where I = 1, 2,..., n - 1.

It has distribution function

F(x) = 0          for x < X(1),
F(x) = (I - 1)/(n - 1) + (x - X(I))/[(n - 1)(X(I+1) - X(I))]          for X(I) <= x < X(I+1),
F(x) = 1          elsewhere.

Its inverse function is given by

F-1(u) = X(I) + ((n - 1)u - I + 1)(X(I+1) - X(I)) for (I - 1)/(n - 1) <= u <= I/(n - 1),

where I = 1,..., n - 1.


Field Summary
 
Fields inherited from class umontreal.iro.lecuyer.probdist.ContinuousDistribution
decPrec
 
Constructor Summary
ContinuousEmpiricalDist(double[] obs)
          Constructs a new empirical distribution using all the observations stored into obs.
ContinuousEmpiricalDist(InputStreamReader in)
          Constructs a new empirical distribution using the observations read from the input stream reader in.
 
Method Summary
 double barF(double x)
          Returns bar(F)(x) = 1 - F(x).
 double cdf(double x)
          Computes and returns the distribution function F(x).
 double density(double x)
          Returns f (x), the density of X evaluated at x.
 int getN()
          Returns n, the number of observations.
 double getObs(int i)
          Returns the value of X(i), the ith order observation.
 double getSampleMean()
          Returns the sample mean of the observations.
 double getSampleStandardDeviation()
          Returns the sample standard deviation of the observations.
 double getSampleVariance()
          Returns the sample variance of the observations.
 double inverseF(double u)
          Computes and returns the inverse distribution function F-1(u), defined in.
 
Methods inherited from class umontreal.iro.lecuyer.probdist.ContinuousDistribution
inverseBisection, inverseBrent
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ContinuousEmpiricalDist

public ContinuousEmpiricalDist(double[] obs)
Constructs a new empirical distribution using all the observations stored into obs. The given array obs will be modified by this method and should not be modified by the caller afterwards.


ContinuousEmpiricalDist

public ContinuousEmpiricalDist(InputStreamReader in)
                        throws IOException
Constructs a new empirical distribution using the observations read from the input stream reader in. The constructor will read the first double of each line in the stream. The format of the file is the same as in UNURAN. If a line does not start with +, - or a digit, it will be ignored. One must be careful about lines starting with a blank.

Throws:
IOException
Method Detail

density

public double density(double x)
Description copied from class: ContinuousDistribution
Returns f (x), the density of X evaluated at x.

Specified by:
density in class ContinuousDistribution
Parameters:
x - value at which the density is evaluated
Returns:
density function evaluated at x

cdf

public double cdf(double x)
Description copied from interface: Distribution
Computes and returns the distribution function F(x).

Parameters:
x - value at which the distribution function is evaluated
Returns:
distribution function evaluated at x

barF

public double barF(double x)
Description copied from interface: Distribution
Returns bar(F)(x) = 1 - F(x).

Specified by:
barF in interface Distribution
Overrides:
barF in class ContinuousDistribution
Parameters:
x - value at which the complementary distribution function is evaluated
Returns:
complementary distribution function evaluated at x

inverseF

public double inverseF(double u)
Description copied from interface: Distribution
Computes and returns the inverse distribution function F-1(u), defined in.

Specified by:
inverseF in interface Distribution
Overrides:
inverseF in class ContinuousDistribution
Parameters:
u - value in the interval (0, 1) for which the inverse distribution function is evaluated
Returns:
the inverse distribution function evaluated at u

getN

public int getN()
Returns n, the number of observations.


getObs

public double getObs(int i)
Returns the value of X(i), the ith order observation.


getSampleMean

public double getSampleMean()
Returns the sample mean of the observations.


getSampleVariance

public double getSampleVariance()
Returns the sample variance of the observations.


getSampleStandardDeviation

public double getSampleStandardDeviation()
Returns the sample standard deviation of the observations.


SSJ
V. 1.1.9.

To submit a bug or ask questions, send an e-mail to Pierre L'Ecuyer.