Choose random inputsLesson 08 of 76 · 7 min
Count successes in a fixed group
Recognise when a binomial model fits a fixed set of independent opportunities.
A binomial count is the number of successes among a fixed number of independent opportunities, each with the same success probability. Its support is the integers from zero to the opportunity count.
The expected count is n times p. Variance is the model's average squared distance from that mean; standard deviation (SD) is its square root, back in count units. For this binomial model the variance is n times p times (1-p). Probability mass means the probability assigned to one possible integer count.
The example assumes thirty independent components each passing with probability 0.95. Compare sample summaries with the known model mean and variance. A sample variance estimates model variance from finitely many draws and uses ddof=1 to account for estimating their mean. Arbitrary time arrivals or group-linked outcomes need a different model.
X is the success count, n is the fixed opportunity count and p is the common success chance. The symbol ~ reads ‘is drawn from’ the named distribution.
Can this model ever generate more successes than the number of opportunities?
Write a prediction (optional)
Seeded teaching simulation
Select Run Python below with the code unchanged.
A saved draft is open. To run the published example, open Tools and select Restore example. Recover draft brings your code back.
Execution error
Technical error details
Your result
Published example output
This result comes from the original Python. Your runs appear above. Build environment ↗
Observed range: 23 30 Sample / model means: 28.507 28.5 Sample / model variances: 1.425 1.4250000000000012 Estimated P(all pass): 0.218
Read the first result
The two values in each Sample / model row are a simulation summary and its model reference. Compare the means and variances separately. Check that Observed range stays inside the 0 to 30 count range.
Try an edit
Replace n, p = 30, .95 with n, p = 30, .5. Select Run Python again. Compare Sample / model means and Sample / model variances. Which direction does each move when the pass chance drops to 0.5?
Scope. The model does not represent shared defects or varying pass probabilities without additional structure.
Try a fresh case
Which setting directly violates this binomial model?
Need a hint?
Hint 1
Inspect what independent attempts means.
Hint 2
Ask whether one event changes many outcomes together.