SSJ  3.3.1
Stochastic Simulation in Java
Public Member Functions | List of all members
PiecewiseLinearEmpiricalDist Class Reference

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., [118]  (page 318)). More...

Inheritance diagram for PiecewiseLinearEmpiricalDist:
[legend]
Collaboration diagram for PiecewiseLinearEmpiricalDist:
[legend]

Public Member Functions

 PiecewiseLinearEmpiricalDist (double[] obs)
 Constructs a new piecewise-linear distribution using all the observations stored in obs. More...
 
 PiecewiseLinearEmpiricalDist (Reader in) throws IOException
 Constructs a new empirical distribution using the observations read from the reader in. More...
 
double density (double x)
 
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 getVariance ()
 Returns the variance of the distribution function.
 
double getStandardDeviation ()
 Returns the standard deviation of the distribution function.
 
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 ContinuousDistribution
abstract double density (double x)
 Returns \(f(x)\), the density evaluated at \(x\). More...
 
double barF (double x)
 Returns the complementary distribution function. More...
 
double inverseBrent (double a, double b, double u, double tol)
 Computes the inverse distribution function \(x = F^{-1}(u)\), using the Brent-Dekker method. More...
 
double inverseBisection (double u)
 Computes and returns the inverse distribution function \(x = F^{-1}(u)\), using bisection. More...
 
double inverseF (double u)
 Returns the inverse distribution function \(x = F^{-1}(u)\). More...
 
double getMean ()
 Returns the mean. More...
 
double getVariance ()
 Returns the variance. More...
 
double getStandardDeviation ()
 Returns the standard deviation. More...
 
double getXinf ()
 Returns \(x_a\) such that the probability density is 0 everywhere outside the interval \([x_a, x_b]\). More...
 
double getXsup ()
 Returns \(x_b\) such that the probability density is 0 everywhere outside the interval \([x_a, x_b]\). More...
 
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]\). More...
 
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]\). More...
 

Additional Inherited Members

- Public Attributes inherited from ContinuousDistribution
int decPrec = 15
 
- Protected Attributes inherited from ContinuousDistribution
double supportA = Double.NEGATIVE_INFINITY
 
double supportB = Double.POSITIVE_INFINITY
 
- Static Protected Attributes inherited from ContinuousDistribution
static final double XBIG = 100.0
 
static final double XBIGM = 1000.0
 
static final double [] EPSARRAY
 

Detailed Description

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., [118]  (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\).

Constructor & Destructor Documentation

◆ PiecewiseLinearEmpiricalDist() [1/2]

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.

◆ PiecewiseLinearEmpiricalDist() [2/2]

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.

Member Function Documentation

◆ barF()

double barF ( double  x)

Returns \(\bar{F}(x) = 1 - F(x)\).

Parameters
xvalue at which the complementary distribution function is evaluated
Returns
complementary distribution function evaluated at x

Implements Distribution.

◆ cdf()

double cdf ( double  x)

Returns the distribution function \(F(x)\).

Parameters
xvalue at which the distribution function is evaluated
Returns
distribution function evaluated at x

Implements Distribution.

◆ inverseF()

double inverseF ( double  u)

Returns the inverse distribution function \(F^{-1}(u)\), defined in ( inverseF ).

Parameters
uvalue in the interval \((0,1)\) for which the inverse distribution function is evaluated
Returns
the inverse distribution function evaluated at u

Implements Distribution.


The documentation for this class was generated from the following file: