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

Extends the class ContinuousDistribution for the half-normal distribution with parameters \(\mu\) and \(\sigma> 0\). More...

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

Public Member Functions

 HalfNormalDist (double mu, double sigma)
 Constructs a HalfNormalDist object with parameters \(\mu=\) mu and \(\sigma=\) sigma.
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\) of this object.
double getSigma ()
 Returns the parameter \(\sigma\) of this object.
void setParams (double mu, double sigma)
 Sets the parameters \(\mu\) and \(\sigma\).
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 sigma, double x)
 Computes the density function of the half-normal distribution.
static double cdf (double mu, double sigma, double x)
 Computes the distribution function.
static double barF (double mu, double sigma, double x)
 Computes the complementary distribution function.
static double inverseF (double mu, double sigma, double u)
 Computes the inverse of the distribution function.
static double[] getMLE (double[] x, int n)
 Estimates the parameters \(\mu\) and \(\sigma\) of the half-normal distribution using the maximum likelihood method from the \(n\) observations \(x[i]\), \(i = 0, 1, …, n-1\).
static double[] getMLE (double[] x, int n, double mu)
 Estimates the parameter \(\sigma\) of the half-normal distribution using the maximum likelihood method from the \(n\) observations \(x[i]\), \(i = 0, 1, …, n-1\) and the parameter.
static double getMean (double mu, double sigma)
 Computes and returns the mean \( E[X] = \mu+ \sigma\sqrt{2 / \pi}. \).
static double getVariance (double mu, double sigma)
 Computes and returns the variance \( \mbox{Var}[X] = \left(1-2/\pi\right)\sigma^2. \).
static double getStandardDeviation (double mu, double sigma)
 Computes the standard deviation of the half-normal distribution with parameters \(\mu\) and \(\sigma\).

Detailed Description

Extends the class ContinuousDistribution for the half-normal distribution with parameters \(\mu\) and \(\sigma> 0\).

Its density is

\begin{align} f(x) & = \frac{1}{\sigma}\sqrt{\frac{2}{\pi}}\; e^{-(x-\mu)^2/2\sigma^2}, \qquad\mbox{for } x \ge\mu. \\ \tag{fHalfNormal} f(x) & = 0, \qquad\mbox{for } x < \mu. \nonumber \end{align}

Definition at line 43 of file HalfNormalDist.java.

Constructor & Destructor Documentation

◆ HalfNormalDist()

umontreal.ssj.probdist.HalfNormalDist.HalfNormalDist ( double mu,
double sigma )

Constructs a HalfNormalDist object with parameters \(\mu=\) mu and \(\sigma=\) sigma.

Definition at line 52 of file HalfNormalDist.java.

Member Function Documentation

◆ barF() [1/2]

double umontreal.ssj.probdist.HalfNormalDist.barF ( double mu,
double sigma,
double x )
static

Computes the complementary distribution function.

Parameters
muthe parameter mu
sigmathe parameter sigma
xthe value at which the complementary distribution is evaluated
Returns
returns the complementary distribution function

Definition at line 129 of file HalfNormalDist.java.

◆ barF() [2/2]

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

◆ cdf() [1/2]

double umontreal.ssj.probdist.HalfNormalDist.cdf ( double mu,
double sigma,
double x )
static

Computes the distribution function.

Parameters
muthe parameter mu
sigmathe parameter sigma
xthe value at which the distribution is evaluated
Returns
returns the cdf function

Definition at line 112 of file HalfNormalDist.java.

◆ cdf() [2/2]

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

◆ density() [1/2]

double umontreal.ssj.probdist.HalfNormalDist.density ( double mu,
double sigma,
double x )
static

Computes the density function of the half-normal distribution.

Parameters
muthe parameter mu
sigmathe parameter sigma
xthe value at which the density is evaluated
Returns
returns the density function

Definition at line 95 of file HalfNormalDist.java.

◆ density() [2/2]

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

◆ getMean() [1/2]

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

Returns the mean.

Returns
the mean

Reimplemented from umontreal.ssj.probdist.ContinuousDistribution.

Definition at line 75 of file HalfNormalDist.java.

◆ getMean() [2/2]

double umontreal.ssj.probdist.HalfNormalDist.getMean ( double mu,
double sigma )
static

Computes and returns the mean \( E[X] = \mu+ \sigma\sqrt{2 / \pi}. \).

