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

Extends the class DiscreteDistributionInt for the Bernoulli distribution [118]  with parameter \(p\), where \(0\le p\le1\). More...

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

Public Member Functions

 BernoulliDist (double p)
 Creates a Bernoulli distribution object.
 
double prob (int x)
 
double cdf (int x)
 
double barF (int x)
 
int inverseFInt (double u)
 
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 getP ()
 Returns the parameter \(p\) of this object.
 
double [] getParams ()
 Returns an array that contains the parameter \(p\) of the current distribution: [ \(p\)].
 
void setParams (double p)
 Resets the parameter to this new value.
 
String toString ()
 Returns a String containing information about the current distribution.
 
- Public Member Functions inherited from DiscreteDistributionInt
abstract double prob (int x)
 Returns \(p(x)\), the probability of \(x\). More...
 
double cdf (double x)
 Returns the distribution function \(F\) evaluated at \(x\) (see ( FDistDisc )). More...
 
abstract double cdf (int x)
 Returns the distribution function \(F\) evaluated at \(x\) (see ( FDistDisc )). More...
 
double barF (double x)
 Returns \(\bar{F}(x)\), the complementary distribution function. More...
 
double barF (int x)
 Returns \(\bar{F}(x)\), the complementary distribution function. More...
 
int getXinf ()
 Returns the lower limit \(x_a\) of the support of the probability mass function. More...
 
int getXsup ()
 Returns the upper limit \(x_b\) of the support of the probability mass function. More...
 
double inverseF (double u)
 Returns the inverse distribution function \(F^{-1}(u)\), where. More...
 
int inverseFInt (double u)
 Returns the inverse distribution function \(F^{-1}(u)\), where. More...
 

Static Public Member Functions

static double prob (double p, int x)
 Returns the Bernoulli probability \(f(x)\) with parameter \(p\) (see eq. More...
 
static double cdf (double p, int x)
 Returns the Bernoulli distribution function \(F(x)\) with parameter \(p\) (see eq. More...
 
static double barF (double p, int x)
 Returns the complementary Bernoulli distribution function \(\bar{F}(x) = P[X \ge x]\) with parameter \(p\).
 
static int inverseF (double p, double u)
 Returns the inverse of the Bernoulli distribution function with parameter \(p\) at \(u\).
 
static double [] getMLE (int[] x, int m)
 Estimates the parameters \(p\) of the Bernoulli distribution using the maximum likelihood method, from the \(m\) observations \(x[i]\), \(i = 0, 1,…, m-1\). More...
 
static BernoulliDist getInstanceFromMLE (int[] x, int m)
 Creates a new instance of a Bernoulli distribution with parameter \(p\) estimated using the maximum likelihood method, from the \(m\) observations \(x[i]\), \(i = 0, 1, …, m-1\). More...
 
static double getMean (double p)
 Returns the mean \(E[X] = p\) of the Bernoulli distribution with parameter \(p\). More...
 
static double getVariance (double p)
 Computes the variance \(\mbox{Var}[X] = p(1 - p)\) of the Bernoulli distribution with parameter \(p\). More...
 
static double getStandardDeviation (double p)
 Computes the standard deviation of the Bernoulli distribution with parameter \(p\). More...
 

Additional Inherited Members

- Static Public Attributes inherited from DiscreteDistributionInt
static double EPSILON = 1.0e-16
 Environment variable that determines what probability terms can be considered as negligible when building precomputed tables for distribution and mass functions. More...
 
- Protected Attributes inherited from DiscreteDistributionInt
double cdf [] = null
 
double pdf [] = null
 
int xmin = 0
 
int xmax = 0
 
int xmed = 0
 
int supportA = Integer.MIN_VALUE
 
int supportB = Integer.MAX_VALUE
 
- Static Protected Attributes inherited from DiscreteDistributionInt
static final double EPS_EXTRA = 1.0e-6
 

Detailed Description

Extends the class DiscreteDistributionInt for the Bernoulli distribution [118]  with parameter \(p\), where \(0\le p\le1\).

Its mass function is given by

\[ f(x) = \begin{cases} 1 - p, \qquad & \text{if $x = 0$;} \\ p, & \text{if $x = 1$;} \tag{fmass-bernoulli} \\ 0, & \text{otherwise.} \end{cases} \]

Its distribution function is

\[ F(x) = \begin{cases} 0, & \text{if $x < 0$;} \\ 1 - p, \qquad & \text{if $0 \le x < 1$;} \tag{cdf-bernoulli} \\ 1, & \text{if $x \ge1$.} \end{cases} \]

Member Function Documentation

◆ cdf()

static double cdf ( double  p,
int  x 
)
static

Returns the Bernoulli distribution function \(F(x)\) with parameter \(p\) (see eq.

( cdf-bernoulli )).

◆ getInstanceFromMLE()

static BernoulliDist getInstanceFromMLE ( int []  x,
int  m 
)
static

Creates a new instance of a Bernoulli distribution with parameter \(p\) estimated using the maximum likelihood method, from the \(m\) observations \(x[i]\), \(i = 0, 1, …, m-1\).

Parameters
xthe list of observations to use to estimate the parameters
mthe number of observations to use to estimate the parameters

◆ getMean()

static double getMean ( double  p)
static

Returns the mean \(E[X] = p\) of the Bernoulli distribution with parameter \(p\).

Returns
the mean of the Bernoulli distribution \(E[X] = np\)

◆ getMLE()

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

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

The estimate is returned in a one-element array: [ \(p\)].

Parameters
xthe list of observations used to evaluate parameters
mthe number of observations used to evaluate parameters
Returns
returns the parameter [ \(\hat{p}\)]

◆ getStandardDeviation()

static double getStandardDeviation ( double  p)
static

Computes the standard deviation of the Bernoulli distribution with parameter \(p\).

Returns
the standard deviation of the Bernoulli distribution

◆ getVariance()

static double getVariance ( double  p)
static

Computes the variance \(\mbox{Var}[X] = p(1 - p)\) of the Bernoulli distribution with parameter \(p\).

Returns
the variance of the Bernoulli distribution

◆ prob()

static double prob ( double  p,
int  x 
)
static

Returns the Bernoulli probability \(f(x)\) with parameter \(p\) (see eq.

( fmass-bernoulli )).


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