SSJ  3.3.1
Stochastic Simulation in Java
Classes | Public Member Functions | Static Public Member Functions | Protected Attributes | Static Package Functions | Package Attributes | List of all members
BetaDist Class Reference

Extends the class ContinuousDistribution for the beta distribution [100]  (page 210) with shape parameters \(\alpha> 0\) and \(\beta> 0\), over the interval \([a,b]\), where \(a < b\). More...

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

Public Member Functions

 BetaDist (double alpha, double beta)
 Constructs a BetaDist object with parameters \(\alpha=\) alpha, \(\beta=\) beta and default domain \([0,1]\).
 
 BetaDist (double alpha, double beta, double a, double b)
 Constructs a BetaDist object with parameters \(\alpha=\) alpha, \(\beta=\) beta and domain \([\)a \(,\) b \(]\).
 
 BetaDist (double alpha, double beta, int d)
 
 BetaDist (double alpha, double beta, double a, double b, int d)
 
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 getAlpha ()
 Returns the parameter \(\alpha\) of this object.
 
double getBeta ()
 Returns the parameter \(\beta\) of this object.
 
double getA ()
 Returns the parameter \(a\) of this object.
 
double getB ()
 Returns the parameter \(b\) of this object.
 
void setParams (double alpha, double beta, double a, double b, int d)
 
void setParams (double alpha, double beta, double a, double b)
 Sets the parameters of the current distribution. More...
 
double [] getParams ()
 Return an array containing the parameters of the current distribution as [ \(\alpha\), \(\beta\), \(a\), \(b\)].
 
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 alpha, double beta, double x)
 Same as density(alpha, beta, 0, 1, x).
 
static double density (double alpha, double beta, double a, double b, double x)
 Computes the density function of the beta distribution.
 
static double cdf (double alpha, double beta, int d, double x)
 
static double cdf (double alpha, double beta, double a, double b, int d, double x)
 
static double barF (double alpha, double beta, int d, double x)
 
static double barF (double alpha, double beta, double a, double b, int d, double x)
 
static double cdf (double alpha, double beta, double x)
 Same as cdf(alpha, beta, 0, 1, x).
 
static double cdf (double alpha, double beta, double a, double b, double x)
 Computes the distribution function. More...
 
static double barF (double alpha, double beta, double x)
 Same as barF(alpha, beta, 0, 1, x).
 
static double barF (double alpha, double beta, double a, double b, double x)
 Computes the complementary distribution function.
 
static double inverseF (double alpha, double beta, int d, double u)
 
static double inverseF (double alpha, double beta, double u)
 Same as inverseF(alpha, beta, 0, 1, u).
 
static double inverseF (double alpha, double beta, double a, double b, int d, double u)
 
static double inverseF (double alpha, double beta, double a, double b, double u)
 Returns the inverse beta distribution function using the algorithm implemented in [183] . More...
 
static double [] getMLE (double[] x, int n)
 Estimates the parameters \((\alpha,\beta)\) of the beta distribution over the interval \([0,1]\) using the maximum likelihood method, from the \(n\) observations \(x[i]\), \(i = 0, 1,…, n-1\). More...
 
static BetaDist getInstanceFromMLE (double[] x, int n)
 Creates a new instance of a beta distribution with parameters \(\alpha\) and \(\beta\) over the interval \([0,1]\) estimated using the maximum likelihood method based on the \(n\) observations \(x[i]\), \(i = 0, 1, …, n-1\). More...
 
static double getMean (double alpha, double beta)
 Computes and returns the mean \(E[X] = \alpha/ (\alpha+ \beta)\) of the beta distribution with parameters \(\alpha\) and \(\beta\), over the interval \([0, 1]\). More...
 
static double getMean (double alpha, double beta, double a, double b)
 Computes and returns the mean \(E[X] = (b\alpha+ a\beta)/ (\alpha+ \beta)\) of the beta distribution with parameters \(\alpha\) and \(\beta\) over the interval \([a, b]\). More...
 
static double getVariance (double alpha, double beta)
 Computes and returns the variance \(\mbox{Var}[X] = \frac{\alpha\beta}{(\alpha+ \beta)^2 (\alpha+ \beta+ 1)}\) of the beta distribution with parameters \(\alpha\) and \(\beta\), over the interval \([0, 1]\). More...
 
static double getVariance (double alpha, double beta, double a, double b)
 Computes and returns the variance \(\mbox{Var}[X] = \frac{\alpha\beta(b-a)^2}{(\alpha+ \beta)^2 (\alpha+ \beta+ 1)}\) of the beta distribution with parameters \(\alpha\) and \(\beta\), over the interval \([a, b]\). More...
 
static double getStandardDeviation (double alpha, double beta)
 Computes the standard deviation of the beta distribution with parameters \(\alpha\) and \(\beta\), over the interval \([0, 1]\). More...
 
static double getStandardDeviation (double alpha, double beta, double a, double b)
 Computes the standard deviation of the beta distribution with parameters \(\alpha\) and \(\beta\), over the interval \([a, b]\). More...
 

Protected Attributes

double alpha
 
double beta
 
double a
 
double bminusa
 
double logFactor
 
double Beta
 
double logBeta
 
- Protected Attributes inherited from ContinuousDistribution
double supportA = Double.NEGATIVE_INFINITY
 
double supportB = Double.POSITIVE_INFINITY
 

Static Package Functions

static double beta_g (double x)
 

Package Attributes

double b
 

Additional Inherited Members

- Public Attributes inherited from ContinuousDistribution
int decPrec = 15
 
