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

Extends the class ContinuousDistribution for the Laplace distribution (see, e.g., [96]  (page 165)). More...

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

Public Member Functions

 LaplaceDist ()
 Constructs a LaplaceDist object with default parameters \(\mu= 0\) and \(\beta= 1\).
 LaplaceDist (double mu, double beta)
 Constructs a LaplaceDist object with parameters \(\mu\) = mu and \(\beta\) = beta.
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 getMu ()
 Returns the parameter \(\mu\).
double getBeta ()
 Returns the parameter \(\beta\).
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 mu, double beta, double x)
 Computes the Laplace density function.
static double cdf (double mu, double beta, double x)
 Computes the Laplace distribution function.
static double barF (double mu, double beta, double x)
 Computes the Laplace complementary distribution function.
static double inverseF (double mu, double beta, double u)
 Computes the inverse Laplace distribution function.
static double[] getMLE (double[] x, int n)
 Estimates the parameters \((\mu, \beta)\) of the Laplace distribution using the maximum likelihood method, from the \(n\) observations \(x[i]\), \(i = 0, 1,…, n-1\).
static LaplaceDist getInstanceFromMLE (double[] x, int n)
 Creates a new instance of a Laplace distribution with parameters.
static double getMean (double mu, double beta)
 Computes and returns the mean \(E[X] = \mu\) of the Laplace distribution with parameters \(\mu\) and \(\beta\).
static double getVariance (double mu, double beta)
 Computes and returns the variance \(\mbox{Var}[X] = 2 \beta^2\) of the Laplace distribution with parameters \(\mu\) and.
static double getStandardDeviation (double mu, double beta)
 Computes and returns the standard deviation of the Laplace distribution with parameters \(\mu\) and \(\beta\).

Detailed Description

Extends the class ContinuousDistribution for the Laplace distribution (see, e.g., [96]  (page 165)).

It has location parameter \(\mu\) and scale parameter \(\beta> 0\). The density function is given by

\[ f(x) = \frac{e^{-|x - \mu|/\beta}}{2\beta} \qquad\mbox{ for }-\infty< x < \infty. \tag{flaplace} \]

The distribution function is

