Consider identical looking four coins labeled as C1, C2, C3 and C4.
C1 is unbiased and, the probability of getting heads in a toss is 1/2.
C2 is biased and, the probability of getting heads in a toss is 3/4.
C3 is biased and, the probability of getting heads in a toss is 5/6.
C4 is biased and, the probability of getting heads in a toss is 7/8.
Exactly one of the coins is chosen at random with equal probability. The chosen coin is tossed nine times and the outcome is: HHHHHTTTT.
Determine the probability that the chosen coin is C1. What is the probability that the chosen coin is C4?
In the Bayesian calculation, since all four a priori choices are equally likely, the 1/4 probabilities cancel out. So we only need the relative probabilities of getting the specified HHHHHTTTT.
With coin 1, the probability would be (1/2)^9.
With coin 2, the probability would be (3/4)^5 * (1/4)^4.
With coin 3, the probability would be (5/6)^5 * (1/6)^4.
With coin 4, the probability would be (7/8)^5 * (1/8)^4.
10 kill "unbiased.txt":open "unbiased.txt" for output as #2
20 A=(1//2)^9
30 B=(3//4)^9*(1//4)^4
40 C=(5//6)^9*(1//6)^4
50 D=(7//8)^9*(1//8)^4
60 Tot=A+B+C+D
70 print A//Tot,A/Tot
80 print B//Tot,B/Tot
90 print C//Tot,C/Tot
100 print D//Tot,D/Tot
170 print #2,A//Tot,A/Tot
180 print #2,B//Tot,B/Tot
190 print #2,C//Tot,C/Tot
200 print #2,D//Tot,D/Tot
210 close #2
finds these probabilities:
1711891286065152/2164373610155141 ~= 0.7909407498007909446
257073640316928/2164373610155141 ~= 0.1187750761286084606
131072000000000/2164373610155141 ~= 0.0605588607184158089
9190954824723/309196230022163 ~= 0.0297253133521847855
for coins 1, 2, 3 and 4 respecively.
Edited on September 19, 2016, 10:56 am

Posted by Charlie
on 20160919 10:56:17 