Binomial Distribution¶
In [1]:
Copied!
from scipy.stats import binom
from scipy.stats import binom
What is the probability of getting 3 success, out of 100 trials, if the probability of gettings success is 20%:
In [2]:
Copied!
binom.pmf(3, n=100, p=0.2)
binom.pmf(3, n=100, p=0.2)
Out[2]:
np.float64(5.146698708957569e-07)
What is the probability of getting 0,1,2,3 success, out of 100 trials, if the probability of gettings success is 20%:
In [3]:
Copied!
binom.cdf(3, n=100, p=0.2)
binom.cdf(3, n=100, p=0.2)
Out[3]:
np.float64(5.82986964952081e-07)
The below function is only used for getting only 2 success, out of 5 trials, where the success probability is 10%.
In [4]:
Copied!
binom.pmf(2, n=5, p=0.1)
binom.pmf(2, n=5, p=0.1)
Out[4]:
np.float64(0.07289999999999992)
On the other hand, this function is only used for getting 2 or fewer successes, out of 5 trials, where the success probability is 10%.
In [5]:
Copied!
binom.cdf(2, n=5, p=0.1)
binom.cdf(2, n=5, p=0.1)
Out[5]:
np.float64(0.99144)