\[ F (x) = \left\{\begin{array}{ll} \frac{1}{2} e^{(x - \mu)/\beta} & \mbox{ if } x\le\mu, \\ 1 - \frac{1}{2} e^{(\mu- x)/\beta} & \mbox{ otherwise, } \end{array}\right. \]

and its inverse is

\[ F^{-1} (u) = \left\{\begin{array}{ll} \beta\log(2u) + \mu & \mbox{ if } 0\le u\le\frac{1}{2}, \\ \mu- \beta\log(2(1-u)) & \mbox{ otherwise. } \end{array}\right. \]

Definition at line 47 of file LaplaceDist.java.

Constructor & Destructor Documentation

◆ LaplaceDist() [1/2]

umontreal.ssj.probdist.LaplaceDist.LaplaceDist ( )

Constructs a LaplaceDist object with default parameters \(\mu= 0\) and \(\beta= 1\).

Definition at line 55 of file LaplaceDist.java.

◆ LaplaceDist() [2/2]

umontreal.ssj.probdist.LaplaceDist.LaplaceDist ( double mu,
double beta )

Constructs a LaplaceDist object with parameters \(\mu\) = mu and \(\beta\) = beta.

Definition at line 64 of file LaplaceDist.java.

Member Function Documentation

◆ barF() [1/2]

double umontreal.ssj.probdist.LaplaceDist.barF ( double mu,
double beta,
double x )
static

Computes the Laplace complementary distribution function.

Definition at line 122 of file LaplaceDist.java.

◆ barF() [2/2]

double umontreal.ssj.probdist.LaplaceDist.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 80 of file LaplaceDist.java.

◆ cdf() [1/2]

double umontreal.ssj.probdist.LaplaceDist.cdf ( double mu,
double beta,
double x )
static

Computes the Laplace distribution function.

Definition at line 112 of file LaplaceDist.java.

◆ cdf() [2/2]

double umontreal.ssj.probdist.LaplaceDist.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 76 of file LaplaceDist.java.

◆ density() [1/2]

double umontreal.ssj.probdist.LaplaceDist.density ( double mu,
double beta,
double x )
static

Computes the Laplace density function.

Definition at line 103 of file LaplaceDist.java.

◆ density() [2/2]

double umontreal.ssj.probdist.LaplaceDist.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 72 of file LaplaceDist.java.

◆ getBeta()

double umontreal.ssj.probdist.LaplaceDist.getBeta ( )

Returns the parameter \(\beta\).

Definition at line 246 of file LaplaceDist.java.

◆ getInstanceFromMLE()

LaplaceDist umontreal.ssj.probdist.LaplaceDist.getInstanceFromMLE ( double[] x,
int n )
static

Creates a new instance of a Laplace distribution with parameters.

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

Parameters
xthe list of observations to use to evaluate parameters
nthe number of observations to use to evaluate parameters

Definition at line 191 of file LaplaceDist.java.

◆ getMean() [1/2]

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

Returns the mean.

Returns
the mean

Reimplemented from umontreal.ssj.probdist.ContinuousDistribution.

Definition at line 88 of file LaplaceDist.java.

◆ getMean() [2/2]

double umontreal.ssj.probdist.LaplaceDist.getMean ( double mu,
double beta )
static

Computes and returns the mean \(E[X] = \mu\) of the Laplace distribution with parameters \(\mu\) and \(\beta\).

Returns
the mean of the Laplace distribution \(E[X] = \mu\)

Definition at line 202 of file LaplaceDist.java.

◆ getMLE()

double[] umontreal.ssj.probdist.LaplaceDist.getMLE ( double[] x,
int n )
static

Estimates the parameters \((\mu, \beta)\) of the Laplace distribution using the maximum likelihood method, from the \(n\) observations \(x[i]\), \(i = 0, 1,…, n-1\).

The estimates are returned in a two-element array, in regular order: [ \(\mu\), \(\beta\)]. The maximum likelihood estimators are the values

\((\hat{\mu}, \hat{\beta})\) that satisfy the equations:

\begin{align*} \hat{\mu} & = \mbox{the median of } \{x_1,…,x_n\} \\ \hat{\beta} & = \frac{1}{n} \sum_{i=1}^n |x_i - \hat{\mu}|. \end{align*}

See [96]  (page 172).

Parameters
xthe list of observations used to evaluate parameters
nthe number of observations used to evaluate parameters
Returns
returns the parameters [ \(\hat{\mu}\), \(\hat{\beta}\)]

Definition at line 166 of file LaplaceDist.java.

◆ getMu()

double umontreal.ssj.probdist.LaplaceDist.getMu ( )

Returns the parameter \(\mu\).

Definition at line 239 of file LaplaceDist.java.

◆ getParams()

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

Return a table containing the parameters of the current distribution.

This table is put in regular order: [ \(\mu\), \(\beta\)].

Implements umontreal.ssj.probdist.Distribution.

Definition at line 254 of file LaplaceDist.java.

◆ getStandardDeviation() [1/2]

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

Returns the standard deviation.

Returns
the standard deviation

Reimplemented from umontreal.ssj.probdist.ContinuousDistribution.

Definition at line 96 of file LaplaceDist.java.

◆ getStandardDeviation() [2/2]

double umontreal.ssj.probdist.LaplaceDist.getStandardDeviation ( double mu,
double beta )
static

Computes and returns the standard deviation of the Laplace distribution with parameters \(\mu\) and \(\beta\).

Returns
the standard deviation of the Laplace distribution

Definition at line 229 of file LaplaceDist.java.

◆ getVariance() [1/2]

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

Returns the variance.

Returns
the variance

Reimplemented from umontreal.ssj.probdist.ContinuousDistribution.

Definition at line 92 of file LaplaceDist.java.

◆ getVariance() [2/2]

double umontreal.ssj.probdist.LaplaceDist.getVariance ( double mu,
double beta )
static

Computes and returns the variance \(\mbox{Var}[X] = 2 \beta^2\) of the Laplace distribution with parameters \(\mu\) and.

\(\beta\).

Returns
the variance of the Laplace distribution \(\mbox{Var}[X] = 2 \beta^2\)

Definition at line 216 of file LaplaceDist.java.

◆ inverseF() [1/2]

double umontreal.ssj.probdist.LaplaceDist.inverseF ( double mu,
double beta,
double u )
static

Computes the inverse Laplace distribution function.

Definition at line 137 of file LaplaceDist.java.

◆ inverseF() [2/2]

double umontreal.ssj.probdist.LaplaceDist.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 84 of file LaplaceDist.java.

◆ toString()

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

Returns a String containing information about the current distribution.

Definition at line 262 of file LaplaceDist.java.


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