How to be sure about the distribution of a discrete and limited stochastic variable? I've got a stochastic variable $X$ which takes the values in $\{0,1,2\}$ with some unknown probabilities. I want to know the distribution, and can sample $X$ as many times as I want to. How many times will I need to sample to get some specific confidence interval?
(For instance, 99% sure that the estimated probabilities lie within 0.01 of the true probabilities.)
 A: If you have a Bernoulli variable (0 or 1) with probability $p$, its variance is $p(1-p)$ which is always less than or equal to $1/4$. The mean of $n$ independent Bernoulli variables tends to a Gaussian of variance $p(1-p)/n$ which is always less than or equal to $1/4n$. You can use the fact that a Gaussian variable has a 99% chance of being within plus or minus 2.58 standard deviations, so you have to set your upper bound so that $2.58/(2\sqrt{n}) < .01$ which gives you $n \geq 16641$.
Because each of your three outcomes individually behaves as a Bernoulli variable and because this is a global upper bound you can also apply this number to your discrete variable with three outcomes.
A: The Bayesian way of doing this loses no information:
Your variable $X$ is categorically distributed with probability vector $\mathbf p$.  The conjugate prior of the categorical distribution is the Dirichlet distribution, so let $\mathbf p$ be Dirichlet-distributed with shape parameter vector $\boldsymbol\phi$.  With every observation, you update $\boldsymbol\phi$ by incrementing the realized component.  You can then check to see if your maximum likelihood probability $\mathbf p^\star$ is within 0.01 of the true probability by integrating the ball with radius 0.01 centered at $\mathbf p^\star$.
