FACTOID # 90: Russia has almost twice as many judges and magistrates as the United States. Meanwhile, the United States has 8 times as much crime.
 
 Home   Encyclopedia   Statistics   Countries A-Z   Flags   Maps   Education   Forum   FAQ   About 
 
 
 
WHAT'S NEW
RECENT ARTICLES
More Recent Articles »
 

SEARCH ALL

FACTS & STATISTICS    Advanced view

Search encyclopedia, statistics and forums:

 

 

(* = Graphable)

 

 


Encyclopedia > Checking if a coin is fair

Sometimes when choosing a coin (particularly for a coin flip), it may be desirable to determine if the coin is fair – that is, if the probability of obtaining a given side (commonly heads or tails) in the toss is 50%. It is of course impossible to ever definitively rule out arbitrarily small deviations from fairness such as might be expected to affect only one flip in a lifetime of flipping, and it is always possible for a biased coin to happen to turn up exactly n heads in 2n flips. As such, any fairness test must only establish a certain degree of confidence in a certain degree of fairness (a certain maximum bias). Image File history File links Stop_hand. ... Image File history File links Information_icon. ... Wikibooks logo Wikibooks, previously called Wikimedia Free Textbook Project and Wikimedia-Textbooks, is part of the Wikimedia Foundation. ... Coin flipping or coin tossing is the practice of throwing a coin in the air to resolve a dispute between two parties. ...

Contents

Preamble

This article is about how to determine if a coin is fair. There are many methods for doing this and this article describes two methods for doing so.


Both methods described in this article involve performing an experiment (or trial) which involves tossing the coin many times and recording down the result of each and every toss. Based on the mathematical analysis of the result of all the tosses, a decision can then be made on whether the coin could be declared "fair".

  • Posterior probability density function. This method assumes that the number of tosses is fixed and is not under the direct control of the experimenter. The method requires the probability density function (PDF) of the true value of obtaining a particular side be derived and the probability of a "fair coin" be obtained by integrating the PDF by the relevant interval. Based on result, a decision can then be made whether to proclaim the coin as a fair coin.
  • Estimator of true probability. This method assumes that the experimenter can decide and implement any number of coin tosses for the particular coin. The experimenter decides on what level of confidence they require and how large the margin of error they are willing to tolerate. This then determines the minimum number of tosses that needs to be perform in the experiment.

Posterior probability density function

One way of verifying this is to calculate the posterior probability density function of Bayesian probability theory. In mathematics, a probability density function (pdf) serves to represent a probability distribution in terms of integrals. ... Bayesianism is the philosophical tenet that the mathematical theory of probability applies to the degree of plausibility of statements, or to the degree of belief of rational agents in the truth of statements; when used with Bayes theorem, it then becomes Bayesian inference. ...


A test is performed by tossing the coin n times and noting the number of heads h and tails t:

H = h (Total number of heads is h)
T = t (Total number of tails is t)
N = n = h + t (Total number of tosses is n)

Next, let r be the actual probability of obtaining heads in a single toss of the coin. This is the value desired. Using Bayes' theorem, posterior probability of r conditional on H and T is expressed as follows: Bayess theorem (also known as Bayess rule) is a result in probability theory, which relates the conditional and marginal probability distributions of random variables. ...

f(r | H=h, T=t) = frac {Pr(H=h | r, N=h+t) , f(r)} {int_0^1 Pr(H=h |r, N=h+t) , f(r) , dr}. !

The prior summarizes what is known about the distribution of r in the absence of any observation. We could assume (but it would be rather ridiculous) that the prior distribution of r is uniform over the interval [0, 1]. That is, f(r) = 1. In fact, we ought to use a prior distribution that reflects our experience with real coins. A prior probability is a marginal probability, interpreted as a description of what is known about a variable in the absence of some evidence. ... In mathematics, the uniform distributions are simple probability distributions. ...


The probability of obtaining h heads in n tosses of a coin with a probability of heads equal to r is given by a binomial distribution: In probability theory and statistics, the binomial distribution is the discrete probability distribution of the number of successes in a sequence of n independent yes/no experiments, each of which yields success with probability p. ...

Pr(H=h | r, N=h+t) = {h+t choose h} , r^h , (1-r)^t. !

Putting it all together:

f(r | H=h, T=t) = frac{{h+t choose h},r^h,(1-r)^t} {int_0^1 {h+t choose h},r^h,(1-r)^t,dr} = frac{r^h,(1-r)^t}{int_0^1 r^h,(1-r)^t,dr} .

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: In probability theory and statistics, the beta distribution is a continuous probability distribution with the probability density function (pdf) defined on the interval [0, 1]: where α and β are parameters that must be greater than zero and B is the beta function. ... In Bayesian probability theory, a conjugate prior is a family of prior probability distributions which has the property that the posterior probability distribution also belongs to that family. ... A separate article treats the beta-function (written with a hyphen) of physics. ...

