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
Suppose a certain product must flow into a supply chain from the factory of one country to the market of another passing through some intermediate nodes like storage places, ports, and dry ports1. In its path, there are two points of inspection as illustrated by the next figure.
Consider a product whose path through a supply chain is given in the previous figure. Suppose that each inspection point could select the product for inspection with the same probability equal to 0.50. Then answer the following questions:
• What is the probability of the product being selected just one time for inspection in this path?
• And the probability of not being inspected at any checkpoint?
Each checkpoint could be considered a Bernoulli experiment since it could be successful (product not selected) or not (product selected). Supposing the checkpoints are independent, then the successive Bernoulli experiments could be considered as a sum of two random variables that will result in a Binomial distribution.
To answer the previous question, the Binomial distribution can be used with the following parameters: n = 2, p = 1 − p = q = 0.5, and x = 1.
• Happen exactly one inspection (one in each checkpoint): p(x = 1) = 2(0.5)(0.5) = 0.5
• None inspection in all checkpoints: p(x = 0) = 0.25.
The following code shows the probability of the numerical example employing PMF of Binomial distribution using binom.pmf command.
from scipy.stats import binom
import matplotlib.pyplot as plt
import numpy as np
# computing P(X) for each X.
x = [0, 1, 2]
n = 2
p = 0.5
y = binom.pmf(x, n, p)
print(' X |',x)
print('P(X) |',y)
X | [0, 1, 2]
P(X) | [0.25 0.5 0.25]
The previous complete code is available in the following link:
https://colab.research.google.com/drive/1neEr-fVjxi8B3FmlFvFfB99fpFs9juGs?usp=sharing