is created by David Witten, a mathematics and computer science student at Vanderbilt University. For more information, see the "About" page.

Is a coin fair?

The Stated Problem

I flipped 1000 coins. 560 of them are heads. Is the coin fair?


MathJax TeX Test Page We utilize something called a one-sample z-test. We can't prove a positive statement in statistics. We can only show that it's very unlikely. So, we have to create a null hypothesis, which is a statement that we want to disprove. Our null hypothesis is that the coin's true ratio of heads/tails is 1:1 or $50\%$. We have to show that our result of $56\%$ heads could reasonably occur.

How do we do this? First, we determine the standard deviation of our model. That is to say, let's say we did our test of 1000 coin flips many times $\left(50\%, 48\%, 51\%, \dots\right)$, what's the standard deviation of those test results? It turns out that it's $$\sqrt{\frac{p\left(1-p\right)}{n}}$$ This comes from the central limit theorem, and another post will cover that. So, we plug in values and get the the standard deviation is $$\sqrt{\frac{0.56\left(0.44\right)}{1000}} = 0.016$$ Now, we're still assuming that our coin is fair, so our test of 1000 coin flips should have a mean of $50\%$. We are trying to see how likely getting a result as extreme as $56\%$ is. If it's less than $5\%$, we reject the null hypothesis and say that the coin is unfair. We find out how many standard deviations it is from the mean, and it is $$\dfrac{0.56 - 0.5}{0.016} = 3.75 \text{ standard deviations away}$$ For the record, this is so tiny, that we would not even check this, but for the sake of teaching, you would plug it in a calculator and find that there's a $0.01\%$ chance of seeing results like that assuming the coin is fair. That is equivalent to saying that the p-value is $0.0001$. Therefore, we state that the $\boxed{\text{coin is unfair}}$.

P-Values Explained