Wikipedia:Reference desk/Archives/Mathematics/2015 September 13

= September 13 =

Probabilities of probabilities
If I have a fair die with an unknown, but definitely finite, number of faces how many times do I need to roll a "1" to have a reasonably confident estimate of the number of faces ? 2A01:E34:EF5E:4640:3163:C76B:37F8:C6CD (talk) 12:45, 13 September 2015 (UTC)
 * That's the German tank problem, you'll find relevant information there. You may want to focus on the Bayesian analysis section, since in general frequentist analysis is less correct. -- Meni Rosenfeld (talk) 13:06, 13 September 2015 (UTC)
 * Assuming an improper uniform prior, after 5 rolls of 1 (with no other results) you'll have >95% confidence that the die has only one face. -- Meni Rosenfeld (talk) 13:09, 13 September 2015 (UTC)
 * That's brilliant, thanks a lot. Although in my case the "number of faces" is going to be closer to ten thousand than one (ps. one of the many great things about about maths is that it's possible to mention a one-faced die without having some pedant pointing out that it's physically impossible :-) ). 2A01:E34:EF5E:4640:3163:C76B:37F8:C6CD (talk) 13:16, 13 September 2015 (UTC)
 * Perhaps I didn't understand correctly what you meant by "how many times do I need to roll a '1'". With a 10K-faced die, you can have an estimate after several rolls, but most of those won't be a 1 (probably, none of them).
 * Maybe in your application, rolling a 1 is somehow particularly expensive, and you want to minimize how many of those you encounter during your exploration? Then I think you're good, as mentioned you can have pretty good estimates while likely to never get a single 1. But it all depends on what you mean by "reasonably confident" of course. -- Meni Rosenfeld (talk) 13:57, 13 September 2015 (UTC)
 * The "1" isn't a particularly expensive outcome; a better description of the die would have been "one red face and un unknown number of white faces". Does that make a difference? — Preceding unsigned comment added by 2A01:E34:EF5E:4640:542:8701:F020:6A39 (talk) 15:05, 13 September 2015 (UTC)
 * I believe that's more a problem of estimating the parameter p of a Bernoulli distribution from a sample, the number of sides being 1/p. The German tank problem assumes you've got equally probable distinguishable outcomes. --RDBury (talk) 16:44, 13 September 2015 (UTC)
 * As RDBury said, if the non-1 faces are indistinguishable, it's a different problem. Usually estimating the parameter of a Bernoulli distribution would make use of the beta distribution, but here the prior distribution is quite different (supported only on p for which $$1/p\in\mathbb{N}$$, and more heavily biased towards low values of p / high number of faces).
 * Starting with an improper uniform prior seems reasonable to me. Every "1" outcome multiplies your unnormalized density by $$1/N$$, every non-1 by $$1-1/N$$. Alternatively, for large N, the number of 1's will follow the Poisson distribution. So to get an estimate with a standard deviation of, say, 10%, you'll need a number of rolls equal to 100 the real value of N. -- Meni Rosenfeld (talk) 17:01, 15 September 2015 (UTC)
 * ok I think I'm getting the hang of this, except for your last phrase which seems to suggest that I need to have an a priori estimate of the number of faces. However, it seems to me that if I were to roll the die and after a little while the number of red faces showing up got closer and closer to (say) one in ten then I could be fairly sure that there were ten faces without any a priori estimate of the number of faces. Am I Barking up the wrong tree here? — Preceding unsigned comment added by 92.90.20.17 (talk) 18:33, 15 September 2015 (UTC)
 * Well, you need a prior distribution to do Bayesian inference, but if you have enough data it doesn't really matter which one you use. A very broad prior like the uniform one I mentioned is usually a safe bet.
 * Since the calculations for accurate Bayesian inference can be a handful, you don't really need them if you have a lot of data. You just do the intuitive estimate (if 10% of rolls are red, then 10 faces total, etc.), and calculate the estimate variance based on the assumption your estimate is correct.
 * E.g., you make 10000 rolls. you get 1000 red. Your estimate is 10 faces. Assuming there are indeed 10 faces, then the variance of the number of reds with 10000 rolls (binomial distribution) is 900. Standard deviation is 30. this means the standard deviation of your estimate is roughly 0.3 (with low variance, x and 10000/x have roughly the same relative sd), so the real number of faces is likely to be between 9.7 and 10.3 (and since it's an integer, it's likely to be exactly 10). -- Meni Rosenfeld (talk) 19:20, 15 September 2015 (UTC)
 * The number of rolls required to obtain an estimate with a given relative variance depends on the true number of faces, so you don't know in advance how many you'll need. But as you make more rolls, you get a closer and closer estimate, so you can also better estimate how many you'll need for your target accuracy. -- Meni Rosenfeld (talk) 19:20, 15 September 2015 (UTC)
 * Brilliant, that makes total sense thanks ! 82.225.48.44 (talk) 14:00, 16 September 2015 (UTC)