SSJ API Documentation
Stochastic Simulation in Java
Loading...
Searching...
No Matches
umontreal.ssj.probdist.TriangularDist Class Reference

Extends the class ContinuousDistribution for the triangular distribution (see [96]  (page 297) and. More...

Inheritance diagram for umontreal.ssj.probdist.TriangularDist:
umontreal.ssj.probdist.ContinuousDistribution umontreal.ssj.probdist.Distribution

Public Member Functions

 TriangularDist ()
 Constructs a TriangularDist object with default parameters.
 TriangularDist (double m)
 Constructs a TriangularDist object with parameters \(a = 0\) ,.
 TriangularDist (double a, double b, double m)
 Constructs a TriangularDist object with parameters \(a\),.
double density (double x)
 Returns \(f(x)\), the density evaluated at \(x\).
double cdf (double x)
 Returns the distribution function \(F(x)\).
double barF (double x)
 Returns the complementary distribution function.
double inverseF (double u)
 Returns the inverse distribution function \(x = F^{-1}(u)\).
double getMean ()
 Returns the mean.
double getVariance ()
 Returns the variance.
double getStandardDeviation ()
 Returns the standard deviation.
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.
String toString ()
 Returns a String containing information about the current distribution.
Public Member Functions inherited from umontreal.ssj.probdist.ContinuousDistribution
double inverseBrent (double a, double b, double u, double tol)
 Computes the inverse distribution function \(x = F^{-1}(u)\), using the Brent-Dekker method.
double inverseBisection (double u)
 Computes and returns the inverse distribution function \(x = F^{-1}(u)\), using bisection.
double getXinf ()
 Returns \(x_a\) such that the probability density is 0 everywhere outside the interval \([x_a, x_b]\).
double getXsup ()
 Returns \(x_b\) such that the probability density is 0 everywhere outside the interval \([x_a, x_b]\).
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]\).
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]\).

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.
static TriangularDist getInstanceFromMLE (double[] x, int n, double a, double b)
 Creates a new instance of a triangular distribution with parameters a and b.
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\).
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\).
static double getStandardDeviation (double a, double b, double m)
 Computes and returns the standard deviation of the triangular distribution with parameters \(a\), \(b\), \(m\).

Detailed Description

Extends the class ContinuousDistribution for the triangular distribution (see [96]  (page 297) and.

[114]  (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. \]

Definition at line 52 of file TriangularDist.java.

Constructor & Destructor Documentation

◆ TriangularDist() [1/3]

umontreal.ssj.probdist.TriangularDist.TriangularDist ( )

Constructs a TriangularDist object with default parameters.

\(a=0\), \(b=1\), and \(m=0.5\).

Definition at line 62 of file TriangularDist.java.

◆ TriangularDist() [2/3]

umontreal.ssj.probdist.TriangularDist.TriangularDist ( double m)

Constructs a TriangularDist object with parameters \(a = 0\) ,.

\(b = 1\) and \(m\) = m.

Definition at line 71 of file TriangularDist.java.

◆ TriangularDist() [3/3]

umontreal.ssj.probdist.TriangularDist.TriangularDist ( double a,
double b,
double m )

Constructs a TriangularDist object with parameters \(a\),.

\(b\) and \(m\).

Definition at line 80 of file TriangularDist.java.

Member Function Documentation

◆ barF() [1/2]

double umontreal.ssj.probdist.TriangularDist.barF ( double a,
double b,
double m,
double x )
static

Computes the complementary distribution function.

Definition at line 145 of file TriangularDist.java.

◆ barF() [2/2]

double umontreal.ssj.probdist.TriangularDist.barF ( double x)

Returns the complementary distribution function.

The default implementation computes \(\bar{F}(x) = 1 - F(x)\).

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

Reimplemented from umontreal.ssj.probdist.ContinuousDistribution.

Definition at line 92 of file TriangularDist.java.

◆ cdf() [1/2]

double umontreal.ssj.probdist.TriangularDist.cdf ( double a,
double b,
double m,
double x )
static

Computes the distribution function.

Definition at line 129 of file TriangularDist.java.

◆ cdf() [2/2]

double umontreal.ssj.probdist.TriangularDist.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 umontreal.ssj.probdist.Distribution.

Definition at line 88 of file TriangularDist.java.

◆ density() [1/2]

double umontreal.ssj.probdist.TriangularDist.density ( double a,
double b,
double m,
double x )
static

Computes the density function.

Definition at line 115 of file TriangularDist.java.

◆ density() [2/2]

double umontreal.ssj.probdist.TriangularDist.density ( double x)

Returns \(f(x)\), the density evaluated at \(x\).

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

Reimplemented from umontreal.ssj.probdist.ContinuousDistribution.

Definition at line 84 of file TriangularDist.java.

◆ getA()

double umontreal.ssj.probdist.TriangularDist.getA ( )

Returns the value of \(a\) for this object.

Definition at line 287 of file TriangularDist.java.

◆ getB()

double umontreal.ssj.probdist.TriangularDist.getB ( )

Returns the value of \(b\) for this object.

Definition at line 294 of file TriangularDist.java.

◆ getInstanceFromMLE()

TriangularDist umontreal.ssj.probdist.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

Definition at line 238 of file TriangularDist.java.

◆ getM()

double umontreal.ssj.probdist.TriangularDist.getM ( )

Returns the value of \(m\) for this object.

Definition at line 301 of file TriangularDist.java.

◆ getMean() [1/2]

double umontreal.ssj.probdist.TriangularDist.getMean ( )

Returns the mean.

Returns
the mean

Reimplemented from umontreal.ssj.probdist.ContinuousDistribution.

Definition at line 100 of file TriangularDist.java.

◆ getMean() [2/2]

double umontreal.ssj.probdist.TriangularDist.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

Definition at line 249 of file TriangularDist.java.

◆ getMLE()

double[] umontreal.ssj.probdist.TriangularDist.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 [183], [88], [110] .

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\)]