- 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 beta distribution [100]  (page 210) with shape parameters \(\alpha> 0\) and \(\beta> 0\), over the interval \([a,b]\), where \(a < b\).

This distribution has density

\[ f(x) = \frac{ (x-a)^{\alpha- 1}(b - x)^{\beta- 1}}{\mathcal{B} (\alpha, \beta)(b - a)^{\alpha+ \beta- 1}}, \qquad\mbox{for } a\le x\le b, \mbox{ and }0\mbox{ elsewhere}, \]

and distribution function

\[ F(x) = I_{\alpha,\beta}(x) = \int_a^x \frac{(\xi- a)^{\alpha-1} (b - \xi)^{\beta-1}}{\mathcal{B} (\alpha, \beta)(b - a)^{\alpha+ \beta- 1}} d\xi, \qquad\mbox{for } a\le x\le b, \tag{Fbeta} \]

where \(\mathcal{B}(\alpha,\beta)\) is the beta function defined by

\[ \mathcal{B} (\alpha,\beta) = \frac{\Gamma(\alpha) \Gamma(\beta)}{ \Gamma(\alpha+\beta)},\tag{betadef} \]

and \(\Gamma(x)\) is the gamma function defined in ( Gamma ).

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() [1/2]

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.

◆ cdf() [2/2]

static double cdf ( double  alpha,
double  beta,
double  a,
double  b,
double  x 
)
static

Computes the distribution function.

If \(\max(\alpha, \beta) \le10^4\), uses a continuous fraction in \(\alpha\) and \(\beta\) given in [52], [39] . Otherwise, if \(\min(\alpha, \beta) \le30\), uses an approximation due to Bol’shev [172] , else uses a normal approximation [201] .

◆ getInstanceFromMLE()

static BetaDist getInstanceFromMLE ( double []  x,
int  n 
)
static

Creates a new instance of a beta distribution with parameters \(\alpha\) and \(\beta\) over the interval \([0,1]\) 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

◆ getMean() [1/2]

static double getMean ( double  alpha,
double  beta 
)
static

Computes and returns the mean \(E[X] = \alpha/ (\alpha+ \beta)\) of the beta distribution with parameters \(\alpha\) and \(\beta\), over the interval \([0, 1]\).

Returns
the mean of the Beta distribution

◆ getMean() [2/2]

static double getMean ( double  alpha,
double  beta,
double  a,
double  b 
)
static

Computes and returns the mean \(E[X] = (b\alpha+ a\beta)/ (\alpha+ \beta)\) of the beta distribution with parameters \(\alpha\) and \(\beta\) over the interval \([a, b]\).

Returns
the mean of the Beta distribution

◆ getMLE()

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

Estimates the parameters \((\alpha,\beta)\) of the beta distribution over the interval \([0,1]\) 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: [ \(\alpha\), \(\beta\)]. The maximum likelihood estimators are the values \((\hat{\alpha}, \hat{\beta})\) that satisfy the equations:

\begin{align*} \psi(\alpha) - \psi(\alpha+ \beta) & = \frac{1}{n} \sum_{i=1}^n \ln(x_i) \\ \psi(\beta) - \psi(\alpha+ \beta) & = \frac{1}{n} \sum_{i=1}^n \ln(1 - x_i) \end{align*}

where \(\bar{x}_n\) is the average of \(x[0],…,x[n-1]\), and \(\psi\) is the logarithmic derivative of the Gamma function \(\psi(x) = \Gamma’(x) / \Gamma(x)\).

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

◆ getStandardDeviation() [1/2]

static double getStandardDeviation ( double  alpha,
double  beta 
)
static

Computes the standard deviation of the beta distribution with parameters \(\alpha\) and \(\beta\), over the interval \([0, 1]\).

Returns
the standard deviation of the Beta distribution

◆ getStandardDeviation() [2/2]

static double getStandardDeviation ( double  alpha,
double  beta,
double  a,
double  b 
)
static

Computes the standard deviation of the beta distribution with parameters \(\alpha\) and \(\beta\), over the interval \([a, b]\).

Returns
the standard deviation of the Beta distribution

◆ getVariance() [1/2]

static double getVariance ( double  alpha,
double  beta 
)
static

Computes and returns the variance \(\mbox{Var}[X] = \frac{\alpha\beta}{(\alpha+ \beta)^2 (\alpha+ \beta+ 1)}\) of the beta distribution with parameters \(\alpha\) and \(\beta\), over the interval \([0, 1]\).

Returns
the variance of the beta distribution \(\mbox{Var}[X] = \alpha\beta/ [(\alpha+ \beta)^2 (\alpha+ \beta+ 1)]\).

◆ getVariance() [2/2]

static double getVariance ( double  alpha,
double  beta,
double  a,
double  b 
)
static

Computes and returns the variance \(\mbox{Var}[X] = \frac{\alpha\beta(b-a)^2}{(\alpha+ \beta)^2 (\alpha+ \beta+ 1)}\) of the beta distribution with parameters \(\alpha\) and \(\beta\), over the interval \([a, b]\).

Returns
the variance of the beta distribution \(\mbox{Var}[X] = \alpha\beta/ [(\alpha+ \beta)^2 (\alpha+ \beta+ 1)]\).

◆ inverseF() [1/2]

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.

◆ inverseF() [2/2]

static double inverseF ( double  alpha,
double  beta,
double  a,
double  b,
double  u 
)
static

Returns the inverse beta distribution function using the algorithm implemented in [183] .

The method performs interval halving or Newton iterations to compute the inverse.

◆ setParams()

void setParams ( double  alpha,
double  beta,
double  a,
double  b 
)

Sets the parameters of the current distribution.

See the constructor.


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