Block 2: The binomial distribution
Week 10 · Probability II · Imai §6.3.3 · about 3 min
NoteHow this works
Run each cell with Run Code, look at the output, then answer the question at the end of the block. Every cell is editable; Start Over resets it. Errors are information: read them.
The binomial: X = number of successes in n independent Bernoulli(p) trials.
1. PMF and CDF
Check by hand with the counting rules: dbinom(2, size = 3, prob = 0.5) is the probability of exactly 2 successes in 3 trials.
2. A tied election
n voters, each votes for A with probability 0.5. What is the probability of an exact tie?
Conclusion: Does the probability of an exact tie grow or shrink as n goes from 1,000 to 100,000?
Even though the expected number of votes is n/2, the chance of landing exactly on it falls like 1/sqrt(n). The simulation (about 0.028) agrees with the exact answer (0.025) up to Monte Carlo error.