Bernoulli Distribution

DOWNLOAD Mathematica Notebook BernoulliDistribution

The Bernoulli distribution is a discrete distribution having two possible outcomes labelled by n=0 and n=1 in which n=1 ("success") occurs with probability p and n=0 ("failure") occurs with probability q=1-p, where 0<p<1. It therefore has probability density function

 P(n)={1-p   for n=0; p   for n=1,
(1)

which can also be written

 P(n)=p^n(1-p)^(1-n).
(2)

The corresponding distribution function is

 D(n)={1-p   for n=0; 1   for n=1.
(3)

The Bernoulli distribution is implemented in the Wolfram Language as BernoulliDistribution[p].

The performance of a fixed number of trials with fixed probability of success on each trial is known as a Bernoulli trial.

The distribution of heads and tails in coin tossing is an example of a Bernoulli distribution with p=q=1/2. The Bernoulli distribution is the simplest discrete distribution, and it the building block for other more complicated discrete distributions. The distributions of a number of variate types defined based on sequences of independent Bernoulli trials that are curtailed in some way are summarized in the following table (Evans et al. 2000, p. 32).

distributiondefinition
binomial distributionnumber of successes in n trials
geometric distributionnumber of failures before the first success
negative binomial distributionnumber of failures before the xth success

The characteristic function is

 phi(t)=1+p(e^(it)-1),
(4)

and the moment-generating function is

M(t)=<e^(tn)>
(5)
=sum_(n=0)^(1)e^(tn)p^n(1-p)^(1-n)
(6)
=e^0(1-p)+e^tp,
(7)

so

M(t)=(1-p)+pe^t
(8)
M^'(t)=pe^t
(9)
M^('')(t)=pe^t
(10)
M^((n))(t)=pe^t.
(11)

These give raw moments

mu_1^'=p
(12)
mu_2^'=p
(13)
mu_n^'=p.
(14)

and central moments

mu_2=p(1-p)
(15)
mu_3=p(1-p)(1-2p)
(16)
mu_4=p(1-p)(3p^2-3p+1).
(17)

The mean, variance, skewness, and kurtosis are then

mu=p
(18)
sigma^2=p(1-p)
(19)
gamma_1=(1-2p)/(sqrt(p(1-p)))
(20)
gamma_2=(6p^2-6p+1)/(p(1-p)).
(21)

To find an estimator p^^ for the mean of a Bernoulli population with population mean p, let N be the sample size and suppose n successes are obtained from the N trials. Assume an estimator given by

 p^^=n/N,
(22)

so that the probability of obtaining the observed n successes in N trials is then

 (N; n)p^n(1-p)^(N-n).
(23)

The expectation value of the estimator p^^ is therefore given by

<p^^>=sum_(n=0)^(N)p(N; n)p^n(1-p)^(N-n)
(24)
=(1-p)^N(1/(1-p))^Np
(25)
=p,
(26)

so p^^ is indeed an unbiased estimator for the population mean p.

The mean deviation is given by

 MD=2p(1-p).
(27)

Wolfram Web Resources

Mathematica »

The #1 tool for creating Demonstrations and anything technical.

Wolfram|Alpha »

Explore anything with the first computational knowledge engine.

Wolfram Demonstrations Project »

Explore thousands of free applications across science, mathematics, engineering, technology, business, art, finance, social sciences, and more.

Computerbasedmath.org »

Join the initiative for modernizing math education.

Online Integral Calculator »

Solve integrals with Wolfram|Alpha.

Step-by-step Solutions »

Walk through homework problems step-by-step from beginning to end. Hints help you try the next step on your own.

Wolfram Problem Generator »

Unlimited random practice problems and answers with built-in Step-by-step solutions. Practice online or make a printable study sheet.

Wolfram Education Portal »

Collection of teaching and learning tools built by Wolfram education experts: dynamic textbook, lesson plans, widgets, interactive Demonstrations, and more.

Wolfram Language »

Knowledge-based programming for everyone.