Bernoulli distribution

Revision as of 00:04, 8 December 2018 by Lchrisman (talk | contribs) (Merged 4 functions onto the one page)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)



Release:

4.6  •  5.0  •  5.1  •  5.2  •  5.3  •  5.4  •  6.0  •  6.1  •  6.2  •  6.3  •  6.4  •  6.5


A Bernoulli distribution is perhaps the most basic of all probability distributions. It simply describes a coin flip. There are two possible outcomes, 0 and 1 (equivalently, False and True). The distribution is described by a single parameter, «p», which describes the probability of the outcome True (1).

Bernoulli(0.75)Bernoulli(0.75).png

Functions

Bernoulli(p, over)

Creates a discrete probability distribution with probability «P» of 1 (True) and probability (1 - P) of 0 (False). «P» is a probability value or array of probabilities, between 0 and 1. The result is the equivalent to:

If Uniform(0, 1) < p Then 1 Else 0

Or even just:

Uniform(0, 1) < p

If «P» is greater than 1, the distribution is made up of all 1’s. If «P» is less than 0, the distribution is made up of all 0’s.

To generate an array of Bernoulli values that are independent over index I, use the optional «over» parameter:

Bernoulli(p, over: I)

You can extend this to an Array with multiple dimensions, as:

Bernoulli(p, over: I, J, K)

ProbBernoulli(k, p)

The analytic probability function for the Bernoulli distribution, which returns the probability that the outcome is k. This is equal to

[math]\displaystyle{ p(k) = \left\{ \begin{array}{c l} 1-p & \mbox{if } k=0 \\ p & \mbox{if } k=1 \end{array}\right. }[/math]

CumBernoulli(k, p)

The analytic cumulative probability function for the Bernoulli distribution. This returns the probability that the outcome is less than or equal to k, which is simply equal to

[math]\displaystyle{ F(k) = \left\{ \begin{array}{c l} 0 & \mbox{if } k\lt 0 \\ 1-p & \mbox{if } 0 \le k \lt 1 \\ 1 & \mbox{if } k\ge 1 \end{array}\right. }[/math]

CumBernoulliInv(q, p)

The analytic inverse cumulative distribution function for the Bernoulli distribution. Returns the smallest Bernoulli(p) outcome, k, such that the probability of a random variate being less than or equal to k is at least «q».

Both «q» and «p» should be between 0 and 1.

Examples

CumBernoulliInv(0.5, 0.8) → 1

There is a 0,2 probability of an outcome of 0, which is not "at least" u = 0.5. The probability that the outcome is less than or equal to 1 is 1.0, and 0.0 is at least u = 0.5, so the result here is the outcome 1.

History

The analytic functions were first introduced into the Distribution Densities Library in Analytica 5.0. They were later moved into Analytica as built-in functions in Analytica 5.2.

See Also

Comments


You are not allowed to post comments.