Before you start
You will be able to
- Explain a confidence interval as an estimate plus or minus a margin of error, and interpret a 95% confidence level correctly.
- Calculate a z interval for a mean when σ is known and a t interval when it isn’t, by hand and with CONFIDENCE.NORM, CONFIDENCE.T and T.INV.2T.
- Explain why the t distribution is used when σ is estimated, and how its degrees of freedom change it.
- Calculate an interval for a proportion, check its conditions, and recognise when the Wilson interval is the better choice.
- Describe how the confidence level, the spread and the sample size change the margin of error, and calculate the sample size a margin needs for a mean or a proportion.
- Identify what an interval doesn’t cover: bias from non-response or from a non-random sample, and the spread of individual values.
Review first
- Sampling distributions — An interval is built from the sampling distribution and its standard error.
- The normal distribution — The z values 1.645, 1.96 and 2.576 and NORM.S.INV come from the standard normal distribution.
- Descriptive statistics and regression in Excel — The ToolPak’s Confidence Level line, which this lesson explains, was met there.
Fictional case A fictional coffee business founded by Ana Lim. It starts as a catering and barista-training service, opens its own cafés and an online shop for beans, and plans a canned cold brew.
The idea
Fictional case
Clients keep asking Ana how long Lantern needs to set up before a catering event. She drew 24 of the autumn’s bookings at random and timed their set-ups: a mean of 37.9 minutes, with a standard deviation of 8.2. She also owes Kilnworth a figure for its bags, and a summary of September’s survey. Each time the question is the same: the sample gave a number, so what does it say about the whole?
An estimate and its margin
The sample mean, 37.875 minutes, is a point estimate of Lantern’s long-run mean set-up time: the average its set-up process produces, event after event. It is almost certainly not exactly right: another 24 events would have given another mean. A confidence interval adds a range that reflects that uncertainty: the estimate plus or minus a margin of error. The margin is a multiplier times the standard error, and the multiplier depends on the confidence level, the share of samples in which the method captures the true value.
Why it works: the previous lesson showed that 95% of sample means fall within 1.96 standard errors of μ. So for 95% of samples, μ is within 1.96 standard errors of , and the interval captures it.
When σ is known: the z interval
Kilnworth’s specification gives the machine’s standard deviation, 3 g. If Ana trusts it, the standard error of her 40 bags’ mean is g and the 95% margin is g. The interval runs from to 1003.68 g. Excel gives the margin directly: =CONFIDENCE.NORM(0.05,3,40) returns 0.9297.
When σ is unknown: the t interval
Nobody specified the spread of set-up times, so Ana must estimate it with the sample’s s = 8.22 minutes. That adds a second source of uncertainty: s itself varies from sample to sample, and a small sample can understate the spread. The ratio therefore varies more than z does. If the population is normal, it follows the t distribution with degrees of freedom, worked out by William Gosset of the Guinness brewery in Dublin and published under a pen name, which is why it is often called Student’s t.
The t distribution looks like the standard normal but with heavier tails, so its multiplier is larger. With 23 degrees of freedom, =T.INV.2T(0.05,23) returns 2.069, against 1.96 for z. Ana’s interval: standard error , margin , interval 34.4 to 41.3 minutes. =CONFIDENCE.T(0.05,STDEV.S(A2:A25),COUNT(A2:A25)) returns the same margin.
What “95% confident” means
The 95% describes the method, not this interval. If Ana repeated her sampling many times, drawing 24 events and building an interval each time, about 95% of the intervals would contain the true mean set-up time; the NIST/SEMATECH handbook puts it as “in the long run”. Her one interval, 34.4 to 41.3 minutes, either contains the true mean or doesn’t, and she can’t tell which. “We are 95% confident” is shorthand for “this interval came from a method that works 95% of the time”, not a 95% probability about this particular range.
An interval for a proportion
In September 61 of the 79 customers who replied would recommend Lantern: . Its standard error, , gives a 95% margin of , about 9 percentage points: 68.0% to 86.5%. The interval rests on the normal model for , which needs enough of each answer: 61 yes and 18 no, both at least 10.
That interval covers one thing only: the luck of which customers happened to reply. Only 79 of the 240 customers invited replied (32.9%). If customers who like Lantern were keener to answer, the true share among all customers could lie below the whole interval, and no formula here can detect it. What Ana can say is that among customers like those who replied, 68% to 86% would recommend Lantern. (The 240 invited were all of September’s customers, so the 79 are a third of that month’s population; the interval is meant for customers like them in general, which is why no finite population correction is applied.)
In depth
One recipe, three intervals
| Parameter | When | Interval | Excel margin |
|---|---|---|---|
| Mean μ | σ known | x̄ ± z × σ ÷ √n | =CONFIDENCE.NORM(alpha,sigma,n) |
| Mean μ | σ unknown, estimated by s | x̄ ± t × s ÷ √n, df = n − 1 | =CONFIDENCE.T(alpha,s,n) |
| Proportion p | At least 10 of each outcome | p̂ ± z × √(p̂(1 − p̂) ÷ n) | =NORM.S.INV(1-alpha/2)*SQRT(p*(1-p)/n) |
The multiplier is the or value that leaves in each tail: 1.645, 1.96 and 2.576 for 90%, 95% and 99% with z; NORM.S.INV(1 − α/2) in Excel. Microsoft’s functions take alpha, the significance level, rather than the confidence level: for a 95% interval, alpha is 0.05.
The t distribution
OpenStax lists its properties: like the standard normal it is symmetric about 0, but it has more probability in its tails, and as the degrees of freedom grow it becomes more like the standard normal. The table shows the multiplier for 95% intervals. With 23 degrees of freedom, using 1.96 instead of 2.069 would leave =T.DIST.2T(1.96,23) = 6.2% outside, not 5%: the intervals would be too narrow and capture μ less often than they claim. Some texts, OpenStax’s section 8.1 among them, use z with s once n is 30 or more. The t multiplier is the exact one when σ is estimated, it is what CONFIDENCE.T and the ToolPak use, and for n of 30 or more the two multipliers differ by less than 0.1 (2.045 against 1.960 at n = 30).
| Degrees of freedom | 5 | 10 | 23 | 39 | 100 | 1,000 | z |
|---|---|---|---|---|---|---|---|
| Multiplier | 2.571 | 2.228 | 2.069 | 2.023 | 1.984 | 1.962 | 1.960 |
The t interval assumes a random sample of independent values from a population that is roughly normal. It is robust to mild skew, and more so as n grows, but not to strong skew or extreme outliers. Check a dot plot or histogram first. Ana’s set-up times run from 22 to 50 minutes with no outliers; the mean (37.9) is a little below the median (40.5) and SKEW is −0.62, a mild left skew that 24 values can carry. The interval treats the times as draws from Lantern’s set-up process, which is what matters for future events; for the autumn’s own bookings alone, with 24 a large share of them, the finite population correction would narrow it.
Lantern’s spring orders show the failure. Draw 30 orders at random from the 231 and build a 95% t interval: in a seeded simulation of 20,000 samples, only about 70% of the intervals contained the population mean of $39.38. Seven samples in eight miss the $1,512 office order; their means centre on about $33 with a small s, and about a third of their intervals lie wholly below $39.38, while every sample that includes the order captures it. A larger sample doesn’t help at first: at n = 100 the capture rate falls to about 58%, because samples that miss the order now give narrower intervals around $33. It nears 95% only with samples in the thousands, as Cochran’s rule predicts.
The Explore widget of t intervals for the mean order value repeats the experiment. The 95% is a property of the method under its conditions, not a guarantee: with skewed data, check the conditions, use a far larger sample, or describe the data with the median and percentiles instead.
Excel’s interval functions
- CONFIDENCE.NORM(alpha, standard_dev, size) returns the margin of a z interval, the half-width, not the interval: Microsoft’s example gives 0.692952, so a mean of 30 minutes becomes 30 ± 0.69. Add and subtract it yourself.
- CONFIDENCE.T(alpha, standard_dev, size) returns the margin of a t interval with size − 1 degrees of freedom. Microsoft’s page describes standard_dev as the population standard deviation, “assumed to be known”, but the function uses the t distribution, which is for an estimated one: pass STDEV.S of the sample. That is exactly the ToolPak’s Confidence Level line. A size of 1 returns #DIV/0!.
- T.INV.2T(probability, deg_freedom) returns the t with that probability in the two tails together: T.INV.2T(0.05, 23) = 2.069. T.INV(0.975, 23), the left-tailed inverse, gives the same number. For a z multiplier use NORM.S.INV(0.975).
- Both CONFIDENCE functions return #NUM! for an alpha of 0 or less or of 1 or more, and truncate a size that isn’t a whole number.
Kilnworth’s bags, with the sample’s own s = 2.66 g instead of the specified 3 g: =CONFIDENCE.T(0.05,STDEV.S(A2:A41),40) returns 0.8495, so the t interval is 1001.90 to 1003.60 g. Either interval lies wholly below the 1,004 g setting, a hint that the machine may be running low; Module 3 shows how an interval and a two-sided test say the same thing.
Intervals for a proportion: Wald and Wilson
The interval is called the Wald interval. Its usual condition is at least 10 successes and 10 failures in the sample, as in OpenIntro Statistics; OpenStax’s Introductory Statistics accepts more than 5 of each. Agresti and Coull (2001) note that the Wald interval behaves poorly even for quite large n, and that the Wilson interval performs well even for small n. The Wilson interval is centred a little towards 0.5 and never strays outside 0 to 1.
For the survey the two barely differ: Wilson gives 66.8% to 85.1%, centred on 76.0%, against Wald’s 68.0% to 86.5%. With few successes they part company. Suppose (a fictional case) 3 of 40 orders draw a complaint: Wald gives -0.7% to 15.7%, a lower limit below zero; Wilson gives 2.6% to 19.9%. Excel has no Wilson function; build it from NORM.S.INV with the formula card. When a sample has fewer than 10 of either outcome, report the Wilson interval.
What changes the margin of error
Three things set the margin: the confidence level (through the multiplier), the spread of the data (σ or s) and the sample size (through √n). For Ana’s set-up times the margin is ±2.87 minutes at 90%, ±3.47 at 95% and ±4.71 at 99%: more confidence costs width. A sample four times as large would roughly halve each margin. The spread is the one she can’t choose, though a better-defined measurement (a stopwatch started at the same moment every time) can reduce it.
Planning the sample size
Turn the margin round to find the n that gives a chosen margin E: for a mean, , with σ from a pilot sample or past data. To estimate the mean set-up time to within ±2 minutes at 95% with : , so 65 events. Always round up; ±3 minutes needs 29, and ±1 minute 260.
For a proportion, . The product is largest at p = 0.5, so 0.5 is the cautious planning value when nothing is known. A cinema chain (fictional) wanting the share of its members who would pay for reserved seats to within ±5 points at 95% needs , so 385 replies; if it is confident the share is near 30%, 323 would do, but a wrong guess leaves the margin too wide. These are numbers of usable replies or measurements, not of invitations.
Formulas
Confidence interval for a mean, σ known (z interval)
- The sample mean (the point estimate)units of x
- The z with α ÷ 2 above it: 1.645, 1.96, 2.576 for 90%, 95%, 99%
- The known population standard deviationunits of x
- The sample size
- 1 − the confidence level
Assumes. A random sample; the sample mean close to normal (a normal population, or n large enough for its skew).
The margin is CONFIDENCE.NORM(α, σ, n).
The t ratio
- The sample meanunits of x
- The population meanunits of x
- The sample standard deviation (STDEV.S)units of x
- The sample size
- The ratio, which follows the t distribution with n − 1 degrees of freedom
- Degrees of freedom
Assumes. A random sample from a roughly normal population.
Module 3 uses the same ratio as a test statistic.
Confidence interval for a mean, σ unknown (t interval)
- The t with α ÷ 2 in each tail and n − 1 degrees of freedom: T.INV.2T(α, n − 1)
- The sample standard deviationunits of x
- The sample meanunits of x
- The sample size
- 1 − the confidence level
Assumes. A random sample of independent values from a roughly normal population (robust to mild skew, more so as n grows).
The margin is CONFIDENCE.T(α, s, n), the ToolPak’s Confidence Level line.
Confidence interval for a proportion (Wald)
- The sample proportion, successes ÷ n
- The sample size
- The z multiplier
- 1 − the confidence level
Assumes. A random sample with at least 10 successes and 10 failures.
Wilson interval for a proportion
- The sample proportion
- The sample size
- The z multiplier (1.96 for 95%)
Assumes. A random sample; works well even with few successes or failures.
The centre, (p̂ + z²/2n) ÷ (1 + z²/n), is pulled towards 0.5; the limits stay between 0 and 1.
Sample size for a mean
- The margin of error wantedunits of x
- A planning value for the standard deviationunits of x
- The z multiplier
- The sample size, rounded up
Sample size for a proportion
- The margin of error wanted, as a proportion (0.05 for ±5 points)
- A planning value for the proportion; 0.5 is the cautious choice
- The z multiplier
- The number of usable replies, rounded up
Worked examples
Fictional figures
Ana’s 40 bags have a mean of 1,002.75 g. Taking Kilnworth’s specified standard deviation of 3 g as known, calculate a 95% confidence interval for the mean weight of the bags Kilnworth is filling.
- Conditions: the 40 bags were weighed one by one as they arrived in October, so treat them as independent draws from the machine’s output; the normal-distribution lesson found their weights close to normal; σ = 3 g is taken from the specification, so the z interval applies.
- Standard error: g.
- Multiplier for 95%: (
=NORM.S.INV(0.975)). Margin: g, or=CONFIDENCE.NORM(0.05,3,40). - Interval: , from 1001.82 to 1003.68 g.
Answer. 1001.82 g to 1003.68 g (95%).
What it means. If the 3 g is right, the method behind this interval captures the machine’s true mean in 95% of samples of 40, and this interval doesn’t reach Kilnworth’s 1,004 g setting. That is grounds to raise the question with Kilnworth, and the formal test is Module 3’s.
Fictional figures
Ana’s 24 set-up times (minutes) are 41, 40, 48, 26, 32, 30, 22, 39, 43, 31, 50, 45, 44, 42, 47, 26, 44, 43, 22, 41, 36, 45, 34, 38. Check that a t interval is reasonable, then calculate the 90%, 95% and 99% intervals for the mean set-up time, and say which one she should quote to clients.
- Conditions: the 24 events were drawn at random from the autumn’s bookings, so they are independent; the times run from 22 to 50 minutes with no outliers, mean 37.88 against median 40.5, SKEW -0.62: mildly left-skewed, acceptable for n = 24.
- Estimates: , , standard error ; σ is unknown, so use t with 23 degrees of freedom.
- Multipliers:
=T.INV.2T(0.1,23)= 1.714,=T.INV.2T(0.05,23)= 2.069,=T.INV.2T(0.01,23)= 2.807. - Margins and intervals: 90%: , 35.0 to 40.7; 95%: 3.47, 34.4 to 41.3; 99%: 4.71, 33.2 to 42.6 minutes.
Answer. 90%: 35.0 to 40.7 minutes; 95%: 34.4 to 41.3; 99%: 33.2 to 42.6.
What it means. These intervals are for the average set-up, which is what Ana needs for planning staff hours across many events. For one client’s event they are the wrong tool: individual set-ups ranged from 22 to 50 minutes, and a single event needs a range for one value (a prediction interval, B06), far wider than any interval for the mean. She can quote “about 38 minutes on average; allow up to 50”.
Fictional figures
In B01’s September survey, 240 customers were invited, 79 replied and 61 said they would recommend Lantern. Ana wants one sentence for her autumn report. Calculate the 95% Wald and Wilson intervals, check the conditions, and decide what the sentence can claim.
- Estimate and conditions: ; 61 successes and 18 failures, both at least 10, so the normal model is reasonable.
- Wald: : 68.0% to 86.5%.
- Wilson: centre , half-width 0.0912: 66.8% to 85.1%.
- Non-response: 32.9% replied. The interval says nothing about the 161 who didn’t; if recommenders were keener to reply, the true share could be lower than the whole interval.
Answer. About 77% of respondents would recommend Lantern (95% interval roughly 67% to 86%, by either method), from 79 replies to 240 invitations.
What it means. The sentence Ana writes: “77% of the 79 customers who replied would recommend us; among customers like them, the 95% interval is 68% to 86%. Only a third of September’s customers replied, so the figure may flatter us.” Reporting the interval without the response rate would overstate what the survey shows.
Fictional figures
Ana wants to quote the mean set-up time to within ±2 minutes at 95%, using her sample’s standard deviation of 8.22 minutes as the planning value. How many events should she time, and what would ±1 minute cost?
- , rounded up to 65.
- For ±1 minute the margin halves, so n roughly quadruples: , rounded up to 260.
- Check the planning value: s came from 24 events and could be a minute or so off. A cautious plan uses a slightly larger σ, or times the 65 events and recalculates the margin with their own s and t.
Answer. 65 events for ±2 minutes; 260 for ±1 minute.
What it means. Precision is expensive: halving the margin quadruples the work. ±2 minutes is plenty for staffing; Ana times every event for the next few months, which gets her past 65 without extra effort.
Explore
Common mistakes
“There is a 95% probability that the true mean is between 34.4 and 41.3 minutes.”
The true mean is fixed and this interval either contains it or doesn’t. The 95% is the long-run capture rate of the method: about 95% of intervals built this way contain μ. Say “we are 95% confident” and mean exactly that.
“95% of events take between 34.4 and 41.3 minutes.”
A confidence interval is for the mean, not for individual values. Ana’s set-ups ranged from 22 to 50 minutes; most lie outside the interval. A range for one event is a prediction interval, much wider (B06).
“With s from the sample, use 1.96.”
When σ is estimated by s, the multiplier comes from the t distribution with n − 1 degrees of freedom: 2.069 for n = 24. Using 1.96 makes the interval too narrow; it would capture μ about 94% of the time instead of 95%, and much less for very small samples.
“CONFIDENCE.T(0.95, s, n) gives a 95% interval.”
The first argument is alpha, 1 − confidence: 0.05 for 95%. And the function returns the margin, not the interval: subtract it from and add it to the mean.
“The margin of error covers all the error in a survey.”
It covers only sampling error, the luck of which customers ended up in the sample. Non-response, a frame that misses people and leading questions add bias that the margin doesn’t show.
“Doubling the sample halves the margin.”
The margin falls with √n, so doubling n divides it by about 1.41. Halving it takes four times the sample.
Guided practice
Work through these with hints when you need them. Every hint and every worked solution is there to be used.
Loading four questions…
On your own
No hints this time. Answer, check, and read the feedback; the solution appears once you have answered or if you ask for it. Your first answers count toward mastery.
Loading six questions…
In practice
Good reports give estimates with intervals: “mean set-up 38 minutes (95% CI 34 to 41)”, “77% would recommend (68% to 86%)”. A reader can then see at once whether a difference matters: if next quarter’s survey shows 72%, that is inside this interval and not clearly a fall. Decision-makers who are shown only point estimates tend to treat every wobble as news.
Planning starts from the margin. A market researcher who needs a share to within ±3 points at 95% knows before the survey that it takes about 1,068 replies at p = 0.5, and can budget for it; a quality manager who needs a fill weight to within ±0.5 g knows how many packs to weigh. Then the plan meets the real world: response rates, non-random samples and skewed data. The interval is only as honest as the sample behind it.
Fictional case
Ana’s note to the catering team: “Our average set-up is about 38 minutes (95% confidence interval 34 to 41 minutes, from 24 events chosen at random). Individual set-ups have ranged from 22 to 50 minutes, so for any one event allow 50. I’ll keep timing every event until we have 65, which will pin the average to within 2 minutes.”
Three questions keep an interval honest. Was the sample random, so that the standard error means something? Are the conditions met: roughly normal data or a large enough sample for a mean, enough of each outcome for a proportion? And is the question about the mean, or about individual values? Answer them before quoting the number, and quote the response rate beside any survey interval.
Knowledge check
Six questions, one attempt each, no hints. Score 80% or more to complete the lesson; you can take it again at any time.
Loading six questions…
Summary
- A confidence interval is a point estimate ± a margin of error; the margin is a multiplier (z or t) times the standard error.
- “95% confident” describes the method: about 95% of intervals built this way contain the parameter. A computed interval either contains it or doesn’t.
- With σ known use z (CONFIDENCE.NORM); with σ estimated by s use t with n − 1 degrees of freedom (CONFIDENCE.T, T.INV.2T). The t multiplier is larger and approaches 1.96 as n grows.
- Both CONFIDENCE functions take alpha (0.05 for 95%) and return the margin, not the interval; pass STDEV.S to CONFIDENCE.T.
- For a proportion, p̂ ± z√(p̂(1 − p̂) ÷ n) needs at least 10 of each outcome; with fewer, use the Wilson interval.
- Higher confidence and more spread widen the margin; a larger sample narrows it with √n. Sample sizes: n = (zσ ÷ E)² for a mean, z²p(1 − p) ÷ E² for a proportion, with p = 0.5 as the cautious value; round up.
- An interval covers sampling error only, assumes a random sample, and is about the mean, not about individual values.
Key formulas
- Confidence interval for a mean, σ known (z interval)
- The t ratio
- Confidence interval for a mean, σ unknown (t interval)
- Confidence interval for a proportion (Wald)
- Wilson interval for a proportion
- Sample size for a mean
- Sample size for a proportion
Terms introduced
- Point estimate
- A single number calculated from a sample to estimate a parameter, such as a sample mean for the population mean.
- Confidence interval
- A range calculated from sample data, estimate ± margin of error, by a method that captures the parameter in a stated share of samples (the confidence level). Any one interval either contains the parameter or doesn’t.
- Confidence level
- The share of samples in which the method of building a confidence interval captures the parameter, such as 95%; equal to 1 − α.
- Margin of error
- The half-width of a confidence interval: the multiplier (z or t) times the standard error. It measures sampling error only, not bias.
- t distribution
- The symmetric, bell-shaped distribution of (x̄ − μ) ÷ (s ÷ √n) for samples from a normal population, with heavier tails than the standard normal; its shape depends on its degrees of freedom, n − 1, and approaches the standard normal as they grow. Also called Student’s t.
- Wilson interval
- A confidence interval for a proportion that is centred slightly towards 0.5 and stays between 0 and 1, more reliable than the usual p̂ ± z√(p̂(1 − p̂) ÷ n) when the sample has few successes or failures.
Sources
- Holmes, A., Illowsky, B. & Dean, S. (2023). Introductory Business Statistics 2e, section 8.1 “A Confidence Interval When the Population Standard Deviation Is Known or Large Sample Size”, with sections 8.2–8.4 in the first edition. OpenStax. openstax.org/books/introductory-business-statistics-2e/pages…
- Holmes, A., Illowsky, B. & Dean, S. Introductory Business Statistics, section 8.2 “A Confidence Interval for a Population Standard Deviation Unknown, Small Sample Case”. OpenStax. openstax.org/books/introductory-business-statistics/pages/8-…
- NIST/SEMATECH. e-Handbook of Statistical Methods, section 1.3.5.2, “Confidence Limits for the Mean”. itl.nist.gov/div898/handbook/eda/section3/eda352.htm
- Illowsky, B. & Dean, S. Introductory Statistics, section 8.3 “A Population Proportion” (np′ and nq′ both greater than 5; sample size with p′ = 0.5). OpenStax. openstax.org/books/introductory-statistics/pages/8-3-a-popul…
- Diez, D., Barr, C. & Çetinkaya-Rundel, M. OpenIntro Statistics, section 6.1 “Inference for a Single Proportion”, on Statistics LibreTexts. stats.libretexts.org/Bookshelves/Introductory_Statistics/Ope…
- Agresti, A. & Coull, B. A. (2001). Comment on “Interval Estimation for a Binomial Proportion”. Statistical Science 16(2), 117–120. users.stat.ufl.edu/~aa/articles/agresti_coull_2001.pdf
- Microsoft Support. “CONFIDENCE.T function”, with the pages for CONFIDENCE.NORM, T.INV.2T, T.INV and T.DIST.2T. support.microsoft.com/en-US/Excel/functions/confidence-t-fun…
