SSJ  3.3.1
Stochastic Simulation in Java
Classes | Public Member Functions | Static Public Attributes | List of all members
TruncatedDist Class Reference

This container class takes an arbitrary continuous distribution and truncates it to an interval \([a,b]\), where \(a\) and \(b\) can be finite or infinite. More...

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

Public Member Functions

 TruncatedDist (ContinuousDistribution dist, double a, double b)
 Constructs a new distribution by truncating distribution dist to the interval \([a,b]\). 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 an approximation of the mean computed with the Simpson \(1/3\) numerical integration rule. More...
 
double getVariance ()
 Returns an approximation of the variance computed with the Simpson \(1/3\) numerical integration rule. More...
 
double getStandardDeviation ()
 Returns the square root of the approximate variance. More...
 
double getA ()
 Returns the value of \(a\).
 
double getB ()
 Returns the value of \(b\).
 
double getFa ()
 Returns the value of \(F_0(a)\).
 
double getFb ()
 Returns the value of \(F_0(b)\).
 
double getArea ()
 Returns the value of \(F_0(b) - F_0(a)\), the area under the truncated density function.
 
void setParams (ContinuousDistribution dist, double a, double b)
 Sets the parameters dist, \(a\) and \(b\) for this object. More...
 
double [] getParams ()
 Return a table containing the parameters of the current distribution. More...
 
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...
 

Static Public Attributes

static int NUMINTERVALS = 500
 

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

This container class takes an arbitrary continuous distribution and truncates it to an interval \([a,b]\), where \(a\) and \(b\) can be finite or infinite.

If the original density and distribution function are \(f_0\) and \(F_0\), the new ones are \(f\) and \(F\), defined by

\[ f(x) = \frac{f_0(x)}{F_0(b) - F_0(a)} \qquad\mbox{ for } a\le x\le b \]

and \(f(x)=0\) elsewhere, and

\[ F(x) = \frac{F_0(x)-F_0(a)}{F_0(b)-F_0(a)} \qquad\mbox{ for } a\le x\le b. \]

The inverse distribution function of the truncated distribution is

\[ {F^{-1}}(u) = F_0^{-1}(F_0(a) + (F_0(b) - F_0(a))u) \]

where \(F_0^{-1}\) is the inverse distribution function of the original distribution.

Constructor & Destructor Documentation

◆ TruncatedDist()

TruncatedDist ( ContinuousDistribution  dist,
double  a,
double  b 
)

Constructs a new distribution by truncating distribution dist to the interval \([a,b]\).

Restrictions: \(a\) and \(b\) must be finite.

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.

◆ getMean()

double getMean ( )

Returns an approximation of the mean computed with the Simpson \(1/3\) numerical integration rule.

Exceptions
UnsupportedOperationExceptionthe mean of the truncated distribution is unknown

Implements Distribution.

◆ getParams()

double [] getParams ( )

Return a table containing the parameters of the current distribution.

This table is put in order: [ \(a\), \(b\), \(F_0(a)\), \(F_0(b)\), \(F_0(b) - F_0(a)\)].

Implements Distribution.

◆ getStandardDeviation()

double getStandardDeviation ( )

Returns the square root of the approximate variance.

Exceptions
UnsupportedOperationExceptionthe mean of the truncated distribution is unknown

Implements Distribution.

◆ getVariance()

double getVariance ( )

Returns an approximation of the variance computed with the Simpson \(1/3\) numerical integration rule.

Exceptions
UnsupportedOperationExceptionthe mean of the truncated distribution is unknown

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.

◆ setParams()

void setParams ( ContinuousDistribution  dist,
double  a,
double  b 
)

Sets the parameters dist, \(a\) and \(b\) for this object.

See the constructor for details.


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