Confidence Intervals

A sample mean wobbles, and a confidence interval puts a fence around the wobble.

Before this Lesson

You break ten cylinders from a pour, and they average 4,720 psi. That's a fact about ten cylinders. What you need is a fact about the whole pour, and a different ten would have given you a different average. By the end of this Lesson, you can turn those ten breaks into "between 4,505 and 4,935 psi, with 95% confidence," and say exactly what that promises. It starts with how far an average can drift.

An average wobbles less than one value

Go back to the plant from The Normal Distribution, whose cylinders have μ=4,600\mu = 4{,}600 psi and σ=400\sigma = 400 psi. Pull one cylinder, and it can easily land at 4,200 or 5,000. Now pull four and average them. For the average to land at 4,200, the four have to run low together, and any one that runs high drags the average back up. Highs and lows partly cancel, so averages bunch around μ\mu more tightly than single values do.

How much more tightly? Add nn independent values and their variances add, so the sum has a standard deviation of σn\sigma\sqrt{n}. The sum itself grows like nn, but its wobble grows only like n\sqrt{n}, and that gap is the cancelling at work. Divide the sum by nn to get the mean, and its wobble is

σmean=σnn=σn\sigma_{\text{mean}} = \frac{\sigma\sqrt{n}}{n} = \frac{\sigma}{\sqrt{n}}

