Please assist me in the use of cdf (cumulative distribution function) to calculate probability of 2 or less outcomes out of 5 trials; (≤2)=(0)+(1)+(2) p=0.1 , n=5
I tried the following after importing the necessary libraries;
prob1 = stats.binom.cdf(2, 5, 0.1)
prob2 = stats.binom.cdf(1, 5, 0.1)
prob3 = stats.binom.cdf(0, 5, 0.1)
prob1+prob2+prob3
2.5
I figured the above out after plotting;
x = np.arange(0,10,.05)
y = stats.binom.cdf(x, # probability of k = 5 successes or less
10, # with 10 trials
p) # success probability 0.8
plt.xlabel('x')
plt.ylabel('Cumulative density, F(x)')
plt.plot(x,y,'g-')
for n=5 p~=0.99 from the plot
and using ;
stats.binom.cdf(2, 5, 0.1)
p=0.99144