A binomial experiment counts successes across a fixed number of repeatable trials. Each trial has two outcomes, success or failure, and the success probability remains constant. section 3.1.2
Model an experiment as binomial only when these conditions hold:
- Use independent trials: one outcome neither changes nor is changed by another trial. section 3.1.2
- Classify every trial as success or failure, with probabilities p and 1 − p. section 3.1.2
- Fix the number of trials before the experiment begins. section 3.1.2
- Keep the success probability constant, so the trials remain alike as well as independent. section 3.1.2
For n trials and k successes, the probability mass function combines the number of ways to choose the successes with p^k(1 − p)^(n − k). Compute the combination directly with factorials or use scipy.stats.binom.pmf.
Counting seven successes
With n = 20, k = 7, and p = 0.5, the calculated probability is 7.39288330078125%. Changing p to 0.2 produces 5.454985048652523% for the same n and k.
