Checking if a coin is fair

Checking if a coin is fair

In statistics, 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 ubiquitous coin flip used in sports and other situations where it is necessary to give two parties the same chance of winning. Depending on the occasion a specially designed chip or a simple currency coin is used, which due to unequal weight distribution might be "unfair": one state might occur more frequently than the other, giving one party an unfair advantage. So it might be necessary to experimentally determine whether the coin is in fact "fair" – that is, if the probability of the coin falling on either side in the toss is approximately 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 an unfair (or "biased") coin to happen to turn up exactly 10 heads in 20 flips. As such, any fairness test must only establish a certain degree of confidence in a certain degree of fairness (a certain maximum bias). In more rigorous terminology, the problem is of determining the parameters of a Bernoulli process, given only a limited sample of Bernoulli trials.

Preamble

This article describes experimental procedures for determining if a coin is fair. There are many statistical methods for analyzing such an experimental procedure. This article illustrates two of them.

Both methods prescribe an experiment (or trial) in which the coin is tossed many times and the result of each and every toss is recorded. A statistical analysis of the results can then be performed to decide if the coin is "fair" or "probably not fair".

* Posterior probability density function. This method assumes that the number of tosses is fixed and not under the experimenter's direct control. The true probability of obtaining a particular side when a fair coin is tossed (the "prior distribution") is already known. The probability that this particular coin is a "fair coin" can then be obtained by integrating the "posterior" PDF over the relevant interval.

* Estimator of true probability. This method assumes that the experimenter can decide and implement any number of coin tosses for this particular coin. The experimenter decides on the level of confidence required and the tolerable margin of error. These considerations determine the minimum number of tosses that must be performed to complete the experiment.

Posterior probability density function

One way of verifying this is to calculate the posterior probability density function of Bayesian probability theory.

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:

: 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 will assume that the prior distribution of "r" is uniform over the interval [0, 1] . That is, "f"("r") = 1. (In fact, we could use a prior distribution that reflects 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 a binomial distribution:

: 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) = frach+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:

: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:

: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.)

The probability for an unbiased coin

: 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. Notice that this probability is slightly "higher" than our presupposition of the probability that the coin was fair corresponding to the uniform prior distribution, which was 10%.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. (But also notice that the number of trials done in this example is relatively small, and with more trials the choice of a prior distribution would be less relevant.)

Estimator of true probability

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

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.

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 imes 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 heads 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 heads) 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.5170 ,!

Hence, 99.999% of the time, the interval above would contain r,! which is the true value of obtaining heads 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.

ee also

*Binomial test
*Coin flipping
*Confidence interval
*Estimation theory
*Inferential statistics
*Margin of error
*Point estimation
*Statistical randomness

References

*Guttman, Wilks, and Hunter: "Introductory Engineering Statistics", John Wiley & Sons, Inc. (1971) ISBN 0471337706
*Devinder Sivia: "Data Analysis, a Bayesian Tutorial", Oxford University Press (1996) ISBN 0198518897

External links

* [http://www.statisticalengineering.com/frequentists_and_bayesians.htm frequentists and bayesians]


Wikimedia Foundation. 2010.

Игры ⚽ Нужен реферат?

Look at other dictionaries:

  • Checking whether a coin is fair — 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… …   Wikipedia

  • Coin flipping — or coin tossing or heads or tails is the practice of throwing a coin in the air to choose between two alternatives, sometimes to resolve a dispute between two parties. It is a form of sortition which inherently has only two possible and equally… …   Wikipedia

  • Fair coin — In probability theory and statistics, a sequence of independent Bernoulli trials with probability 1/2 of success on each trial is metaphorically called a fair coin. One for which the probability is not 1/2 is called a biased or unfair coin. Fair… …   Wikipedia

  • P-value — In statistical significance testing, the p value is the probability of obtaining a test statistic at least as extreme as the one that was actually observed, assuming that the null hypothesis is true. One often rejects the null hypothesis when the …   Wikipedia

  • List of statistics topics — Please add any Wikipedia articles related to statistics that are not already on this list.The Related changes link in the margin of this page (below search) leads to a list of the most recent changes to the articles listed below. To see the most… …   Wikipedia

  • Heads or Tails — is a coin tossing game. Most coins have a side where the imprint of a person, such as a current or former head of state, is impressed mdash; this side is called the heads side. The other side is called the tails side, irrespective of its design.… …   Wikipedia

  • Bernoulli trial — In the theory of probability and statistics, a Bernoulli trial is an experiment whose outcome is random and can be either of two possible outcomes, success and failure .In practice it refers to a single experiment which can have one of two… …   Wikipedia

  • Statistical randomness — 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 π exhibit statistical randomness.Statistical randomness does not …   Wikipedia

  • Bernoulli process — In probability and statistics, a Bernoulli processis a discrete time stochastic process consisting ofa sequence of independent random variables taking values over two symbols. Prosaically, a Bernoulli process is coin flipping, possibly with an… …   Wikipedia

  • List of mathematics articles (C) — NOTOC C C closed subgroup C minimal theory C normal subgroup C number C semiring C space C symmetry C* algebra C0 semigroup CA group Cabal (set theory) Cabibbo Kobayashi Maskawa matrix Cabinet projection Cable knot Cabri Geometry Cabtaxi number… …   Wikipedia

Share the article and excerpts

Direct link
Do a right-click on the link above
and select “Copy Link”