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

Extends the class ContinuousDistribution for the triangular distribution (see [100]  (page 297) and [118]  (page 317)) with domain \([a,b]\) and mode (or shape parameter) \(m\), where \(a\le m\le b\). More...

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

Public Member Functions

 TriangularDist ()
 Constructs a TriangularDist object with default parameters \(a=0\), \(b=1\), and \(m=0.5\).
 
 TriangularDist (double m)
 Constructs a TriangularDist object with parameters \(a = 0\) , \(b = 1\) and \(m\) = m.
 
 TriangularDist (double a, double b, double m)
 Constructs a TriangularDist object with parameters \(a\), \(b\) and \(m\).
 
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.
 
double getA ()
 Returns the value of \(a\) for this object.
 
double getB ()
 Returns the value of \(b\) for this object.
 
double getM ()
 Returns the value of \(m\) for this object.
 
void setParams (double a, double b, double m)
 Sets the value of the parameters \(a\), \(b\) and \(m\) for this object.
 
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 Member Functions

static double density (double a, double b, double m, double x)
 Computes the density function.
 
static double cdf (double a, double b, double m, double x)
 Computes the distribution function.
 
static double barF (double a, double b, double m, double x)
 Computes the complementary distribution function.
 
static double inverseF (double a, double b, double m, double u)
 Computes the inverse distribution function.
 
static double [] getMLE (double[] x, int n, double a, double b)
 Estimates the parameter \(m\) of the triangular distribution using the maximum likelihood method, from the \(n\) observations \(x[i]\), \(i = 0, 1,…, n-1\). More...
 
static TriangularDist getInstanceFromMLE (double[] x, int n, double a, double b)
 Creates a new instance of a triangular distribution with parameters a and b. More...
 
static double getMean (double a, double b, double m)
 Computes and returns the mean \(E[X] = (a + b + m)/3\) of the triangular distribution with parameters \(a\), \(b\), \(m\). More...
 
static double getVariance (double a, double b, double m)
 Computes and returns the variance \(\mbox{Var}[X] = (a^2 + b^2 + m^2 - ab - am - bm)/18\) of the triangular distribution with parameters \(a\), \(b\), \(m\). More...
 
static double getStandardDeviation (double a, double b, double m)
 Computes and returns the standard deviation of the triangular distribution with parameters \(a\), \(b\), \(m\). 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 the triangular distribution (see [100]  (page 297) and [118]  (page 317)) with domain \([a,b]\) and mode (or shape parameter) \(m\), where \(a\le m\le b\).

The density function is

\[ f(x) = \left\{\begin{array}{ll} \frac{2(x-a)}{(b-a)(m-a)} & \mbox{ if } a\le x\le m, \\ \frac{2(b-x)}{(b-a)(b-m)} & \mbox{ if } m\le x\le b, \\ 0 & \mbox{ elsewhere, } \end{array}\right. \tag{ftrian} \]

the distribution function is

\[ F (x) = \left\{\begin{array}{ll} 0 & \mbox{ for } x < a, \\ \frac{(x - a)^2}{(b - a)(m - a)} & \mbox{ if } a\le x\le m, \\ 1 - \frac{(b - x)^2}{(b - a)(b - m)} & \mbox{ if } m\le x\le b, \\ 1 & \mbox{ for } x > b, \end{array}\right. \]

and the inverse distribution function is given by

\[ F^{-1}(u) = \left\{\begin{array}{ll} a + \sqrt{(b - a)(m - a)u} & \mbox{ if } 0\le u\le\frac{m-a}{b-a}, \\ b - \sqrt{(b - a)(b - m)(1 - u)} & \mbox{ if } \frac{m-a}{b-a}\le u \le1. \end{array}\right. \]

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.

◆ getInstanceFromMLE()

static TriangularDist getInstanceFromMLE ( double []  x,
int  n,
double  a,
double  b 
)
static

Creates a new instance of a triangular distribution with parameters a and b.

\(m\) is estimated using the maximum likelihood method based on the \(n\) observations \(x[i]\), \(i = 0, 1, …, n-1\).

Parameters
xthe list of observations used to evaluate parameters
nthe number of observations used to evaluate parameters
alower limit of range
bupper limit of range

◆ getMean()

static double getMean ( double  a,
double  b,
double  m 
)
static

Computes and returns the mean \(E[X] = (a + b + m)/3\) of the triangular distribution with parameters \(a\), \(b\), \(m\).

Returns
the mean of the triangular distribution

◆ getMLE()

static double [] getMLE ( double []  x,
int  n,
double  a,
double  b 
)
static

Estimates the parameter \(m\) of the triangular distribution using the maximum likelihood method, from the \(n\) observations \(x[i]\), \(i = 0, 1,…, n-1\).

The estimated parameter is returned in a one-element array: [ \(\hat{m}\)]. See [189], [92], [114] .

Parameters
xthe list of observations used to evaluate parameters
nthe number of observations used to evaluate parameters
alower limit of range
bupper limit of range
Returns
returns the parameter [ \(m\)]

◆ getParams()

double [] getParams ( )

Return a table containing the parameters of the current distribution.

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

Implements Distribution.

◆ getStandardDeviation()

static double getStandardDeviation ( double  a,
double  b,
double  m 
)
static

Computes and returns the standard deviation of the triangular distribution with parameters \(a\), \(b\), \(m\).

Returns
the standard deviation of the triangular distribution

◆ getVariance()

static double getVariance ( double  a,
double  b,
double  m 
)
static

Computes and returns the variance \(\mbox{Var}[X] = (a^2 + b^2 + m^2 - ab - am - bm)/18\) of the triangular distribution with parameters \(a\), \(b\), \(m\).

Returns
the variance of the triangular 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: