Everything You Always Wanted to Know About Confidence Intervals (But Were Afraid to Ask) in 2 Minutes!
Confidence intervals might be a frightening topic for somebody who is not stats-savvy. Thus, we’ll start with something as simple as plums.
Let’s say we want to figure out the typical weight of a plum. For simplicity, let’s assume that we know the standard deviation of all plums’ weights: σ=4 (grams). We’ll also assume that plum weights follow a normal distribution.
It is impossible to measure a weight of every single plum to calculate the true mean of plum weights (a.k.a. population mean). Thus, we’ll take 100 samples with 200 plums in each sample. We can visualize it as follows:
Horizontal axis specifies the mean weight of the sample. Mean weights are denoted by the dots on the chart. Vertical axis specifies sample (“experiment”) number (it doesn’t really matter, we can shuffle all samples). The whiskers that you can see on the chart specify the 95% confidence intervals.
Confidence interval is a range that would contain a true population statistic in a specified percentage of times (defined by confidence level) if we repeat an experiment infinitely many times. For sample means that were taken from normal distribution it is defined by the following formula:
- X̄ — is a sample mean
- Z is a Z score. It can be extracted from the standard normal table for a given confidence level. In our example, we use a 95% confidence level, which corresponds to Z-score = 1.96. Confidence level needs to be set in advance, as it controls the width of the confidence interval
- σ is a population standard deviation
- n is a number of plums in one sample (a.k.a. sample size)
Green line on the chart above specifies the true population mean (mean weight of all plums on the planet). As you can see, in 95 out of 100 experiments the 95% confidence intervals contain the true population mean. They are displayed in blue, and the remaining experiments are colored in red.