Definition at line 189 of file TriangularDist.java.

◆ getParams()

double[] umontreal.ssj.probdist.TriangularDist.getParams ( )

Return a table containing the parameters of the current distribution.

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

Implements umontreal.ssj.probdist.Distribution.

Definition at line 327 of file TriangularDist.java.

◆ getStandardDeviation() [1/2]

double umontreal.ssj.probdist.TriangularDist.getStandardDeviation ( )

Returns the standard deviation.

Returns
the standard deviation

Reimplemented from umontreal.ssj.probdist.ContinuousDistribution.

Definition at line 108 of file TriangularDist.java.

◆ getStandardDeviation() [2/2]

double umontreal.ssj.probdist.TriangularDist.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

Definition at line 280 of file TriangularDist.java.

◆ getVariance() [1/2]

double umontreal.ssj.probdist.TriangularDist.getVariance ( )

Returns the variance.

Returns
the variance

Reimplemented from umontreal.ssj.probdist.ContinuousDistribution.

Definition at line 104 of file TriangularDist.java.

◆ getVariance() [2/2]

double umontreal.ssj.probdist.TriangularDist.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

Definition at line 265 of file TriangularDist.java.

◆ inverseF() [1/2]

double umontreal.ssj.probdist.TriangularDist.inverseF ( double a,
double b,
double m,
double u )
static

Computes the inverse distribution function.

Definition at line 161 of file TriangularDist.java.

◆ inverseF() [2/2]

double umontreal.ssj.probdist.TriangularDist.inverseF ( double u)

Returns the inverse distribution function \(x = F^{-1}(u)\).

Restrictions: \(u \in[0,1]\).

Parameters
uvalue at which the inverse distribution function is evaluated
Returns
the inverse distribution function evaluated at u
Exceptions
IllegalArgumentExceptionif \(u\) is not in the interval \([0,1]\)

Reimplemented from umontreal.ssj.probdist.ContinuousDistribution.

Definition at line 96 of file TriangularDist.java.

◆ setParams()

void umontreal.ssj.probdist.TriangularDist.setParams ( double a,
double b,
double m )

Sets the value of the parameters \(a\), \(b\) and \(m\) for this object.

Definition at line 309 of file TriangularDist.java.

◆ toString()

String umontreal.ssj.probdist.TriangularDist.toString ( )

Returns a String containing information about the current distribution.

Definition at line 335 of file TriangularDist.java.


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