Confidence Intervals

Introduction

A confidence interval is a range of values we are fairly certain the true value lies in.

Suppose we want to find the average height of women in the U.S. In order to find out what the average height of women in the U.S. is, we would have to go and measure the height of every woman in the U.S. and average this, data. It would be very impractical (and expensive!) to go out and measure the height of every woman in the U.S. But, we can find an answer by getting a random sample of women in the U.S. and find the average height of the women in this sample. However, because we have not measured the height of every woman, we cannot be 100% certain that the average height we find with our sample is the average height of all women in the U.S. We therefore find a "confidence interval". That is, a range of values the true value is likely in (an interval) and a certain level of confidence in this interval.

Let's think back to how this connects to the central limit theorem (CLT). The average height of the women from the random sample is the sample mean discussed in the last section. According to the CLT, the sample mean is distributed approximately normally; more so of course if the sample size is large. We are able to calculate a confidence interval specifically because of this knowledge that the sample mean is distributed approximately normally. This is one reason why the CLT is so important!

To continue the discussion of confidence intervals, we turn to a more concrete example. Suppose we measure the height of 200 randomly chosen women and get an average height of 5.35 feet and a standard deviation of 0.75 feet. The 95% confidence interval (which will be explained below) is 5.35 ±\pm .1 feet. What this means is that the true average of the height of women in the U.S. (if we were to go and measure it) is likely to be between 5.25 and 5.45 feet. But, this interval might not include the true mean. The 95% means that if we repeat our experiment where we went out and measured the height of 200 randomly chosen women, 95% of these experiments will give us a confidence interval that includes the true mean. 5% will not include the true mean. There is a 5% chance our confidence interval does not include the true value.

In the graphic above, each blue bar represents a confidence interval found as the result of an experiment. 19 out of 20 of the confidence intervals include the true value. 95% of the experiments include the true value. 1 experiment, or 5% of them do not include the true value.

Note: There is a difference in saying that 95 out of 100 trials of confidence intervals contain the true value versus we are 95% sure that the true value is within the 95% confidence interval.

By the definition of a confidence interval, which should be wider a 99% confidence interval or a 95%? Why? Are there any cases in which that is not true? Hint: Think of populations where all the parameters would be the same value.

How to find a Confidence Interval

  1. Find the number of elements in a sample nn, find the sample meanXˉ\bar{X}, and find the sample standard deviation σˉ\bar{\sigma}.

  2. Decide what Confidence Interval we want. Then, find the "Z" value for that Confidence Interval:

Confidence Interval

Z

80%

1.282

85%

1.440

90%

1.645

95%

1.960

99%

2.576

99.5%

2.807

99.9%

3.291

3. Plug in these values to the Confidence Interval formula:

Xˉ±Zσˉn\bar{X} \pm Z\frac{\bar{\sigma}}{\sqrt{n}}

4. The interval is then ( XˉZσˉn,Xˉ+Zσˉn\bar{X} - Z\frac{\bar{\sigma}}{\sqrt{n}}, \bar{X} + Z\frac{\bar{\sigma}}{\sqrt{n}} ).

Note that as nn, the number of samples used to calculate the sample mean, increases, the width of the confidence interval decreases. Also, as σˉ\bar{\sigma} decreases, the width of the confidence interval decreases.

Having a wider confidence interval is not always better. Think about if we had an 100% confidence interval from the minimum of the data to the maximum of it, we would be 100% sure that the data falls within the bounds, but it would not tell us anything we did not know before!

Worked Example

Suppose we want to find the average age of people who go to see a new romantic comedy movie with 99% confidence. Thousands and thousands of people will go to see the movie, so we randomly choose just 87 movie-goers. We find n=87,Xˉ=26.7,σˉ=4.6n = 87, \bar{X} = 26.7, \bar{\sigma} = 4.6 . Since we want to know the average age with 99% confidence, we can look at the table and find Z=2.576.Z = 2.576. Plugging these values into our formula:

Xˉ±Zσˉn=26.7±2.7594.687=26.7±1.4\bar{X} \pm Z\frac{\bar{\sigma}}{\sqrt{n}} = 26.7 \pm \frac{2.759 \cdot 4.6}{\sqrt{87}} = 26.7 \pm 1.4

So we are 99% confident that the average age of people who go to see the new romantic comedy movie is between 25.3 and 28.1 years.

A 99% confidence interval between 25.3 and 28.1 does NOT mean that 99% of our population lies in that interval. As a sanity check, what does it mean? Is it possible that nearly everyone who watched a movie is within 3 years of each other?

Last updated