# Chocolates, bugs, and socks

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
How many chocolates has she probably eaten? $$\frac{20}{20}+\frac{20}{19}+\cdots+\frac{20}{2} \approx 20\times(\ln(20) + \frac 12 - 1) \approx 50$$ She should expect to eat another 20 chocolates before getting that last bug.
What's the 90% confidence interval around that? For a rough answer, we need to know the variance in the number of trials needed before a success for a probability $p$ event. If that's $v(p)$, then the variance for our number is $v(\frac{20}{20})+v(\frac{20}{19})+\cdots+v(\frac{20}{2})$. You can compute $v(p)$ because we know the distribution for number of trials before success is an exponential. Do that. Also, what about getting the exact 90% CI?
I've just pulled 20 socks out of a pile of clean laundry one at a time. If I've made 7 pairs and have 6 singletons, how many socks do I expect are in the pile (assuming each sock has a unique partner)? I can compute the likelihood function. If there are $n$ pairs of socks, I pull out $k$, and make $p$ pairs, the likelihood is $$\binom np \binom{n-p}{k-2p} \binom{2n}{k}^{-1}$$ (first pick the $p$ pairs, then $k-2p$ singletons)