In statistics, the question of checking whether a coin is fair is one whose importance lies, firstly, in providing a simple problem on which to illustrate basic ideas of statistical inference and, secondly, in providing a simple problem that can be used to compare various competing methods of statistical inference, including decision theory.
The practical problem of checking whether a coin is fair might be considered as easily solved by performing a sufficiently large number of trials, but statistics and probability theory can provide guidance on two types of question; specifically those of how many trials to undertake and of the accuracy of an estimate of the probability of turning up heads, derived from a given sample of trials.
A fair coin is an idealized randomizing device with two states (usually named "heads" and "tails") which are equally likely to occur.
It is based on the coin flip used widely in sports and other situations where it is required to give two parties the same chance of winning.
Either a specially designed chip or more usually a simple currency coin is used, although the latter might be slightly "unfair" due to an asymmetrical weight distribution, which might cause one state to occur more frequently than the other, giving one party an unfair advantage.
This article describes experimental procedures for determining whether a coin is fair or unfair.
A test is performed by tossing the coin N times and noting the observed numbers of heads, h, and tails, t. The symbols H and T represent more generalised variables expressing the numbers of heads and tails respectively that might have been observed in the experiment.
Thus N = H + T = h + t. Next, let r be the actual probability of obtaining heads in a single toss of the coin.
(In practice, it would be more appropriate to assume a prior distribution which is much more heavily weighted in the region around 0.5, to reflect our experience with real coins.)
The probability of obtaining h heads in N tosses of a coin with a probability of heads equal to r is given by the binomial distribution: Substituting this into the previous formula: This is in fact a beta distribution (the conjugate prior for the binomial distribution), whose denominator can be expressed in terms of the beta function: As a uniform prior distribution has been assumed, and because h and t are integers, this can also be written in terms of factorials: For example, let N = 10, h = 7, i.e. the coin is tossed 10 times and 7 heads are obtained: The graph on the right shows the probability density function of r given that 7 heads were obtained in 10 tosses.
With the uniform prior, the posterior probability distribution f(r | H = 7,T = 3) achieves its peak at r = h / (h + t) = 0.7; this value is called the maximum a posteriori (MAP) estimate of r. Also with the uniform prior, the expected value of r under the posterior distribution is
(the true probability of obtaining heads) lie within if a confidence level of 99.999% is desired?
Now calculate E The interval which contains r is thus: Other approaches to the question of checking whether a coin is fair are available using decision theory, whose application would require the formulation of a loss function or utility function which describes the consequences of making a given decision.
[2] The above mathematical analysis for determining if a coin is fair can also be applied to other uses.