SSJ  3.3.1
Stochastic Simulation in Java
Public Member Functions | Static Public Member Functions | List of all members

Extends DiscreteDistribution to an empirical distribution function, based on the observations \(X_{(1)},…,X_{(n)}\) (sorted by increasing order). More...

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

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
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ EmpiricalDist() [1/2]

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() [2/2]

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.

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.

◆ getMedian() [1/2]

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.

◆ getMedian() [2/2]

static double getMedian ( double  obs[],
int  n 
)
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.

Parameters
obsthe array of observations
nthe number of observations
Returns
return the median of the observations

◆ 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: