I'm trying to use scipy in order to calculate a probability, given a binomial distribution:
The probability: in an exam with 45 questions, each one with 5 items, what is the probability of randomly choose right (instead of wrong) more than half the exam, that is, 22.5?
I've tried:
from scipy.stats import binom
n = 45
p = 0.20
mu = n * p
p_x = binom.pmf(1,n,p)
How do I calculate this with scipy?
Assuming there's exactly one correct choice for each question, the random variable
Xwhich counts the number of correctly answered questions by choosing randomly is indeed binomial distributed with parametersn=45andp=0.2. Hence, you want to calculateP(X >= 23) = P(X = 23 ) + ... + P(X = 45 ) = 1 - P(X <= 22), so there are two ways to compute it: