Overview | Package | Class | Tree | Deprecated | Index | Help
| SSJ V. 2.1.1.
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## umontreal.iro.lecuyer.probdist
Class TruncatedDist

    java.lang.Object
      umontreal.iro.lecuyer.probdist.ContinuousDistribution
          umontreal.iro.lecuyer.probdist.TruncatedDist

All Implemented Interfaces:
  Distribution

    public class TruncatedDist

extends ContinuousDistribution

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 and F, the new ones are f* and F*, defined by

f*(x) = f (x)/(F(b) - F(a)) for a <= x <= b

and f*(x) = 0 and zero elsewhere, and

F*(x) = F(x)/(F(b) - F(a)) for a <= x <= b.

The inverse distribution function of the truncated distribution is

F-1*(u) = F-1(F(a) + (F(b) - F(a))u)

where F-1 is the inverse distribution function of the original distribution.

Field Summary
`static int` | `NUMINTERVALS`

Fields inherited from class umontreal.iro.lecuyer.probdist.ContinuousDistribution
`decPrec`

Constructor Summary
`TruncatedDist(ContinuousDistribution dist, double a, double b)` Constructs a new distribution by truncating distribution `dist` to the interval [a, b].

Method Summary
`double` | `barF(double x)` Returns the complementary distribution function.
`double` | `cdf(double x)` Returns the distribution function F(x).
`double` | `density(double x)` Returns an approximation of the mean obtained using the Simpson 1/3 numerical integration, or throws an `UnsupportedOperationException` if a or b are infinite.
`double` | `getA()` Returns the value of a.
`double` | `getArea()` Returns the value of F(b) - F(a), the area under the truncated density function.
`double` | `getB()` Returns the value of b.
`double` | `getFa()` Returns the value of F(a).
`double` | `getFb()` Returns the value of F(b).
`double` | `getMean()` Returns the mean.
`double[]` | `getParams()` Return a table containing the parameters of the current distribution.
`double` | `getStandardDeviation()` Returns the standard deviation.
`double` | `getVariance()` Returns an approximation of the variance obtained using the Simpson 1/3 numerical integration, or throws an `UnsupportedOperationException` if a or b are infinite.
`double` | `inverseF(double u)` Computes and returns the inverse distribution function x = F-1(u), by calling the method `inverseBrent`.
`void` | `setParams(ContinuousDistribution dist, double a, double b)` Sets the parameters dist, a and b for this object.
`String` | `toString()` Returns a `String` containing information about the current distribution.

Methods inherited from class umontreal.iro.lecuyer.probdist.ContinuousDistribution
`inverseBisection, inverseBrent`

Methods inherited from class java.lang.Object
`equals, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Field Detail

### NUMINTERVALS

    public static int NUMINTERVALS

Constructor Detail

### TruncatedDist

    public TruncatedDist(ContinuousDistribution dist,
                         double a,
                         double b)

  Constructs a new distribution by truncating distribution `dist` to the interval [a, b]. If `a = Double.NEGATIVE_INFINITY`, F(a) is assumed to be 0. If `b = Double.POSITIVE_INFINITY`, F(b) is assumed to be 1.

Method Detail

### density

    public double density(double x)

  Returns an approximation of the mean obtained using the Simpson 1/3 numerical integration, or throws an `UnsupportedOperationException` if a or b are infinite.

  Specified by:
    `density` in class `ContinuousDistribution`
  Parameters:
    `x` - value at which the density is evaluated
  Returns:
    density function evaluated at `x`
  Throws:
    `UnsupportedOperationException` - the mean of the truncated distribution is unknown

### cdf

    public double cdf(double x)

  Description copied from interface: `Distribution`
  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 class: `ContinuousDistribution`
  Returns the complementary distribution function. The default implementation computes bar(F)(x) = 1 - F(x), which is not accurate when F(x) -> 1.

  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 class: `ContinuousDistribution`
  Computes and returns the inverse distribution function x = F-1(u), by calling the method `inverseBrent`. Restrictions: u∈[0, 1].

  Specified by:
    `inverseF` in interface `Distribution`
  Overrides:
    `inverseF` in class `ContinuousDistribution`
  Parameters:
    `u` - value at which the inverse distribution function is evaluated
  Returns:
    the inverse distribution function evaluated at `u`

### getMean

    public double getMean()

  Description copied from class: `ContinuousDistribution`
  Returns the mean.

  Specified by:
    `getMean` in interface `Distribution`
  Overrides:
    `getMean` in class `ContinuousDistribution`
  Returns:
    the mean

### getVariance

    public double getVariance()

  Returns an approximation of the variance obtained using the Simpson 1/3 numerical integration, or throws an `UnsupportedOperationException` if a or b are infinite.

  Specified by:
    `getVariance` in interface `Distribution`
  Overrides:
    `getVariance` in class `ContinuousDistribution`
  Returns:
    the variance
  Throws:
    `UnsupportedOperationException` - the mean of the truncated distribution is unknown

### getStandardDeviation

    public double getStandardDeviation()

  Description copied from class: `ContinuousDistribution`
  Returns the standard deviation.

  Specified by:
    `getStandardDeviation` in interface `Distribution`
  Overrides:
    `getStandardDeviation` in class `ContinuousDistribution`
  Returns:
    the standard deviation

### getA

    public double getA()

  Returns the value of a.

### getB

    public double getB()

  Returns the value of b.

### getFa

    public double getFa()

  Returns the value of F(a).

### getFb

    public double getFb()

  Returns the value of F(b).

### getArea

    public double getArea()

  Returns the value of F(b) - F(a), the area under the truncated density function.

### setParams

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

  Sets the parameters dist, a and b for this object. See the constructor for details.

### getParams

    public double[] getParams()

  Return a table containing the parameters of the current distribution. This table is put in order: [a, b, F(a), F(b), F(b) - F(a)].

### toString

    public String toString()

  Returns a `String` containing information about the current distribution.

  Overrides:
    `toString` in class `Object`

Overview | Package | Class | Tree | Deprecated | Index | Help
| SSJ V. 2.1.1.
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

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