Parameters
muthe parameter mu
sigmathe parameter sigma
Returns
returns the mean

Definition at line 229 of file HalfNormalDist.java.

◆ getMLE() [1/2]

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

Estimates the parameters \(\mu\) and \(\sigma\) of the half-normal 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: [ \(\mu\), \(\sigma\)]. The maximum likelihood estimators are the values

\(\hat{\mu}\) and \(\hat{\sigma}\) that satisfy the equation

\begin{align*} \hat{\mu}= \min_j \{x_j\}, \\ \hat{\sigma}= \sqrt{\frac{1}{n}\Sigma_j(x_j-\hat{\mu})^2}. \end{align*}

Parameters
xthe list of observations to use to evaluate parameters
nthe number of observations to use to evaluate parameters
Returns
returns the parameters [ \(\mu\), \(\sigma\)]

Definition at line 175 of file HalfNormalDist.java.

◆ getMLE() [2/2]

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

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

\(\mu\) = mu. The estimate is returned in a one-element array: [ \(\sigma\)]. The maximum likelihood estimator is the value \(\hat{\sigma}\) that satisfies the equation

\begin{align*} \hat{\sigma}= \sqrt{\frac{1}{n}\Sigma_j(x_j-\mu)^2}. \end{align*}

Parameters
xthe list of observations to use to evaluate parameters
nthe number of observations to use to evaluate parameter
muthe parameter mu
Returns
returns the parameter [ \(\sigma\)]

Definition at line 209 of file HalfNormalDist.java.

◆ getMu()

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

Returns the parameter \(\mu\) of this object.

Returns
returns the parameter mu

Definition at line 266 of file HalfNormalDist.java.

◆ getParams()

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

Return a table containing the parameters of the current distribution.

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

Returns
returns the parameters [ \(\mu\), \(\sigma\)]

Implements umontreal.ssj.probdist.Distribution.

Definition at line 299 of file HalfNormalDist.java.

◆ getSigma()

double umontreal.ssj.probdist.HalfNormalDist.getSigma ( )

Returns the parameter \(\sigma\) of this object.

Returns
returns the parameter sigma

Definition at line 275 of file HalfNormalDist.java.

◆ getStandardDeviation() [1/2]

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

Returns the standard deviation.

Returns
the standard deviation

Reimplemented from umontreal.ssj.probdist.ContinuousDistribution.

Definition at line 83 of file HalfNormalDist.java.

◆ getStandardDeviation() [2/2]

double umontreal.ssj.probdist.HalfNormalDist.getStandardDeviation ( double mu,
double sigma )
static

Computes the standard deviation of the half-normal distribution with parameters \(\mu\) and \(\sigma\).

Parameters
muthe parameter mu
sigmathe parameter sigma
Returns
returns the standard deviation

Definition at line 257 of file HalfNormalDist.java.

◆ getVariance() [1/2]

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

Returns the variance.

Returns
the variance

Reimplemented from umontreal.ssj.probdist.ContinuousDistribution.

Definition at line 79 of file HalfNormalDist.java.

◆ getVariance() [2/2]

double umontreal.ssj.probdist.HalfNormalDist.getVariance ( double mu,
double sigma )
static

Computes and returns the variance \( \mbox{Var}[X] = \left(1-2/\pi\right)\sigma^2. \).

Parameters
muthe parameter mu
sigmathe parameter sigma
Returns
returns the variance

Definition at line 243 of file HalfNormalDist.java.

◆ inverseF() [1/2]

double umontreal.ssj.probdist.HalfNormalDist.inverseF ( double mu,
double sigma,
double u )
static

Computes the inverse of the distribution function.

Parameters
muthe parameter mu
sigmathe parameter sigma
uthe value at which the inverse distribution is evaluated
Returns
returns the inverse distribution function

Definition at line 146 of file HalfNormalDist.java.

◆ inverseF() [2/2]

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

◆ setParams()

void umontreal.ssj.probdist.HalfNormalDist.setParams ( double mu,
double sigma )

Sets the parameters \(\mu\) and \(\sigma\).

Parameters
muthe parameter mu
sigmathe parameter sigma

Definition at line 285 of file HalfNormalDist.java.

◆ toString()

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

Returns a String containing information about the current distribution.

Returns
returns a String containing information about the current distribution.

Definition at line 310 of file HalfNormalDist.java.


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