Confidence Intervals and Hypothesis Testing
Confidence Intervals and the Introduction to Hypothesis Testing
1. Purpose of a Confidence Interval
A confidence interval is an interval estimate used to estimate an unknown population parameter, such as the population mean μ.
A point estimate gives one best estimate, while an interval estimate gives a range of plausible values. For estimating a population mean, the sample mean xˉ is the most common point estimator:
Point estimate: xˉ
Parameter being estimated: μ
Interval estimate: a confidence interval centered at xˉ
A confidence interval has the general form:
For a population mean, this becomes:
The interval is intended to capture the true population mean μ with a specified long-run success rate.
A 95% confidence interval procedure is designed so that approximately 95% of intervals constructed from repeated random samples will contain μ.
2. Confidence Level and Level of Significance
A confidence interval is described using a confidence level, written as:
where α is the level of significance.
Common confidence levels
90% confidence: α=0.10
95% confidence: α=0.05
99% confidence: α=0.01
98.7% confidence: α=0.013
The 95% confidence level is the most commonly used, but it is not mandatory. The appropriate confidence level depends on the context and the desired balance between precision and certainty.
For a 95% confidence interval:
Therefore:
The confidence level refers to the entire interval-estimation procedure, while α is called the level of significance. The significance level becomes especially important in hypothesis testing, where it represents a cutoff for judging evidence against a null hypothesis.
3. Estimating a Mean When the Population Standard Deviation Is Known
The simplest confidence-interval setting assumes that the population standard deviation σ is known.
This assumption simplifies the calculation because the standard normal distribution can be used instead of the t distribution. Although this situation is useful for learning the fundamental ideas, it is often unrealistic in practical applications. If the population mean μ is unknown, the population standard deviation σ is often unknown as well.
The confidence interval for μ when σ is known is:
Equivalently, the lower and upper endpoints are:
and
Components of the formula
xˉ: the sample mean and point estimate of μ
zα/2: the critical value from the standard normal distribution
σ: the known population standard deviation
n: the sample size
nσ: the standard deviation of the sampling distribution of xˉ
zα/2nσ: the margin of error
4. The Sampling Distribution of the Sample Mean
The sample mean xˉ is not merely a calculated number. Before a sample is selected, it is a random variable because different random samples produce different sample means.
The distribution of possible values of xˉ is called the sampling distribution of the sample mean.
When the population standard deviation is σ and the sample size is n:
Mean of the sampling distribution
This means that xˉ is an unbiased estimator of μ. Across many random samples, the sample means average out to the true population mean.
The mean of the sampling distribution of xˉ is the population mean: E(xˉ)=μ.
Variance and standard deviation
The variance of xˉ is:
Taking the square root gives the standard deviation:
This quantity is often called the standard error of the sample mean when it represents the standard deviation of the sampling distribution.
The sample size affects the standard error:
Increasing n decreases nσ.
A larger sample produces a more precise estimate.
The reduction in variability follows a square-root relationship, so quadrupling the sample size cuts the standard error in half.
5. Critical Values from the Standard Normal Distribution
The critical value zα/2 is selected from the standard normal distribution.
The notation zα/2 means that the area to the right of the critical value is α/2.
For a two-sided confidence interval, the total area outside the central confidence region is α, divided equally between the two tails:
Left-tail area: α/2
Right-tail area: α/2
Middle area: 1−α
For a 95% confidence interval:
and therefore:
The critical value satisfies:
Thus:
The same value can be identified by finding the area to the left:
Therefore, the standard normal value with cumulative area 0.975 to its left is approximately 1.96.
Effect of changing the confidence level
A higher confidence level requires a larger critical value.
A larger critical value produces a wider interval.
A lower confidence level uses a smaller critical value and produces a narrower interval.
For example:
A 99% interval is wider than a 95% interval.
A 90% interval is narrower than a 95% interval.
6. Margin of Error When σ Is Known
The margin of error is:
In the known-σ case, the margin of error is fixed if the following are fixed:
Confidence level
Population standard deviation σ
Sample size n
Although the sample mean changes from sample to sample, the margin of error does not change under these conditions.
Consequently, repeated confidence intervals have:
Different centers, because xˉ changes
The same width, because E remains constant
The interval shifts from sample to sample, but its width remains unchanged.
7. Simulation Example: Sampling from a Uniform Distribution
A simulation can demonstrate how confidence intervals behave over repeated samples.
Suppose a population follows a uniform distribution on the interval from 0 to 10.
Population mean
For a uniform distribution on [a,b], the mean is:
With a=0 and b=10:
Thus, the true population mean is μ=5.
Population variance
The variance of a uniform distribution on [a,b] is:
For the interval from 0 to 10:
Population standard deviation
The population standard deviation is:
In the simulation, μ=5 and σ≈2.887 are treated as known.
8. Repeated Samples and Confidence Intervals
Suppose repeated random samples of size n=10 are selected from the uniform population.
For each sample:
Ten observations are generated.
The sample mean xˉ is calculated.
A 95% confidence interval is constructed.
The interval is checked to determine whether it contains the true mean μ=5.
For a particular sample, the observed sample mean might be approximately 5.76. This value is a point estimate of μ for that sample.
The corresponding 95% confidence interval is:
The margin of error is:
Thus, if the observed sample mean is approximately $5.46, the interval is approximately:
or:
This interval contains the true population mean 5.
Repeating the process
If 100 samples are generated and a 95% confidence interval is computed for each sample:
Approximately 95 intervals should contain μ=5.
Approximately 5 intervals should fail to contain μ=5.
Because simulation involves randomness, the actual result will not necessarily be exactly 95 and 5. One simulation may produce:
94 intervals containing 5
6 intervals not containing 5
This result is consistent with the expected long-run behavior.
The confidence level describes the performance of the interval-construction method over repeated sampling, not a guarantee for every individual interval.
9. Interpreting a Confidence Level Correctly
The meaning of a 95% confidence level depends on whether the interval has already been calculated.
Before sampling
Before the sample is selected, the interval is still random because xˉ will depend on the future sample.
At this stage, it is reasonable to say:
The probability that the procedure will produce an interval containing μ is 0.95.
This statement concerns the repeated-sampling process before the random sample has been observed.
After the interval is calculated
Once the sample has been collected and the interval has been computed, the interval endpoints are fixed. The true population mean μ is also fixed, although it may be unknown.
Therefore, the interval either contains μ or it does not. The usual frequentist interpretation does not assign a probability to the completed interval containing μ.
A preferred interpretation is:
The researcher is 95% confident that the interval contains μ because the method used to construct the interval captures μ in approximately 95% of repeated samples.
Why probability language can be misleading
Probability describes randomness before an outcome occurs. After the data are collected:
The sample is no longer random.
The sample mean is fixed.
The interval endpoints are fixed.
The population mean is fixed.
The unknown status of μ does not make it a random quantity in the usual frequentist framework.
10. What Simulation Can and Cannot Show
A simulation can show the long-run behavior of a confidence-interval procedure. If the same population, sample size, and confidence-level method are used repeatedly, the proportion of successful intervals should approach the stated confidence level.
For a 95% method:
However, a simulation does not identify which individual intervals contain μ when μ is unknown in a real-world problem.
In the uniform-distribution example, the simulation can check the result because the population mean is known to be 5. In real applications, the true population mean is generally unknown, so an individual interval cannot be labeled as successful or unsuccessful.
Spreadsheet random-number generators are technically pseudorandom. They produce numbers through deterministic computational algorithms rather than through perfect physical randomness. Nevertheless, when the generator is sufficiently good, it provides a useful approximation to random sampling for instructional simulations.
Confidence Intervals When the Population Standard Deviation Is Unknown
11. Replacing σ with the Sample Standard Deviation
The known-σ formula is often unrealistic because σ is usually unknown. In that situation, the population standard deviation is estimated using the sample standard deviation s.
The confidence interval becomes:
The endpoints are:
and
Differences from the known-σ case
When σ is known:
When σ is unknown:
The unknown-σ interval differs in two important ways:
The population parameter σ is replaced by the statistic s.
The standard normal critical value zα/2 is replaced by a t critical value tα/2.
Both xˉ and s vary from sample to sample. Therefore, both the center and the margin of error are random before sampling.
12. Degrees of Freedom
For a one-sample confidence interval for a mean using the t distribution, the degrees of freedom are:
If the sample size is n=10, then:
Degrees of freedom are not always n−1 in every statistical procedure. The correct value depends on the specific problem. Other procedures can use:
n−2
n−3
n−4
More complicated formulas
For the one-sample mean interval discussed here, however, the appropriate value is n−1.
13. The t Distribution
The t distribution is used when estimating a population mean and σ is unknown.
General features
A t distribution:
Is bell-shaped.
Is centered at 0.
Is symmetric.
Has heavier tails than the standard normal distribution.
Has greater spread than the standard normal distribution.
Depends on the degrees of freedom.
Because the sample standard deviation s is being used instead of the known value σ, there is additional uncertainty. The heavier tails of the t distribution account for this extra uncertainty.
The t distribution cannot extend below any particular practical restriction on s itself, because a standard deviation cannot be negative. Its density is not the same as the normal density, even though both distributions are bell-shaped.
Relationship to the normal distribution
As the degrees of freedom increase:
The t distribution becomes less spread out.
Its tails become lighter.
It becomes increasingly similar to the standard normal distribution.
In the limit:
the t distribution approaches the standard normal distribution.
Thus, for very large samples, the t critical value and the corresponding z critical value become nearly identical.
14. Example Using the t Distribution
Consider a 95% confidence interval with sample size n=10.
The degrees of freedom are:
For a 95% interval:
and:
The relevant critical value is approximately:
This value is larger than the standard normal critical value:
The confidence interval is therefore:
Compared with the known-σ formula, the t procedure generally produces a wider interval because:
t0.025,9 is larger than z0.025.
The use of s introduces additional sampling uncertainty.
The sample standard deviation itself changes from sample to sample.
For example, if xˉ is approximately 5.4776, the known-σ interval uses:
The unknown-σ interval uses:
The exact width of the second interval depends on the observed sample standard deviation s.
15. Why the Unknown-σ Margin of Error Changes
When σ is known, the margin of error is:
Since zα/2, σ, and n are fixed, E is constant across samples.
When σ is unknown, the margin of error is:
Although tα/2 and n are fixed for a particular confidence level and sample size, s varies from sample to sample. Therefore, the margin of error also varies.
A sample with a larger observed standard deviation produces a wider interval. A sample with a smaller observed standard deviation produces a narrower interval.
The t critical value is larger than the corresponding z value, but the resulting interval is not determined by that comparison alone. The observed value of s may be substantially smaller or larger than the true σ, affecting the final margin of error.
16. Bias of the Sample Standard Deviation
The sample standard deviation s estimates the population standard deviation σ, but s itself is not generally an unbiased estimator of σ.
In contrast, the sample variance s2 is an unbiased estimator of the population variance σ2 under the usual sample-variance definition:
The distinction is important:
s2 is unbiased for σ2.
s is generally not unbiased for σ.
Even though s is not unbiased for σ, it is still used to estimate σ in the one-sample t confidence interval.
17. Standard Normal and t Procedures Compared
Known population standard deviation
Parameter assumed known: σ
Critical distribution: standard normal
Critical value: zα/2
Interval:
xˉ±zα/2nσMargin of error: fixed for fixed α, σ, and n
Unknown population standard deviation
Parameter estimated: σ is replaced by s
Critical distribution: t distribution
Degrees of freedom: n−1
Critical value: tα/2,n−1
Interval:
xˉ±tα/2,n−1nsMargin of error: changes from sample to sample because s changes
18. Connection to the Central Limit Theorem
The sample mean xˉ has a sampling distribution that is approximately normal for sufficiently large samples, even when the original population is not normally distributed. This is a consequence of the Central Limit Theorem.
The Central Limit Theorem supports the use of normal-based methods for xˉ when n is large.
The behavior of the sample standard deviation s is more complicated. Its distribution is not itself directly handled by the same simple Central Limit Theorem explanation used for xˉ. The t distribution accounts for the additional uncertainty created when s replaces σ.
19. Main Conceptual Takeaways
A confidence interval is a procedure for producing a range of plausible values for a population parameter.
A 95% confidence level means that approximately 95% of intervals from repeated samples will contain the true parameter.
The sample mean xˉ is an unbiased point estimator of μ, because E(xˉ)=μ.
When σ is known, the standard normal distribution is used; when σ is unknown, the t distribution is used.
The t distribution has heavier tails than the standard normal distribution because estimating σ with s introduces additional uncertainty.
For a known population standard deviation, the interval width is determined by the confidence level, σ, and n. For an unknown population standard deviation, the width also depends on the observed sample standard deviation s.

Ask anything
We've read this whole study set, so questions about it get the best answers.