Wikipedia:Reference desk/Archives/Mathematics/2012 February 1

= February 1 =

Determining probability quickly
I've got a binomial distribution with unknown probability p (if it matters, it's somewhere around 0.01). If I estimate the value of p the obvious way by running a bunch of trials and dividing the number of successes by the number of trials, it takes a while: the quality of the estimate increases as the square of the number of trials. Is there a way to speed things up? --Carnildo (talk) 21:35, 1 February 2012 (UTC)


 * I don't think there's a general way. However, depending on what you are measuring the probability of, there may indeed be a short cut.  Let's say you were finding the probability of tossing heads seven times in a row.  You could figure that as 7 independent events each with a 0.5 probability, or P = (1/2)7 = 1/128. StuRat (talk) 21:55, 1 February 2012 (UTC)


 * ... but that wouldn't change the number of trials needed to reach a given confidence in the conclusion unless there is some assumption you can reasonably make about the distribution that narrows down the possibilities.   D b f i r s   23:14, 1 February 2012 (UTC)

See Bayesian inference. The mean value of p is not the number of successes i divided by the number of trials n, but rather μ=(i+1)/(n+2), and the standard deviation is σ=√(μ(1&minus;μ)/(n+3)). So if n=7 and i=0 you get p ≈ μ±σ = 0.111111±0.0947559. This may also be written p=0.11(9), see concise notation. Bo Jacoby (talk) 11:49, 2 February 2012 (UTC).


 * That...doesn't change my numbers very much. With the data I've got so far, it gives a p of 0.0106(26) rather than 0.0100(25), and better values are still O(n^2). --Carnildo (talk) 03:00, 3 February 2012 (UTC)

Yes, but why not use the correct formula? The case n=i=0 gives p=0.5000(2887), which makes sense, while your formula, p=i/n=0/0, does not make sense. Solving the equations $$ \mu=\frac{i+1}{n+2}$$ and $$ \sigma=\sqrt{\frac{\mu(1-\mu)}{n+3}}$$ gives $$ n=\frac{\mu(1-\mu)}{\sigma^2}-3$$ and $$ i=\frac{\mu^2(1-\mu)}{\sigma^2}-\mu-1$$. Neither 0.0106(26) nor 0.0100(25) give integer values of n and i. There is no way to speed things up. Bo Jacoby (talk) 15:05, 3 February 2012 (UTC).