wu :: forums (http://www.ocf.berkeley.edu/~wwu/cgi-bin/yabb/YaBB.cgi)
riddles >> medium >> Biased Coin
(Message started by: marsh8472 on Sep 14th, 2012, 2:17am)

Title: Biased Coin
Post by marsh8472 on Sep 14th, 2012, 2:17am
A biased coin is flipped k times.  Heads comes up x times.  Tails comes up k-x times.  What is the probability that heads is more probable than tails on this coin? (in terms of k and x)



I just made this up and am new here.  If this falls within the hard category feel free to move it there.   ;D

Title: Re: Biased Coin
Post by Grimbal on Sep 14th, 2012, 5:32am
You need to know the prior distribution of the bias.

Title: Re: Biased Coin
Post by towr on Sep 14th, 2012, 6:17am
I'd say, when in doubt, take a uniform prior distribution. That's the only one that doesn't contain information.
Or you could add the prior as an extra free parameter in the equation and see where that leads you.

Title: Re: Biased Coin
Post by marsh8472 on Sep 14th, 2012, 9:21am

on 09/14/12 at 06:17:20, towr wrote:
I'd say, when in doubt, take a uniform prior distribution. That's the only one that doesn't contain information.
Or you could add the prior as an extra free parameter in the equation and see where that leads you.


Yeah I would assume a uniform in this.  

I found a similar problem when I looked up "Maximum_likelihood_estimate" for wikipedia

Maybe this would help

http://izbicki.me/blog/how-to-create-an-unfair-coin-and-prove-it-with-math

http://izbicki.me/blog/wp-content/plugins/optimized-latex/image.php?image=tex_b9db1ee79d647fd1290de04147a16d94.png

alpha = number of heads
beta = number of tails+1

Then I think the answer is the integral from 0 to 0.5 of that pdf?

Title: Re: Biased Coin
Post by towr on Sep 14th, 2012, 11:48am
Something doesn't seem right with that equation; unless it represents something other than what I'd expect.
I'd expect that the exponents of x and (x-1) should be the number of heads and tails respectively; and that the value you get is the probability of getting h heads and t tails when the probability of heads is x.

I'm not much of a fan of the Gamma function, I prefer just using factorials and related functions (because I'm more familiar with them, and they're clearer in this case, since the parameters match the values you're working with, which avoids off-by-one errors).

So, I'd say f(x, h, t) = (h+t)!/h!/t! * xh * (1-x)t
And then what we're actually after is:
http://www.ocf.berkeley.edu/~wwu/YaBBImages/symbols/int.gif11/2 f(x,h,t) dx / http://www.ocf.berkeley.edu/~wwu/YaBBImages/symbols/int.gif10 f(x,h,t) dx
The sum of all outcomes (h,t) where the coin is biased in heads favor (x > 1/2), divided by the sum of all outcomes (h,t)
Note that we can just eliminate the factor (h+t)!/h!/t! above and below the dividing line, since it is a constant (and thus it doesn't matter in the end whether we use the Gamma function or factorials). However, I haven't been able to simplify the equation further.
You could use the incomplete Beta function, but that's just begging the question imo.

Title: Re: Biased Coin
Post by marsh8472 on Sep 15th, 2012, 5:58am

on 09/14/12 at 11:48:45, towr wrote:
Something doesn't seem right with that equation; unless it represents something other than what I'd expect.
I'd expect that the exponents of x and (x-1) should be the number of heads and tails respectively; and that the value you get is the probability of getting h heads and t tails when the probability of heads is x.

I'm not much of a fan of the Gamma function, I prefer just using factorials and related functions (because I'm more familiar with them, and they're clearer in this case, since the parameters match the values you're working with, which avoids off-by-one errors).

So, I'd say f(x, h, t) = (h+t)!/h!/t! * xh * (1-x)t
And then what we're actually after is:
http://www.ocf.berkeley.edu/~wwu/YaBBImages/symbols/int.gif11/2 f(x,h,t) dx / http://www.ocf.berkeley.edu/~wwu/YaBBImages/symbols/int.gif10 f(x,h,t) dx
The sum of all outcomes (h,t) where the coin is biased in heads favor (x > 1/2), divided by the sum of all outcomes (h,t)
Note that we can just eliminate the factor (h+t)!/h!/t! above and below the dividing line, since it is a constant (and thus it doesn't matter in the end whether we use the Gamma function or factorials). However, I haven't been able to simplify the equation further.
You could use the incomplete Beta function, but that's just begging the question imo.


Yes that's it :)  That was easier than I thought it would be  ;D



Powered by YaBB 1 Gold - SP 1.4!
Forum software copyright © 2000-2004 Yet another Bulletin Board