f(r | H=h, T=t) = frac{1}{mathrm{B}(h+1,t+1)} ; r^h,(1-r)^t. !

If a uniform prior is assumed, and because h and t are integers, this can also be written in terms of factorials: The beginning of the sequence of factorials (sequence A000142 in OEIS) In mathematics, the factorial of a number n is the product of all positive integers less than or equal to n. ...

f(r | H=h, T=t) = frac{(h+t+1)!}{h!,,t!} ; r^h,(1-r)^t. !

Example

For example, let n=10, h=7, i.e. the coin is tossed 10 times and 7 heads are obtained:

f(r | H=7, T=3) = frac{(7+3+1)!}{7!,,3!} ; r^7 , (1-r)^3 = 1320 , r^7 , (1-r)^3 !

The graph on the right shows the probability density function of r given that 7 heads were obtained in 10 tosses. (Note: r is the probability of obtaining heads when tossing the same coin once.) In mathematics, a probability density function (pdf) serves to represent a probability distribution in terms of integrals. ...

Plot of y = 1320 × x7 × (1-x)3 with x ranging from 0 to 1
Plot of y = 1320 × x7 × (1-x)3 with x ranging from 0 to 1

The probability for an unbiased coin Image File history File links graph of y=1320 * x^7 * (1-x)^3 Plotted using gnuplot. ... Image File history File links graph of y=1320 * x^7 * (1-x)^3 Plotted using gnuplot. ...

Pr(0.45 < r <0.55) = int_{0.45}^{0.55} f(r | H=7, T=3) ,dr approx 13% !

is small when compared with alternative hypothesis (a biased coin). However, it is not small enough to cause us to actually believe that the coin has a significant bias. Using a prior distribution that reflects our prior knowledge of what a coin is and how it acts, the posterior distribution would not favor the hypothesis of bias.


Estimator of true probability

The best estimator for the actual value r,! is the estimator p,! = frac{h}{h+t}.

This estimator has an error (E) where | pr | < E at a particular confidence level.

To determine the number of times a coin should be tossed, two vital pieces of information are required:

  1. The confidence level which is denoted by confidence interval (Z)
  2. The maximum (acceptable) error (E)
  • The confidence level is denoted by Z and is given by the Z-value of a standard normal distribution. This value can be read off a standard score statistics table for the normal distribution.
Z value Confidence Level Comment
0.6745 gives 50.000% level of confidence Half
1.0000 gives 68.269% level of confidence One std dev
1.6449 gives 90.000% level of confidence "One Nine"
1.9599 gives 95.000% level of confidence 95 percent
2.0000 gives 95.450% level of confidence Two std dev
2.5759 gives 99.000% level of confidence "Two Nines"
3.0000 gives 99.730% level of confidence Three std dev
3.2905 gives 99.900% level of confidence "Three Nines"
3.8906 gives 99.990% level of confidence "Four Nines"
4.0000 gives 99.993% level of confidence Four std dev
4.4172 gives 99.999% level of confidence "Five Nines"
  • The maximum error (E) is defined by | ppactual | < E where p,! is the estimated probability of obtaining head. Note: p_{mathrm{actual}},! is the same actual probability (for obtaining head) as the term r,! of the previous section in this article.
  • In statistics, the estimate of a proportion of a sample (denoted by p) has a standard error (standard deviation of error) given by:
s_p = sqrt{ frac {p , (1-p) } {n} }

This standard error sp will have a maximum theoretical value if p = (1 − p) = 0.5. In statistics, a confidence interval (CI) is an interval between two numbers, where there is a certain specified level of confidence that a population parameter lies. ... The normal distribution, also called Gaussian distribution (although Gauss was not the first to work with it), is an extremely important probability distribution in many fields. ... Compares the various grading methods in a normal distribution. ...


Hence , assuming the worse case , p is set to 0.5 to get the maximum possible value of sp.

s_p,! = sqrt{ frac {p , (1-p) } {n} } = sqrt{ frac {0.5 times 0.5 } {n} }
= sqrt{ frac { 1 } {4 , n} } = frac {1}{2 , sqrt{n}}

And hence the value of maximum error (E) is given by

E,! = Z , s_p = frac {Z}{2 , sqrt{n}}

Therefore, the final formula for the number of coin tosses for the estimator p,! is

