StatisticsConfidence Intervals5 of 6
Confidence Intervals · 5

Confidence Interval for a Population Mean

We want to estimate an unknown population mean μ\truth{\mu} from a sample mean xˉ\stat{\bar{x}}, and because every random sample gives a slightly different average, we need an interval around xˉ\stat{\bar{x}} wide enough to capture μ\truth{\mu}.

1

How a Sample Mean Captures the True Average

Suppose a factory produces one million smartphones, and a random sample of n=36n = 36 phones has an average battery life of xˉ=14.0 hours\stat{\bar{x}} = \stat{14.0}\text{ hours}. How far left and right of 14.0 hours\stat{14.0}\text{ hours} do we need to reach so that our interval catches the true population average μ\truth{\mu} 95%\share{95\%} of the time?

How a Sample Mean Captures the True Average
1,000,0001{,}000{,}000
phones\text{phones}
True Average\htmlClass{lc-violet}{\text{True Average}}
μ=?\htmlClass{lc-violet}{\mu = {?}}
12.5\htmlClass{lc-mute}{12.5}
13.0\htmlClass{lc-mute}{13.0}
13.5\htmlClass{lc-mute}{13.5}
14.0\htmlClass{lc-mute}{14.0}
14.5\htmlClass{lc-mute}{14.5}
15.0\htmlClass{lc-mute}{15.0}
15.5\htmlClass{lc-mute}{15.5}
hours\htmlClass{lc-mute}{\text{hours}}

Whenever xˉ\stat{\bar{x}} lands inside the middle 95%\share{95\%} of the sampling distribution around μ\truth{\mu}, an interval of that same half-width centered at xˉ\stat{\bar{x}} reaches back and covers μ\truth{\mu}. Whenever xˉ\stat{\bar{x}} lands out in either tail, its interval falls short and misses μ\truth{\mu}.

Every sample mean inside the middle 95% around μ\truth{\mu} builds an interval that reaches back and includes μ\truth{\mu}.
2

Building a tt-Interval for a Population Mean

Now we want to find that reach in hours, called the margin of error, around xˉ=14.0 hours\stat{\bar{x}} = \stat{14.0}\text{ hours}. We only know the sample standard deviation s=1.8 hours\spread{s} = \spread{1.8}\text{ hours} of our n=36n = 36 phones, not the true population standard deviation σ\spread{\sigma} of all one million phones.

Building a t-Interval for a Population Mean
n=36 phonesn = 36\text{ phones}
95%\htmlClass{lc-green}{95\%}
± ?\htmlClass{lc-pink}{\pm\ {?}}
12.5\htmlClass{lc-mute}{12.5}
13.0\htmlClass{lc-mute}{13.0}
13.5\htmlClass{lc-mute}{13.5}
14.5\htmlClass{lc-mute}{14.5}
15.0\htmlClass{lc-mute}{15.0}
15.5\htmlClass{lc-mute}{15.5}
hours\htmlClass{lc-mute}{\text{hours}}
xˉ=14.0\htmlClass{lc-blue}{\bar{x} = 14.0}

To build a confidence interval for μ\truth{\mu} from a sample of size nn, we start at xˉ\stat{\bar{x}} and reach out t∗\steps{t^*} standard errors using n−1n - 1 degrees of freedom:

xˉ±t∗(sn⏟standard error)⏟margin of errorwith df=n−1\displaystyle \stat{\bar{x}} \pm \underbrace{\steps{t^*} \left(\underbrace{\spread{\frac{s}{\sqrt{n}}}}_{\text{standard error}}\right)}_{\text{margin of error}} \quad \text{with } {df = n - 1}

