A smoke alarm that goes off when you burn toast is annoying. A smoke alarm that stays silent during a real fire is dangerous. Both are mistakes, but they are different mistakes, with different costs. Statistical tests make the same two kinds of mistakes, and learning to tell them apart is one of the most useful skills in data science.
Every hypothesis test is a decision made from limited data. You can never be certain, so there are two ways to be wrong. You can see an effect that is not there, which is a Type 1 error, or you can miss an effect that is there, which is a Type 2 error. Which one is worse depends on the situation.
This tutorial explains both errors with clear definitions, easy examples, the numbers that measure them (alpha, beta and power), a simulation that you can run, how the two errors trade off against each other, and how to reduce them. You should know what a null hypothesis is. The first section recaps it.

A hypothesis test starts with a null hypothesis, written H0 (H zero). It is the default position, usually that nothing special is happening: no difference, no effect, no link. The alternative hypothesis, written H1, says that there is an effect.
You collect data and ask how surprising it would be if H0 were true. If it is very surprising, you reject H0. If not, you fail to reject it. You never prove H0 true. You only fail to find enough evidence against it.
A Type 1 error happens when you reject a null hypothesis that is actually true. It is a false positive: you claim an effect, but there is none. The probability of a Type 1 error is called alpha, and it is the significance level that you choose before the test, most often 0.05.
A significance level of 0.05 means that, when H0 is true, you accept a 5 percent chance of wrongly rejecting it.
You are usually the one who has to defend a claim of a discovery. A Type 1 error means acting on something that is not real: launching a feature that does not help, approving a drug that does not work, or publishing a result that cannot be repeated. The live page heading says why we use a Type 1 error. More exactly, you do not use it. You control it, by choosing alpha.
A criminal trial is a good model. The null hypothesis is that the accused is innocent, and the alternative is that the person is guilty. A Type 1 error is convicting an innocent person. You rejected innocence, which was true. The court sets a high bar, beyond reasonable doubt, to keep this error rare.

A Type 2 error happens when you fail to reject a null hypothesis that is actually false. It is a false negative: there is a real effect, but your test does not detect it. The probability of a Type 2 error is called beta.
The live page says that a Type 2 error produces a false positive and rejects the alternative hypothesis. That is wrong. It is the other way round, and the false positive belongs to the Type 1 error.
The related idea is power, which is 1 minus beta. Power is the chance that your test finds a real effect when one exists. Researchers usually aim for a power of 0.80 or higher.
A Type 2 error means missing something real: a drug that works is dropped, a fraud pattern goes unnoticed, or a design improvement is thrown away. It is easy to overlook, because nothing visibly goes wrong. You just never learn what you missed.
In the criminal trial, a Type 2 error is letting a guilty person go free. The null hypothesis of innocence was false, and the court did not reject it.
Now the clinical trial from the live page. A company tests a new cancer drug against an existing one in 9,000 patients. The null hypothesis is that the two drugs are equally effective. If the new drug really is better, but the trial fails to show it, that is a Type 2 error.
The live page says that beta is 2.5 percent, so the probability of a Type 2 error is 2.5 percent. That is correct as a reading of beta. It also means that the power is 97.5 percent, so if a real difference of the size that the trial was planned for exists, there is a 97.5 percent chance that the trial finds it. The size of 9,000 patients is what makes such a high power possible. The page does not say any of this.
The page also claims that equal numbers of patients on each drug show that both drugs work. Equal group sizes are a design choice that gives the test its best power. They say nothing about whether either drug is effective.
| Decision | H0 is true (no real effect) | H0 is false (real effect) |
|---|---|---|
| You reject H0 | Type 1 error, a false positive. Probability is alpha | Correct. This is a true positive. Probability is power, 1 minus beta |
| You fail to reject H0 | Correct. A true negative. Probability is 1 minus alpha | Type 2 error, a false negative. Probability is beta |
| Point | Type 1 error | Type 2 error |
|---|---|---|
| Also called | False positive | False negative |
| What happens | You find an effect that is not there | You miss an effect that is there |
| Probability | Alpha, set by you, often 0.05 | Beta, depends on sample size, effect size and alpha |
| Criminal trial | Convict an innocent person | Free a guilty person |
| Smoke alarm | Alarm rings, no fire | No alarm, real fire |
| Medical test | Healthy person told they are ill | Ill person told they are healthy |
A memory trick: a Type 1 error means you cried wolf. A Type 2 error means that the wolf came and you did not notice.
The best way to feel these numbers is to run them. I simulated two groups of 30 people each, with a standard deviation of 10, and ran a T test at alpha 0.05, 10,000 times.
First, both groups come from the same population, with a mean of 50. There is no real difference, so any rejection is a Type 1 error. The test rejected 5 percent of the time, which is exactly alpha.
Second, the groups have means of 50 and 55. There is a real difference, half a standard deviation. The test failed to find it 52.8 percent of the time, so beta is about 0.53, and the power is only 0.47. The theoretical power for this setup is 0.478, which matches. With 30 people per group, you would miss this real effect more than half the time.
| Setup | Result of 10,000 runs |
|---|---|
| No real difference, rejections | 5.0 percent, equal to alpha |
| Real difference of 5, misses (beta) | 52.8 percent |
| Real difference of 5, detections (power) | 47.2 percent |
You cannot reduce both errors at once with the same data. Making the test stricter, with a smaller alpha, cuts false positives but raises false negatives. The numbers below are for the same setup, with 30 people per group and a real difference of half a standard deviation.
| Alpha | Power | Beta |
|---|---|---|
| 0.01 | 0.244 | 0.756 |
| 0.05 | 0.478 | 0.522 |
| 0.10 | 0.606 | 0.394 |
A stricter alpha of 0.01 makes the test miss the real effect about three times in four. A looser alpha of 0.10 finds more real effects, but also gives more false alarms.
It depends on the cost, and you must decide before the test.
I ran the code below, and the output is real. It takes a few seconds.
| Mistake | Fix |
|---|---|
| Calling a Type 2 error a false positive | It is a false negative |
| Saying that a non significant result proves no effect | It may be a Type 2 error. Check the power |
| Choosing alpha after seeing the data | Set it before the test |
| Using a small sample and trusting a negative result | Small samples have low power |
| Running many tests and reporting the one that worked | Correct for multiple tests |
| Mixing up alpha and the p value | Alpha is your chosen limit. The p value comes from the data |
| Thinking beta and alpha add up to 1 | They are separate. Power is 1 minus beta |
Answers: 1) A Type 1 error, because you rejected a true null hypothesis. 2) Beta = 1 minus 0.90 = 0.10. 3) 1 minus 0.95 to the power 10 = 0.40. 4) Increase the sample size. These are my own answers, so please recheck them before publishing.
Remember the two sentences: a Type 1 error is a false alarm, and a Type 2 error is a miss. Decide which one costs more before you run the test, set alpha and your sample size to match, and never treat a not significant result as proof of nothing.