St · Statistics & Probability

How to Analyze a Loaded Coin with Probability and Statistics

Published By the 9to5Science editorial team

At a glance

  1. 1. Model the tosses

    Let each toss have the same heads probability p, with tosses independent.

  2. 2. Estimate p

    If H heads occur in n tosses, the natural estimate is H divided by n.

  3. 3. Test fairness

    Compare the observed result with the binomial distribution when p equals one-half.

  4. 4. Quantify uncertainty

    Use a confidence interval or posterior distribution to describe plausible values of p.

A coin is loaded if its probability of landing heads is not one-half. Write

P(heads)=p,P(tails)=1−p.P(\text{heads})=p, \qquad P(\text{tails})=1-p.

For a fair coin, p=0.5p=0.5. For a loaded coin, p≠0.5p\ne 0.5—although a coin may be physically biased even when a small experiment does not detect the bias.

The standard model assumes that tosses are independent and that the same value of pp applies on every toss. Under that model, the number of heads in nn tosses has a binomial distribution:

H∼Binomial⁡(n,p).H\sim \operatorname{Binomial}(n,p).

This model is the starting point for both estimating how loaded the coin is and testing whether it is reasonable to call the coin fair.

Estimating the probability of heads

Suppose you observe H=hH=h heads in nn tosses. The sample proportion

p^=hn\hat p=\frac{h}{n}

is the usual estimate of the coin’s heads probability.

For example, if a coin produces 62 heads in 100 tosses, then

p^=62100=0.62.\hat p=\frac{62}{100}=0.62.

The estimate is not necessarily exactly equal to the true value of pp. Random variation can produce 62 heads even when p=0.5p=0.5, and a genuinely loaded coin might produce close to 50 heads in a short run.

The standard error of the estimate, when pp is estimated by p^\hat p, is approximately

SE⁡(p^)=p^(1−p^)n.\operatorname{SE}(\hat p)=\sqrt{\frac{\hat p(1-\hat p)}{n}}.

For 62 heads in 100 tosses, this is

SE⁡(p^)=0.62(0.38)100≈0.0485.\operatorname{SE}(\hat p) =\sqrt{\frac{0.62(0.38)}{100}} \approx 0.0485.

A rough 95% interval based on the normal approximation is therefore

0.62±1.96(0.0485)≈[0.525,0.715].0.62\pm 1.96(0.0485) \approx [0.525,0.715].

Because this interval barely excludes 0.5, the evidence against fairness is relatively weak. For small samples or estimates close to 0 or 1, use an exact binomial interval or Wilson interval rather than relying on this simple Wald interval.

Testing whether the coin is fair

To test whether the coin is loaded, set up hypotheses:

H0:p=0.5H_0:p=0.5

against the two-sided alternative

H1:p≠0.5.H_1:p\ne 0.5.

The null hypothesis says that the coin is fair. Under H0H_0, the number of heads follows

H∼Binomial⁡(n,0.5).H\sim \operatorname{Binomial}(n,0.5).

The two-sided binomial p-value measures how likely it would be to obtain a result at least as extreme as the observed result if the coin were fair. A small p-value is evidence against fairness; it is not the probability that the coin is loaded.

If the suspected bias is specifically toward heads, use the one-sided alternative H1:p>0.5H_1:p>0.5. If either heads or tails could be favored, use the two-sided alternative.

Worked example: 80 heads in 100 tosses

Suppose 100 tosses produce 80 heads and 20 tails. The estimate is

p^=80100=0.80.\hat p=\frac{80}{100}=0.80.

Under the fair-coin hypothesis, the null standard deviation of the number of heads is

np0(1−p0)=100(0.5)(0.5)=5.\sqrt{np_0(1-p_0)} =\sqrt{100(0.5)(0.5)}=5.

The observed result is 30 heads above the null mean of 50, giving the approximate standardized statistic

z=80−505=6.z=\frac{80-50}{5}=6.

A continuity-corrected normal approximation uses 79.5 rather than 80 for the upper tail:

z=79.5−505=5.9.z=\frac{79.5-50}{5}=5.9.

The corresponding two-sided tail probability is on the order of 10−910^{-9}, and an exact binomial test also gives a p-value below 2×10−92\times 10^{-9}. Thus, under ordinary significance levels such as 0.05, the data provide extremely strong evidence that the coin is not fair.

An approximate 95% interval using the simple formula is

0.80±1.960.8(0.2)100=0.80±0.0784,0.80\pm 1.96\sqrt{\frac{0.8(0.2)}{100}} =0.80\pm 0.0784,

or approximately [0.722,0.878][0.722,0.878]. A Wilson interval, which is more reliable for a proportion, is approximately [0.711,0.867][0.711,0.867]. Both intervals place 0.5 far outside the plausible range suggested by the data.

Can you calculate the probability that the coin is loaded?

Not from the tosses alone in the usual frequentist framework. In that framework, pp is an unknown fixed parameter, and the test calculates the probability of the data assuming p=0.5p=0.5.

If you want a Bayesian probability for exact fairness versus loading, you need a Bayesian model that assigns prior probability to those competing possibilities. For example, choose a prior distribution for pp, then calculate the posterior distribution after observing the tosses. With a uniform prior, p∼Beta⁡(1,1)p\sim\operatorname{Beta}(1,1), observing hh heads and n−hn-h tails gives

p∣data∼Beta⁡(h+1,n−h+1).p\mid\text{data}\sim\operatorname{Beta}(h+1,n-h+1).

For 80 heads in 100 tosses, the posterior is Beta⁡(81,21)\operatorname{Beta}(81,21). A Bayesian probability such as P(p>0.5∣data)P(p>0.5\mid\text{data}) depends on this prior and can be computed from that beta distribution, but it measures the posterior probability that the bias is toward heads, not generally the probability that the coin is loaded.

Because the Beta prior is continuous, it assigns probability zero to the exact value p=0.5p=0.5, and the posterior therefore has P(p≠0.5∣data)=1P(p\ne 0.5\mid\text{data})=1. To obtain a nontrivial posterior probability of exact fairness versus loading, use a prior with a point mass at p=0.5p=0.5 together with a continuous alternative model for loaded coins.

Common mistakes

  • Calling any unequal result proof of loading. A fair coin does not produce exactly half heads in every finite sequence.
  • Using h/nh/n as certainty. The observed proportion is an estimate and has sampling uncertainty.
  • Confusing a p-value with P(H0 is true)P(H_0\text{ is true}). A p-value assumes the null; it does not give the null hypothesis’s probability.
  • Ignoring the direction of the test. Use a one-sided test only when a bias in a specified direction was justified before examining the data.
  • Assuming independence without checking the experiment. Tosses influenced by a mechanical device, changing surfaces, or changing launch conditions may not follow one fixed binomial model.
  • Stopping as soon as the result looks unusual. Repeatedly checking results and stopping selectively changes the reported evidence; decide the sampling plan in advance when possible.

References

  1. Introduction to the Practice of Statistics, David S. Moore, George P. McCabe, and Bruce A. Craig
  2. All of Statistics, Larry Wasserman

Spotted an error? Send a correction. Read how we write and check articles in our editorial policy.