This is documentation for Mathematica 8, which was
based on an earlier version of the Wolfram Language.
View current documentation (Version 11.1)

BernoulliDistribution

BernoulliDistribution[p]
represents a Bernoulli distribution with probability parameter p.
Probability density function:
Cumulative distribution function:
Mean and variance:
Median:
Probability density function:
In[1]:=
Click for copyable input
Out[1]=
In[2]:=
Click for copyable input
Out[2]=
 
Cumulative distribution function:
In[1]:=
Click for copyable input
Out[1]=
In[2]:=
Click for copyable input
Out[2]=
 
Mean and variance:
In[1]:=
Click for copyable input
Out[1]=
In[2]:=
Click for copyable input
Out[2]=
 
Median:
In[1]:=
Click for copyable input
Out[1]=
Generate a set of pseudorandom numbers that are Bernoulli distributed:
Compare the frequency of 1 in the sample with the probability of getting 1:
Distribution parameters estimation:
Estimate the distribution parameters from sample data:
Compare the density histogram of the sample with the PDF of the estimated distribution:
Skewness:
The distribution is symmetric for :
Kurtosis:
Kurtosis attains its minimum:
Different moments with closed forms as functions of parameters:
Closed form for symbolic order:
Hazard function:
Quantile function:
Simulate a sequence of fair coin tosses:
The probability of throwing a 6 on a six-sided die can be modeled as a Bernoulli distribution:
Simulate throwing a die, if you are only interested in sixes:
Out of 10 bulbs produced, one is defective. Simulate production of 100 bulbs:
Find the percentage of good bulbs:
Find the average number of good bulbs per batch of 100:
Find the probability that a randomly selected bulb is good:
A lottery sells 10 tickets for $1 per ticket. Each time there is only one winning ticket. A gambler has $5 to spend. Find his probability of winning if he buys 5 tickets in 5 different lotteries:
His probability of winning is greater if he buys 5 tickets in the same lottery:
Simulate a symmetric random walk with values -1 and 1:
In an optical communication system, transmitted light generates current at the receiver. The number of electrons follows the parametric mixture of Poisson distribution and another distribution, depending on the type of light. If the source uses coherent laser light of intensity , then the electron count distribution is Poisson:
If the source uses thermal illumination, then the Poisson parameter follows ExponentialDistribution with parameter and the electron count distribution is:
These two distributions are distinguishable and allow the type of source to be determined:
The probability of getting anything other than zero and one is zero:
Relationships to other distributions:
BernoulliDistribution is equivalent to BinomialDistribution of one trial:
BinomialDistribution is the sum of independent Bernoulli variables:
BernoulliDistribution is not defined when p is not between zero and one:
Substitution of invalid parameters into symbolic outputs gives results that are not meaningful:
New in 6