Extends the class DiscreteDistributionInt for the Bernoulli distribution [114] with parameter \(p\), where. More...
Public Member Functions | |
| BernoulliDist (double p) | |
| Creates a Bernoulli distribution object. | |
| double | prob (int x) |
| Returns \(p(x)\), the probability of \(x\). | |
| double | cdf (int x) |
Returns the distribution function \(F\) evaluated at \(x\) (see ( FDistDisc )). | |
| double | barF (int x) |
| Returns \(\bar{F}(x)\), the complementary distribution function. | |
| int | inverseFInt (double u) |
| Returns the inverse distribution function \(F^{-1}(u)\), where. | |
| 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 umontreal.ssj.probdist.DiscreteDistributionInt | |
| double | cdf (double x) |
Returns the distribution function \(F\) evaluated at \(x\) (see ( FDistDisc )). | |
| double | barF (double x) |
| Returns \(\bar{F}(x)\), the complementary distribution function. | |
| int | getXinf () |
| Returns the lower limit \(x_a\) of the support of the probability mass function. | |
| int | getXsup () |
| Returns the upper limit \(x_b\) of the support of the probability mass function. | |
| double | inverseF (double u) |
| Returns the inverse distribution function \(F^{-1}(u)\), where. | |
Static Public Member Functions | |
| static double | prob (double p, int x) |
| Returns the Bernoulli probability \(f(x)\) with parameter \(p\) (see eq. | |
| static double | cdf (double p, int x) |
| Returns the Bernoulli distribution function \(F(x)\) with parameter \(p\) (see eq. | |
| static double | barF (double p, int x) |
| Returns the complementary Bernoulli distribution function. | |
| 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. | |
| static BernoulliDist | getInstanceFromMLE (int[] x, int m) |
| Creates a new instance of a Bernoulli distribution with parameter. | |
| static double | getMean (double p) |
| Returns the mean \(E[X] = p\) of the Bernoulli distribution with parameter \(p\). | |
| static double | getVariance (double p) |
| Computes the variance \(\mbox{Var}[X] = p(1 - p)\) of the Bernoulli distribution with parameter \(p\). | |
| static double | getStandardDeviation (double p) |
| Computes the standard deviation of the Bernoulli distribution with parameter \(p\). | |
Additional Inherited Members | |
| Static Public Attributes inherited from umontreal.ssj.probdist.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. | |
Extends the class DiscreteDistributionInt for the Bernoulli distribution [114] 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} \]
\[ 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} \]
Definition at line 43 of file BernoulliDist.java.
| umontreal.ssj.probdist.BernoulliDist.BernoulliDist | ( | double | p | ) |
Creates a Bernoulli distribution object.
Definition at line 50 of file BernoulliDist.java.
|
static |
Returns the complementary Bernoulli distribution function.
\(\bar{F}(x) = P[X \ge x]\) with parameter \(p\).
Definition at line 137 of file BernoulliDist.java.
| double umontreal.ssj.probdist.BernoulliDist.barF | ( | int | x | ) |
Returns \(\bar{F}(x)\), the complementary distribution function.
See the WARNING above. The default implementation returns 1.0 - cdf(x - 1), which is not accurate when \(F(x)\) is near 1.
| x | value at which the complementary distribution function must be evaluated |
Reimplemented from umontreal.ssj.probdist.DiscreteDistributionInt.
Definition at line 75 of file BernoulliDist.java.
|
static |
Returns the Bernoulli distribution function \(F(x)\) with parameter \(p\) (see eq.
( cdf-bernoulli )).
Definition at line 122 of file BernoulliDist.java.
| double umontreal.ssj.probdist.BernoulliDist.cdf | ( | int | x | ) |
Returns the distribution function \(F\) evaluated at \(x\) (see ( FDistDisc )).
| x | value at which the distribution function must be evaluated |
Reimplemented from umontreal.ssj.probdist.DiscreteDistributionInt.
Definition at line 67 of file BernoulliDist.java.
|
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\).
| x | the list of observations to use to estimate the parameters |
| m | the number of observations to use to estimate the parameters |
Definition at line 194 of file BernoulliDist.java.
| double umontreal.ssj.probdist.BernoulliDist.getMean | ( | ) |
Returns the mean of the distribution function.
Implements umontreal.ssj.probdist.Distribution.
Definition at line 91 of file BernoulliDist.java.
|
static |
Returns the mean \(E[X] = p\) of the Bernoulli distribution with parameter \(p\).
Definition at line 206 of file BernoulliDist.java.
|
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\)].
| x | the list of observations used to evaluate parameters |
| m | the number of observations used to evaluate parameters |
Definition at line 171 of file BernoulliDist.java.
| double umontreal.ssj.probdist.BernoulliDist.getP | ( | ) |
Returns the parameter \(p\) of this object.
Definition at line 238 of file BernoulliDist.java.
| double[] umontreal.ssj.probdist.BernoulliDist.getParams | ( | ) |
Returns an array that contains the parameter \(p\) of the current distribution: [ \(p\)].
Implements umontreal.ssj.probdist.Distribution.
Definition at line 246 of file BernoulliDist.java.
| double umontreal.ssj.probdist.BernoulliDist.getStandardDeviation | ( | ) |
Returns the standard deviation of the distribution function.
Implements umontreal.ssj.probdist.Distribution.
Definition at line 99 of file BernoulliDist.java.
|
static |
Computes the standard deviation of the Bernoulli distribution with parameter \(p\).
Definition at line 231 of file BernoulliDist.java.
| double umontreal.ssj.probdist.BernoulliDist.getVariance | ( | ) |
Returns the variance of the distribution function.
Implements umontreal.ssj.probdist.Distribution.
Definition at line 95 of file BernoulliDist.java.
|
static |
Computes the variance \(\mbox{Var}[X] = p(1 - p)\) of the Bernoulli distribution with parameter \(p\).
Definition at line 219 of file BernoulliDist.java.
|
static |
Returns the inverse of the Bernoulli distribution function with parameter \(p\) at \(u\).
Definition at line 151 of file BernoulliDist.java.
| int umontreal.ssj.probdist.BernoulliDist.inverseFInt | ( | double | u | ) |
Returns the inverse distribution function \(F^{-1}(u)\), where.
\(0\le u\le1\). The default implementation uses binary search.
| u | value in the interval \((0,1)\) for which the inverse distribution function is evaluated |
| IllegalArgumentException | if \(u\) is not in the interval \((0,1)\) |
| ArithmeticException | if the inverse cannot be computed, for example if it would give infinity in a theoritical context |
Reimplemented from umontreal.ssj.probdist.DiscreteDistributionInt.
Definition at line 83 of file BernoulliDist.java.
|
static |
Returns the Bernoulli probability \(f(x)\) with parameter \(p\) (see eq.
( fmass-bernoulli )).
Definition at line 107 of file BernoulliDist.java.
| double umontreal.ssj.probdist.BernoulliDist.prob | ( | int | x | ) |
Returns \(p(x)\), the probability of \(x\).
| x | value at which the mass function must be evaluated |
Reimplemented from umontreal.ssj.probdist.DiscreteDistributionInt.
Definition at line 59 of file BernoulliDist.java.
| void umontreal.ssj.probdist.BernoulliDist.setParams | ( | double | p | ) |
Resets the parameter to this new value.
Definition at line 254 of file BernoulliDist.java.
| String umontreal.ssj.probdist.BernoulliDist.toString | ( | ) |
Returns a String containing information about the current distribution.
Definition at line 262 of file BernoulliDist.java.