1. Concepts & Definitions
1.1. Example of random variables
1.2. Probability of events to random variables
1.4. Discrete uniform distribution of probability
1.5. Bernoulli distribution of probability
1.6. Binomial distribution of probability
1.7. Hypergeometrical distribution of probability
2. Problem & Solution
It is denoted as X ∼ Bern(p). And is read as X is a discrete random variable that follows Bernoulli distribution with parameter p. Where p is the success probability for each trial. Bernoulli can be represented as a Binomial experiment with a single trial which means: X ∼ Bern(p) → X ∼ Be(1, p).
The Bernoulli distribution PMF formula follows:
In certain customs, it was verified that 5% of the products of a company have documentation problems. A customs inspector randomly selects 1 product. Find the probabilities of the following events:
1. EO is the event that “exactly one of them has a problem”?
The next Figure illustrates the inspection problem described before. The success event (S) corresponds to finding a product with a documentation issue, and the unsuccess event (U) corresponds to not finding it. The column p(x) gives the probability to achieve a certain number of successful events. The sum of joint probabilities and p(x) are equal to 1.
Use the Bernoulli equation to compute the probabilities with p = 0.05 (success probability to find an issue), and q = 0.95 (unsuccess probability of not finding an issue):
P(X = 0) = 0.95
P(X = 1) = 0.05.
The next code shows how the previous probabilities could be computed employing PMF of Bernoulli distribution using bernoulli.pmf command.
from scipy.stats import bernoulli
pu = bernoulli.pmf(0, 0.05)
ps = bernoulli.pmf(1, 0.05)
print('P(X = 0) = P(U) = ', pu)
print('P(X = 1) = P(S) = ', ps)
P(X = 0) = P(U) = 0.95
P(X = 1) = P(S) = 0.05
The previous complete code is available in the following link:
https://colab.research.google.com/drive/1eYRdDGUkOfjKM2BB3cOOlz-VBPCdcG9H?usp=sharing