(On a test, tables often list rows for both nn and n−1n - 1 alongside the normal curve's 1.96\steps{1.96}, so always subtract 11 from the sample size first to pick the row for df=n−1df = n - 1.)

Text solution
Find one standard error from s\spread{s} and nnDivide the sample standard deviation s=1.8 hours\spread{s} = \spread{1.8}\text{ hours} by 36\sqrt{36} to measure how much a 36-phone sample mean typically varies from sample to sample:
Standard Error\displaystyle \text{Standard Error} =sn\displaystyle = \spread{\frac{s}{\sqrt{n}}} =1.836\displaystyle = \frac{\spread{1.8}}{\sqrt{36}} =1.86\displaystyle = \frac{\spread{1.8}}{6} =0.3 hours\displaystyle = \spread{0.3}\text{ hours}
Look up t∗\steps{t^*} at df=n−1df = n - 1 and multiply for the margin of errorWith df=36−1=35df = 36 - 1 = 35 degrees of freedom, 95%\share{95\%} confidence takes t∗=2.03\steps{t^*} = \steps{2.03} standard errors of 0.3 hours\spread{0.3}\text{ hours} each:
Margin of Error\displaystyle \text{Margin of Error} =t∗(sn)\displaystyle = \steps{t^*} \left(\spread{\frac{s}{\sqrt{n}}}\right) =2.03×0.3≈0.61 hours\displaystyle = \steps{2.03} \times \spread{0.3} \approx \spread{0.61}\text{ hours}
Reach left and right from xˉ\stat{\bar{x}}Subtract and add the 0.61-hour\spread{0.61}\text{-hour} margin of error around xˉ=14.0 hours\stat{\bar{x}} = \stat{14.0}\text{ hours}:
14.0±0.61\displaystyle \stat{14.0} \pm \spread{0.61} =[13.39 hours,14.61 hours]\displaystyle = [13.39\text{ hours}, 14.61\text{ hours}]

So our 95%\share{95\%} confidence interval for the mean battery life is [13.39 hours,14.61 hours][13.39\text{ hours}, 14.61\text{ hours}].

3

Three Conditions for a tt-Interval

We can plug any numbers into xˉ±t∗(sn)\stat{\bar{x}} \pm \steps{t^*}\left(\spread{\frac{s}{\sqrt{n}}}\right), but the resulting interval only captures μ\truth{\mu} at the 95%\share{95\%} rate if three conditions hold: the sampling distribution of xˉ\stat{\bar{x}} must be centered at μ\truth{\mu}, have standard deviation σn\spread{\frac{\sigma}{\sqrt{n}}} (which our standard error sn\spread{\frac{s}{\sqrt{n}}} estimates), and follow a bell-shaped curve.

Three Conditions for a t-Interval
11
Random\text{Random}
22
10%10\%
33
Normal / Large Sample\text{Normal / Large Sample}
True Average\htmlClass{lc-violet}{\text{True Average}}
μ=?\htmlClass{lc-violet}{\mu = {?}}
95%\htmlClass{lc-green}{95\%}
12.5\htmlClass{lc-mute}{12.5}
13.3913.39
14.6114.61
15.5\htmlClass{lc-mute}{15.5}
hours\htmlClass{lc-mute}{\text{hours}}
xˉ=14.0\htmlClass{lc-blue}{\bar{x} = 14.0}

If the population is skewed, the sampling distribution of xˉ\stat{\bar{x}} for a small sample (n=10n = 10) stays skewed and doesn't match the symmetric tt-curve. Averaging a large sample (n=36n = 36) smooths out the skew so the tt-curve still fits the tails.

Skewing the population makes small sample averages too lopsided for the symmetric t-curve, while a large sample smooths the skew out.

When n<30n < 30, the Central Limit Theorem cannot smooth out a skewed population for us, so we plot the sample itself to check that it looks roughly symmetric with no strong outliers before trusting a tt-interval:

Roughly symmetric, no outliers\text{Roughly symmetric, no outliers}
t-interval validt\text{-interval valid}
0\htmlClass{lc-mute}{0}
2\htmlClass{lc-mute}{2}
4\htmlClass{lc-mute}{4}
6\htmlClass{lc-mute}{6}
8\htmlClass{lc-mute}{8}
10\htmlClass{lc-mute}{10}
12\htmlClass{lc-mute}{12}
14\htmlClass{lc-mute}{14}
16\htmlClass{lc-mute}{16}
Strong outlier at 2 hours\text{Strong outlier at }\htmlClass{lc-orange}{2}\text{ hours}
t-interval invalidt\text{-interval invalid}
0\htmlClass{lc-mute}{0}
2\htmlClass{lc-mute}{2}
4\htmlClass{lc-mute}{4}
6\htmlClass{lc-mute}{6}
8\htmlClass{lc-mute}{8}
10\htmlClass{lc-mute}{10}
12\htmlClass{lc-mute}{12}
14\htmlClass{lc-mute}{14}
16\htmlClass{lc-mute}{16}
battery life (hours)\htmlClass{lc-mute}{\text{battery life (hours)}}
4

Interpreting the Interval and Testing Claims

Once our 36-phone sample passes all three checks, we want to state what the interval [13.39 hours,14.61 hours][13.39\text{ hours}, 14.61\text{ hours}] tells us about the true average μ\truth{\mu} and use it to decide whether a claimed battery life is believable.

Interpreting the Interval and Testing Claims
Average Battery Life:\text{Average Battery Life:}
15 Hours!\htmlClass{lc-violet}{15}\text{ Hours!}
μ=?\htmlClass{lc-violet}{\mu = {?}}
12.5\htmlClass{lc-mute}{12.5}
13.3913.39
14.6114.61
15.5\htmlClass{lc-mute}{15.5}
hours\htmlClass{lc-mute}{\text{hours}}
xˉ=14.0\htmlClass{lc-blue}{\bar{x} = 14.0}

We are 95%\share{95\%} confident that the true mean battery life μ\truth{\mu} of all one million phones from this factory line is between 13.39 hours13.39\text{ hours} and 14.61 hours14.61\text{ hours}. Any claim inside that interval (such as 14.5 hours\truth{14.5}\text{ hours}) is a plausible value for μ\truth{\mu}, while any claim outside it (such as 15.0 hours\truth{15.0}\text{ hours}) is not supported by the data.

(On a test, avoid two common wording traps: never say there is a "95%95\% probability" that μ\truth{\mu} is in [13.39,14.61][13.39, 14.61], because both μ\truth{\mu} and those endpoints are fixed numbers and 95%\share{95\%} is the long-run success rate of the sampling method; and never say "95%95\% of individual phones" fall in the interval, because the interval estimates the single population average μ\truth{\mu}, not the spread of individual phones.)

Key concepts

Before building a tt-interval for an unknown population mean μ\truth{\mu}, check that the sample is Random (so xˉ\stat{\bar{x}} is centered at μ\truth{\mu}, unlike grabbing 3636 phones off Monday morning's pallet), takes less than 10%10\% of the population when sampling without replacement (such as 36<10%36 < 10\% of 1,000,0001,000,000, so sn\spread{\frac{s}{\sqrt{n}}} holds), and satisfies the Normal / Large Sample check. If n≥30n \ge 30 (n=36n = 36), the Central Limit Theorem keeps the sampling distribution of xˉ\stat{\bar{x}} approximately normal even if the population is skewed; if n<30n < 30 (n=10n = 10), do not use the tt-interval if a graph of the sample shows strong skewness or outliers (like one phone dying at 2 hours\outlier{2}\text{ hours} while nine last near 14 hours14\text{ hours}).

When all three conditions pass, build the interval around xˉ\stat{\bar{x}} using df=n−1df = n - 1:

xˉ±t∗(sn)\displaystyle \stat{\bar{x}} \pm \steps{t^*} \left(\spread{\frac{s}{\sqrt{n}}}\right)

For n=36n = 36 phones with xˉ=14.0 hours\stat{\bar{x}} = \stat{14.0}\text{ hours} and s=1.8 hours\spread{s} = \spread{1.8}\text{ hours} at 95%\share{95\%} confidence (df=35df = 35, t∗=2.03\steps{t^*} = \steps{2.03}), one standard error is 1.836=0.3 hours\frac{\spread{1.8}}{\sqrt{36}} = \spread{0.3}\text{ hours} and the margin of error is 2.03×0.3≈0.61 hours\steps{2.03} \times \spread{0.3} \approx \spread{0.61}\text{ hours}, giving [13.39 hours,14.61 hours][13.39\text{ hours}, 14.61\text{ hours}]. We are 95%\share{95\%} confident this interval captures the fixed true mean μ\truth{\mu}, so a claimed mean of 14.5 hours\truth{14.5}\text{ hours} inside the interval is plausible, while 15.0 hours\truth{15.0}\text{ hours} outside it is not.

5

Practice

1

A quality-control engineer tests a random sample of n=16n = 16 laptop batteries from a large factory production run and finds a sample mean life of xˉ=9.4 hours\stat{\bar{x}} = \stat{9.4}\text{ hours} with a sample standard deviation of s=1.2 hours\spread{s} = \spread{1.2}\text{ hours}. For 95%\share{95\%} confidence, a table gives t∗=2.13\steps{t^*} = \steps{2.13} for df=15df = 15, t∗=2.12\steps{t^*} = \steps{2.12} for df=16df = 16, and 1.96\steps{1.96} for a standard normal curve. Find the standard error, the margin of error, and the 95%\share{95\%} confidence interval for the true mean battery life.

How many degrees of freedom does a sample of size n=16n = 16 have when you estimate the standard deviation with s\spread{s}?

Divide s\spread{s} by n\sqrt{n} to find the standard error (watch out for dividing by 1616 instead of 16=4\sqrt{16} = 4, which gives the wrong standard error 0.075 hours0.075\text{ hours}):
Standard Error\displaystyle \text{Standard Error} =sn\displaystyle = \spread{\frac{s}{\sqrt{n}}} =1.216\displaystyle = \frac{\spread{1.2}}{\sqrt{16}} =1.24\displaystyle = \frac{\spread{1.2}}{4} =0.3 hours\displaystyle = \spread{0.3}\text{ hours}
With n=16n = 16, the degrees of freedom are df=16−1=15df = 16 - 1 = 15, so t∗=2.13\steps{t^*} = \steps{2.13} (using df=16df = 16 picks t∗=2.12t^* = 2.12 and gives [8.764,10.036][8.764, 10.036], while using the normal curve's 1.961.96 gives [8.812,9.988][8.812, 9.988]):
Margin of Error\displaystyle \text{Margin of Error} =2.13×0.3\displaystyle = \steps{2.13} \times \spread{0.3} =0.639 hours\displaystyle = \spread{0.639}\text{ hours}
9.4±0.639\displaystyle \stat{9.4} \pm \spread{0.639} =[8.761 hours,10.039 hours]\displaystyle = [8.761\text{ hours}, 10.039\text{ hours}]
2

Based on a random sample of n=25n = 25 bags of coffee from a large roasting plant, a food scientist reports a 95%\share{95\%} confidence interval for the true mean weight as [337.93 grams,[337.93\text{ grams}, 342.07 grams]342.07\text{ grams}]. Using t∗=2.06\steps{t^*} = \steps{2.06} for df=24df = 24, find the sample mean xˉ\stat{\bar{x}}, the margin of error, and the sample standard deviation s\spread{s}, and determine whether the roaster's claim of a 343-gram\truth{343}\text{-gram} true average is plausible.

Where does xˉ\stat{\bar{x}} sit inside [337.93,342.07][337.93, 342.07], and how many margins of error wide is the entire interval from end to end?

The sample mean xˉ\stat{\bar{x}} is the midpoint of the interval:
xˉ\displaystyle \stat{\bar{x}} =337.93+342.072\displaystyle = \frac{337.93 + 342.07}{2} =340.0 grams\displaystyle = \stat{340.0}\text{ grams}
The margin of error is the distance from the center xˉ\stat{\bar{x}} to either endpoint (subtracting the endpoints directly gives 342.07−337.93=4.14 grams342.07 - 337.93 = 4.14\text{ grams}, which is the full width of two margins of error and doubles s\spread{s} to 10.05 grams10.05\text{ grams}):
Margin of Error\displaystyle \text{Margin of Error} =342.07−340.0\displaystyle = 342.07 - \stat{340.0} =2.07 grams\displaystyle = \spread{2.07}\text{ grams}
Since 2.07=2.06×(s25)\spread{2.07} = \steps{2.06} \times \left(\frac{\spread{s}}{\sqrt{25}}\right), divide by 2.06\steps{2.06} to get the standard error 2.072.06≈1.005 grams\frac{\spread{2.07}}{\steps{2.06}} \approx \spread{1.005}\text{ grams}, then multiply by 25=5\sqrt{25} = 5 (don't stop at 1.005 grams1.005\text{ grams} or multiply by 2525 to get 25.12 grams25.12\text{ grams}):
s≈1.005×5≈5.02 grams\displaystyle \spread{s} \approx \spread{1.005} \times 5 \approx \spread{5.02}\text{ grams}
Because 343 grams\truth{343}\text{ grams} falls outside [337.93 grams,342.07 grams][337.93\text{ grams}, 342.07\text{ grams}], 343 grams\truth{343}\text{ grams} is not a plausible value for the true mean weight.
3

For each study below, state whether it is valid to construct a tt-interval for the population mean and explain which condition passes or fails: (a) A biologist weighs all 1515 kakapo parrots picked at random from an island population of 8080 parrots; a dotplot of the 1515 weights is roughly symmetric with no outliers. (b) An analyst takes a random sample of 4545 orders from a database of 500,000500,000 online orders; a histogram of the 4545 order totals is noticeably right-skewed. (c) A materials lab tests a random sample of 1010 steel cables from a warehouse of 20,00020,000 cables; nine cables break near 1,200 pounds1,200\text{ pounds}, and one breaks at 410 pounds410\text{ pounds}.

Check all three conditions (Random, 10%10\%, and Normal / Large Sample) in each case, and check whether nn is at least 3030 before ruling out a skewed sample graph.

(a) Invalid: Even though the dotplot is symmetric with no outliers (a common slip is stopping there and calling it valid), it fails the 10%10\% condition because 1515 is more than 10%10\% of the population of 8080 parrots (15>815 > 8), so sampling without replacement is not independent enough for sn\spread{\frac{s}{\sqrt{n}}} to hold. (b) Valid: The sample is random, 4545 is less than 10%10\% of 500,000500,000, and because n=45≥30n = 45 \ge 30, the Central Limit Theorem makes the sampling distribution of xˉ\stat{\bar{x}} approximately normal despite the skewed sample histogram (the common slip is rejecting it because of the right-skewed sample graph, which only makes the interval invalid when n<30n < 30). (c) Invalid: It fails the Normal / Large Sample condition because n=10<30n = 10 < 30 and the sample has a strong outlier at 410 pounds\outlier{410}\text{ pounds}, showing the population is not close enough to normal (using t∗\steps{t^*} with df=9df = 9 only adjusts for an uncertain s\spread{s}, not a skewed distribution).
4

Returning to the 95%\share{95\%} confidence interval [13.39 hours,14.61 hours][13.39\text{ hours}, 14.61\text{ hours}] for the mean battery life of all one million phones, explain what is wrong with each statement below and write a correct interpretation of the interval: (a) "There is a 95%95\% probability that the true mean battery life μ\truth{\mu} is between 13.3913.39 and 14.61 hours14.61\text{ hours}." (b) "95%95\% of all one million phones in the factory have battery lives between 13.3913.39 and 14.61 hours14.61\text{ hours}."

Does the true mean μ\truth{\mu} move around randomly after the phones are built, and does this interval estimate individual phones or the average of all phones?

(a) is wrong because both the true mean μ\truth{\mu} of the one million phones and the endpoints 13.3913.39 and 14.6114.61 are fixed numbers, so μ\truth{\mu} is either inside the interval (100%100\% probability) or outside it (0%0\% probability); 95%\share{95\%} refers to the long-run success rate of the sampling method across all possible random samples. (b) is wrong because a confidence interval estimates the single population mean μ\truth{\mu}, not the battery lives of individual phones. Correct interpretation (be careful to say "true mean" rather than "sample mean," since xˉ=14.0\stat{\bar{x}} = \stat{14.0} is already guaranteed to sit in the middle of its own interval): We are 95%\share{95\%} confident that the true mean battery life of all one million phones from this factory line is between 13.3913.39 and 14.61 hours14.61\text{ hours}.
5

A researcher first tests a random sample of n=5n = 5 phones from a normal population and gets s=1.8 hours\spread{s} = \spread{1.8}\text{ hours} (with t∗=2.78\steps{t^*} = \steps{2.78} for 95%\share{95\%} confidence at df=4df = 4). She then tests a second random sample of n=36n = 36 phones and again gets s=1.8 hours\spread{s} = \spread{1.8}\text{ hours} (with t∗=2.03\steps{t^*} = \steps{2.03} at df=35df = 35). By what factor does her margin of error shrink from the first sample to the second, and what two distinct changes in the formula xˉ±t∗(sn)\stat{\bar{x}} \pm \steps{t^*}\left(\spread{\tfrac{s}{\sqrt{n}}}\right) cause this reduction?

Compare both parts of t∗(sn)\steps{t^*}\left(\spread{\frac{s}{\sqrt{n}}}\right) between n=5n = 5 and n=36n = 36: how much does the standard error sn\spread{\frac{s}{\sqrt{n}}} shrink, and how much does the multiplier t∗\steps{t^*} shrink?

Calculate the margin of error for each sample:
For n=5:2.78×(1.85)≈2.238 hoursFor n=36:2.03×(1.836)=0.609 hours\displaystyle \begin{aligned} \text{For } n = 5: &\quad \steps{2.78} \times \left(\frac{\spread{1.8}}{\sqrt{5}}\right) \\ &\quad \approx \spread{2.238}\text{ hours} \\[6pt] \text{For } n = 36: &\quad \steps{2.03} \times \left(\frac{\spread{1.8}}{\sqrt{36}}\right) \\ &\quad = \spread{0.609}\text{ hours} \end{aligned}
The margin of error shrinks by a factor of 2.2380.609≈3.67\frac{\spread{2.238}}{\spread{0.609}} \approx 3.67 (a common slip is looking only at 365≈2.68\frac{\sqrt{36}}{\sqrt{5}} \approx 2.68 and forgetting that t∗\steps{t^*} also drops, or dividing 365=7.2\frac{36}{5} = 7.2 without the square root). Two distinct changes cause this 3.673.67-fold reduction: first, averaging 3636 phones instead of 55 shrinks the standard error sn\spread{\frac{s}{\sqrt{n}}} by a factor of 365≈2.68\frac{\sqrt{36}}{\sqrt{5}} \approx 2.68; second, having a more reliable sample standard deviation s\spread{s} with 3535 degrees of freedom instead of 44 reduces t∗\steps{t^*} from 2.78\steps{2.78} down to 2.03\steps{2.03}.