E = frac {Z}{2 , sqrt{n}} quad quad mbox{or} quad quad n = frac {Z^2} {4 , E^2} !

provided that n cdot p ge 5 and n cdot q ge 5 where q = (1-p), to satisfy the Central Limit Theorem. In probability theory and statistics, the binomial distribution is the discrete probability distribution of the number of successes in a sequence of n independent yes/no experiments, each of which yields success with probability p. ... A central limit theorem is any of a set of weak-convergence results in probability theory. ...


Example

1. If a maximum error of 0.01 is desired, how many times should the coin be tossed?

n = frac {Z^2} {4 , E^2} = frac {Z^2} {4 times 0.01^2} = 2500  Z^2
n = 2500, at 68.27% level of confidence (Z=1)
n = 10000, at 95.45% level of confidence (Z=2)
n = 27225, at 99.90% level of confidence (Z=3.3)

2. If the coin is tossed 10000 times, what is the maximum error of the estimator p,! on the value of r,! (the actual probability of obtaining head in a coin toss)?

E = frac {Z}{ 2 , sqrt{n} }
E = frac {Z}{ 2 , sqrt{ 10000 } } = frac {Z}{ 200 }
E = 0.0050, at 68.27% level of confidence (Z=1)
E = 0.0100, at 95.45% level of confidence (Z=2)
E = 0.0165, at 99.90% level of confidence (Z=3.3)

3. The coin is tossed 12000 times with a result of 5961 heads (and 6039 tails). What interval does the value of r,! (the true probability of obtaining head) lie within if a confidence level of 99.999% is desired?

p = frac{h}{h+t} , = frac{5961}{12000} , = 0.4968
Now find the value of Z corresponding to 99.999% level of confidence.
Z = 4.4172 ,!
Now calculate E
E = frac{Z}{2 , sqrt{n}} , = frac{4.4172}{2 , sqrt{12000}} , = 0.0202
The interval which contains r is thus:
p - E < r < p + E ,!
0.4766 < r < 0.5169 ,!

Hence, 99.999% of the time, the interval above would contain r,! which is the true value of obtaining head in a single toss.


Other applications

The above mathematical analysis for determining if a coin is fair can also be applied to other uses. For example:

  • Determining the product defective rates of a product when subjected to a particular (but well defined) condition. Sometimes a product can be very difficult or expensive to produce. Furthermore if testing such products will result in their destruction, a minimum amount of products should be tested. Using the same analysis the probability density function of the product defect rate can be found.
  • Two party polling. If a small random sample poll is taken where the there are only two mutually exclusive choices, then this is equivalent to tossing a single coin multiple times using a bias coin. The same analysis can therefore be applied to determine actual voting ratio.
  • Finding the proportion of females in an animal group. Determining the gender ratio in a large group of an animal species. Provided that a very small random sample is taken when performing the random sampling of the population, the analysis is similar to determining the probability of obtaining heads in a coin toss.

See also

In statistics, the binomial test is an exact test of the statistical significance of deviations from a theoretically expected distribution of observations into two categories. ... Coin flipping or coin tossing is the practice of throwing a coin in the air to resolve a dispute between two parties or otherwise choose between two alternatives. ... The top portion of this graphic depicts probability densities that show the relative likelihood that the true percentage is in a particular area given a reported percentage of 50%. The bottom portion of this graphic shows the margin of error, the corresponding zone of 99 % confidence. ... In statistics, a confidence interval (CI) is an interval between two numbers, where there is a certain specified level of confidence that a population parameter lies. ... A numeric sequence is said to be statistically random when it contains no recognizable patterns or regularities; sequences such as the results of an ideal die roll, or the digits of Pi (as far as we can tell) exhibit statistical randomness. ... Estimation theory is a branch of statistics and signal processing that deals with estimating the values of parameters based on measured/empirical data. ... It has been suggested that this article or section be merged with statistical inference. ... In statistics, point estimation involves the use of sample data to calculate a single value (known as a statistic) which is to serve as a best guess for an unknown (fixed or random) population parameter. ...

External links

  • frequentists and bayesians


 
 

COMMENTARY     


Share your thoughts, questions and commentary here
Your name
Your comments

Want to know more?
Search encyclopedia, statistics and forums:

 


Lesson Plans | Student Area | Student FAQ | Reviews | Press Releases |  Feeds | Contact
The Wikipedia article included on this page is licensed under the GFDL.
Images may be subject to relevant owners' copyright.
All other elements are (c) copyright NationMaster.com 2003-5. All Rights Reserved.
Usage implies agreement with terms, 1022, m