The Handbook lists this in its Dispersion, Mean, Median, and Mode Values section and just calls it a standard deviation. Everyone else calls it the standard error of the mean, and so will this Lesson. (The Handbook's "Standard Error of Estimate" belongs to regression and is something else.) The Handbook's Central Limit Theorem adds that for large nn, the mean is close to normal even when single values aren't. So the mean of nn values has its own normal curve, with the same center and a narrower width.

3,400 3,800 4,200 4,600 5,000 5,400 5,800 Strength (psi) mean of 16: 400/√16 = 100 mean of 4: 400/√4 = 200 one cylinder: σ = 400
One cylinder, the mean of 4, and the mean of 16, from the same plant

Every probability question about a single value now works for a mean, with one change: the ruler is σ/n\sigma/\sqrt{n} instead of σ\sigma. With xˉ\bar{x} for the sample's mean, the Handbook prints this form under Sample Size:

z=xˉ−μσ/nz = \frac{\bar{x} - \mu}{\sigma/\sqrt{n}}

Take a cutoff of 4,400 psi. One cylinder falls below it with z=−200/400=−0.5z = -200/400 = -0.5, so the chance is R(0.5)=0.3085R(0.5) = 0.3085, nearly one in three. The mean of 16 cylinders has a standard error of 400/16=100400/\sqrt{16} = 100 psi, so now z=−2.0z = -2.0 and the chance is R(2.0)=0.0228R(2.0) = 0.0228. One cylinder lands down there easily. Sixteen rarely conspire to.

Worked Example The mean of 25 rebar tests
1 of 3

Rebar yield strengths are normal, with a mean of 68 ksi and a standard deviation of 4 ksi. You test 25 bars. Find the probability that their mean falls between 67.2 and 69.6 ksi.

Turning the question around

So far you've known μ\mu and asked where xˉ\bar{x} lands. In the field it runs backward: you have one xˉ\bar{x}, and μ\mu is what you're after.

The table says W(1.96)=0.9500W(1.96) = 0.9500, so 95% of all sample means land within 1.96 standard errors of μ\mu. Now notice that a distance doesn't care which end you measure from. If xˉ\bar{x} is within 1.96 standard errors of μ\mu, then μ\mu is within 1.96 standard errors of xˉ\bar{x}. So put a fence 1.96 standard errors to each side of whatever xˉ\bar{x} you got. For 95% of samples, μ\mu is inside it.

That fence is a confidence interval. The Handbook's section on the Confidence Interval for the Mean μ of a Normal Distribution prints it for a known σ\sigma:

xˉ−zα/2σn≤μ≤xˉ+zα/2σn\bar{x} - z_{\alpha/2}\frac{\sigma}{\sqrt{n}} \le \mu \le \bar{x} + z_{\alpha/2}\frac{\sigma}{\sqrt{n}}

Read it as the sample mean, plus or minus a critical value times the standard error. The part after the plus or minus is the margin of error.

The α\alpha is the share of samples you agree to miss, so 95% confidence means α=0.05\alpha = 0.05. A two-sided fence can miss on either side, so the misses split between two tails, and each tail holds α/2\alpha/2. That's why the subscript is α/2\alpha/2.

z −zα/2 0 +zα/2 area = 1 − α area = α/2 area = α/2
A two-sided interval leaves α/2 in each tail

To find zα/2z_{\alpha/2}, find the row of the unit normal table where R=α/2R = \alpha/2, which is also where 2R=α2R = \alpha and W=1−αW = 1 - \alpha. The Handbook collects the usual answers in a short table of its own:

Critical values for a two-sided interval
Confidenceα\alphaα/2\alpha/2zα/2z_{\alpha/2}
90%0.100.051.6449
95%0.050.0251.9600
99%0.010.0052.5758

Adapted from the FE Reference Handbook, Values of Zα/2

Worked Example An interval from today's pour
1 of 3

A plant's long records give σ=200\sigma = 200 psi. Sixteen cylinders from today's pour average 4,250 psi. Find a 95% confidence interval on the pour's true mean.

What the 95% promises

The pour has one true mean. Nobody knows it, but it's a fixed number. What moves is the fence, since a different sample would have put it somewhere else. So the 95% can't be describing μ\mu. It describes the method: run it on sample after sample, and about 95% of the fences catch μ\mu.

true mean μ one sample, one interval misses μ
Twenty samples from one population, each with its own 95% interval

Think of a ring toss. The peg never moves, and the thrower lands 95% of the tosses. Any one ring is either on the peg or it isn't, and the 95% is a fact about the thrower.

What about a value outside your interval, like a claimed true mean of 4,100 psi against your 4,152 to 4,348? You can't prove it wrong, because yours might be one of the rare misses. But believing it means believing you drew one of those unlucky samples, so at the 95% level it isn't a plausible value for the true mean.

Checkpoint
1 of 2

A study reports a 90% confidence interval of 62.1 to 64.3 mph on the mean spot speed of a highway. Which statements are valid?

A.
About 90% of the cars on this highway travel between 62.1 and 64.3 mph
B.
If the study were repeated many times, about 90% of the resulting intervals would contain the true mean
C.
There is a 90% chance that the true mean lies between 62.1 and 64.3 mph
D.
The true mean is a fixed number, and this interval either contains it or doesn't

When σ is unknown too

Everything so far leaned on a known σ\sigma, the kind of number a plant gets from years of records. With ten cylinders from a new mix, all you have is the sample's own ss, so you swap it in. But ss is only an estimate, and it wobbles too. Some small samples happen to bunch together, their ss comes out too small, and the fence comes out too tight, missing μ\mu more than 5% of the time.

The fix is a bigger multiplier. William Gosset worked it out around 1908 at the Guinness brewery and published as "Student," which is why the Handbook's table is titled Student's t-Distribution. The tt curve is a bell with heavier tails, because it carries the extra uncertainty in ss. To leave the same area in a tail, you have to go farther out.

−5 −4 −3 −2 −1 0 1 2 3 4 5 z = 1.96 t = 2.776 each tail beyond its marker has area 0.025 unit normal t, 4 degrees of freedom
The unit normal curve and a t curve

The Handbook prints this interval right beside the first one, for when σ\sigma is not known:

xˉ−tα/2sn≤μ≤xˉ+tα/2sn\bar{x} - t_{\alpha/2}\frac{s}{\sqrt{n}} \le \mu \le \bar{x} + t_{\alpha/2}\frac{s}{\sqrt{n}}

Here tα/2t_{\alpha/2} has n−1n - 1 degrees of freedom, the same n−1n - 1 that divides inside ss. The table calls that number vv and runs it down the side. Across the top, α\alpha is the area in one tail, as the sketch on the Handbook's table shows, so a two-sided interval reads the column for α/2\alpha/2: the 0.025 column for 95%, and the 0.05 column for 90%.

Part of the t table, with tail area across the top
vv0.050.0250.005
42.1322.7764.604
52.0152.5714.032
61.9432.4473.707
91.8332.2623.250
291.6992.0452.756
∞1.6451.9602.576

Adapted from the FE Reference Handbook, Student's t-Distribution

Watch the highlighted column fall toward 1.960. With more data, ss is a better estimate of σ\sigma, the extra caution fades, and in the last row tt has become zz.

Worked Example Ten cylinders from a pour
1 of 3

Ten cylinders from a pour break at 4,620, 5,070, 4,400, 4,750, 4,960, 4,240, 4,660, 5,210, 4,520, and 4,770 psi. Taking strengths as normal, find a 95% confidence interval on the pour's true mean.

What sets the width

The full width of an interval is twice its margin of error:

width=2 zα/2σn\text{width} = 2\, z_{\alpha/2}\frac{\sigma}{\sqrt{n}}

Three things on the right can move.

  • Confidence level. To catch μ\mu more often you need a wider net, so higher confidence means a larger zα/2z_{\alpha/2} and a wider interval. Being surer costs you precision.
  • Spread. Width grows in direct proportion to σ\sigma, so a steadier process gives a tighter interval.
  • Sample size. Width shrinks with n\sqrt{n}, not nn, so cutting it in half takes four times the samples.
sample mean = 4,250 Starting point: 95%, σ = 200, n = 16: ±98 Confidence up to 99%: ±129 σ doubled to 400: ±196 n quadrupled to 64: ±49 4,000 4,100 4,200 4,300 4,400 4,500 Strength (psi)
One sample mean, with one thing changed at a time

The critical value itself depends on one more question, which is about σ\sigma and not about nn. If σ\sigma is known or stated, use zz, however small the sample. If σ\sigma has to be computed from the sample, use tt, which is how the Handbook's Test Statistics section puts it too. With a large sample, the two nearly agree: 2.045 against 1.960 at v=29v = 29. Some textbooks switch to zz around n=30n = 30, but the Handbook prints no cutoff.

Checkpoint
1 of 3

A lab doubles its sample from 25 to 50 cylinders, with the same confidence level and standard deviation. By what factor does the interval's width change?

A.
0.25
B.
0.50
C.
0.71
D.
1.41

How many samples you need

Often the margin comes first: pin down the mean within 50 psi, at 95% confidence. Write the margin as E=zα/2 σ/nE = z_{\alpha/2}\,\sigma/\sqrt{n}, and the only thing left to choose is nn. Solve for it:

n=(zα/2 σE)2n = \left(\frac{z_{\alpha/2}\,\sigma}{E}\right)^2

The Handbook's Sample Size section prints this same equation with xˉ−μ\bar{x} - \mu in place of EE, since the margin is how far xˉ\bar{x} may land from μ\mu. The answer rarely comes out whole, and you can't test a fraction of a cylinder. The Handbook has no rounding rule, but the logic forces one: a smaller nn misses the target, so round up, even from a value barely past a whole number.

Worked Example How many cylinders
1 of 3

A plant's cylinder strengths have a known standard deviation of 200 psi. How many cylinders must it test to estimate the mean within 50 psi at 95% confidence?

Recap

  • The mean of nn values has its own normal curve, with the same center and a standard error of σ/n\sigma/\sqrt{n}, which replaces σ\sigma in zz.
  • A confidence interval is the sample mean plus or minus a critical value times the standard error. Two sides means α/2\alpha/2 in each tail.
  • With σ\sigma known, use zz. With σ\sigma computed from a small sample, use ss and tt at v=n−1v = n - 1, whose heavier tails widen the interval.
  • The true mean is fixed and the interval moves. The confidence level is how often the method catches the mean, and a value outside isn't plausible at that level.
  • Width grows with confidence and σ\sigma and shrinks with n\sqrt{n}, so half the width takes four times the samples. For a target margin, n=(zα/2σ/E)2n = (z_{\alpha/2}\sigma/E)^2, rounded up.