1. Home
  2. Explore
  3. Statistics
  4. Confidence Intervals and Hypothesis Testing

Study methods

Flashcards
Quiz
Fill in the blanks
Written test
Lesson
Notes
Podcast
Content

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 μ\muμ.

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ˉ\bar{x}xˉ is the most common point estimator:

  • Point estimate: xˉ\bar{x}xˉ

  • Parameter being estimated: μ\muμ

  • Interval estimate: a confidence interval centered at xˉ\bar{x}xˉ

A confidence interval has the general form:

point estimate±margin of error\text{point estimate} \pm \text{margin of error}point estimate±margin of error

For a population mean, this becomes:

xˉ±margin of error\bar{x} \pm \text{margin of error}xˉ±margin of error

The interval is intended to capture the true population mean μ\muμ with a specified long-run success rate.

A 95%95\%95% confidence interval procedure is designed so that approximately 95%95\%95% of intervals constructed from repeated random samples will contain μ\muμ.


2. Confidence Level and Level of Significance

A confidence interval is described using a confidence level, written as:

100(1−α)%100(1-\alpha)\%100(1−α)%

where α\alphaα is the level of significance.

Common confidence levels

  • 90%90\%90% confidence: α=0.10\alpha = 0.10α=0.10

  • 95%95\%95% confidence: α=0.05\alpha = 0.05α=0.05

  • 99%99\%99% confidence: α=0.01\alpha = 0.01α=0.01

  • 98.7%98.7\%98.7% confidence: α=0.013\alpha = 0.013α=0.013

The 95%95\%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%95\%95% confidence interval:

1−α=0.951-\alpha = 0.951−α=0.95

Therefore:

α=0.05\alpha = 0.05α=0.05

The confidence level refers to the entire interval-estimation procedure, while α\alphaα 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 σ\sigmaσ is known.

This assumption simplifies the calculation because the standard normal distribution can be used instead of the ttt distribution. Although this situation is useful for learning the fundamental ideas, it is often unrealistic in practical applications. If the population mean μ\muμ is unknown, the population standard deviation σ\sigmaσ is often unknown as well.

The confidence interval for μ\muμ when σ\sigmaσ is known is:

xˉ±zα/2σn\bar{x} \pm z_{\alpha/2}\frac{\sigma}{\sqrt{n}}xˉ±zα/2​n​σ​

Equivalently, the lower and upper endpoints are:

xˉ−zα/2σn\bar{x}-z_{\alpha/2}\frac{\sigma}{\sqrt{n}}xˉ−zα/2​n​σ​

and

xˉ+zα/2σn\bar{x}+z_{\alpha/2}\frac{\sigma}{\sqrt{n}}xˉ+zα/2​n​σ​

Components of the formula

  • xˉ\bar{x}xˉ: the sample mean and point estimate of μ\muμ

  • zα/2z_{\alpha/2}zα/2​: the critical value from the standard normal distribution

  • σ\sigmaσ: the known population standard deviation

  • nnn: the sample size

  • σn\frac{\sigma}{\sqrt{n}}n​σ​: the standard deviation of the sampling distribution of xˉ\bar{x}xˉ

  • zα/2σnz_{\alpha/2}\frac{\sigma}{\sqrt{n}}zα/2​n​σ​: the margin of error


4. The Sampling Distribution of the Sample Mean

The sample mean xˉ\bar{x}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ˉ\bar{x}xˉ is called the sampling distribution of the sample mean.

When the population standard deviation is σ\sigmaσ and the sample size is nnn:

Mean of the sampling distribution

E(xˉ)=μE(\bar{x})=\muE(xˉ)=μ

This means that xˉ\bar{x}xˉ is an unbiased estimator of μ\muμ. Across many random samples, the sample means average out to the true population mean.

The mean of the sampling distribution of xˉ\bar{x}xˉ is the population mean: E(xˉ)=μE(\bar{x})=\muE(xˉ)=μ.

Variance and standard deviation

The variance of xˉ\bar{x}xˉ is:

Var⁡(xˉ)=σ2n\operatorname{Var}(\bar{x})=\frac{\sigma^2}{n}Var(xˉ)=nσ2​

Taking the square root gives the standard deviation:

σxˉ=σn\sigma_{\bar{x}}=\frac{\sigma}{\sqrt{n}}σxˉ​=n​σ​

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 nnn decreases σn\frac{\sigma}{\sqrt{n}}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α/2z_{\alpha/2}zα/2​ is selected from the standard normal distribution.

The notation zα/2z_{\alpha/2}zα/2​ means that the area to the right of the critical value is α/2\alpha/2α/2.

For a two-sided confidence interval, the total area outside the central confidence region is α\alphaα, divided equally between the two tails:

  • Left-tail area: α/2\alpha/2α/2

  • Right-tail area: α/2\alpha/2α/2

  • Middle area: 1−α1-\alpha1−α

For a 95%95\%95% confidence interval:

α=0.05\alpha=0.05α=0.05

and therefore:

α2=0.025\frac{\alpha}{2}=0.0252α​=0.025

The critical value satisfies:

P(Z>z0.025)=0.025P(Z>z_{0.025})=0.025P(Z>z0.025​)=0.025

Thus:

z0.025≈1.96z_{0.025}\approx 1.96z0.025​≈1.96

The same value can be identified by finding the area to the left:

1−0.025=0.9751-0.025=0.9751−0.025=0.975

Therefore, the standard normal value with cumulative area 0.9750.9750.975 to its left is approximately 1.961.961.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%99\%99% interval is wider than a 95%95\%95% interval.

  • A 90%90\%90% interval is narrower than a 95%95\%95% interval.


6. Margin of Error When σ\sigmaσ Is Known

The margin of error is:

E=zα/2σnE=z_{\alpha/2}\frac{\sigma}{\sqrt{n}}E=zα/2​n​σ​

In the known-σ\sigmaσ case, the margin of error is fixed if the following are fixed:

  • Confidence level

  • Population standard deviation σ\sigmaσ

  • Sample size nnn

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ˉ\bar{x}xˉ changes

  • The same width, because EEE 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 000 to 101010.

Population mean

For a uniform distribution on [a,b][a,b][a,b], the mean is:

μ=a+b2\mu=\frac{a+b}{2}μ=2a+b​

With a=0a=0a=0 and b=10b=10b=10:

μ=0+102=5\mu=\frac{0+10}{2}=5μ=20+10​=5

Thus, the true population mean is μ=5\mu=5μ=5.

Population variance

The variance of a uniform distribution on [a,b][a,b][a,b] is:

σ2=(b−a)212\sigma^2=\frac{(b-a)^2}{12}σ2=12(b−a)2​

For the interval from 000 to 101010:

σ2=(10−0)212=10012=253≈8.333\sigma^2=\frac{(10-0)^2}{12} =\frac{100}{12} =\frac{25}{3} \approx 8.333σ2=12(10−0)2​=12100​=325​≈8.333

Population standard deviation

The population standard deviation is:

σ=253≈2.887\sigma=\sqrt{\frac{25}{3}}\approx 2.887σ=325​​≈2.887

In the simulation, μ=5\mu=5μ=5 and σ≈2.887\sigma\approx2.887σ≈2.887 are treated as known.


8. Repeated Samples and Confidence Intervals

Suppose repeated random samples of size n=10n=10n=10 are selected from the uniform population.

For each sample:

  1. Ten observations are generated.

  2. The sample mean xˉ\bar{x}xˉ is calculated.

  3. A 95%95\%95% confidence interval is constructed.

  4. The interval is checked to determine whether it contains the true mean μ=5\mu=5μ=5.

For a particular sample, the observed sample mean might be approximately 5.765.765.76. This value is a point estimate of μ\muμ for that sample.

The corresponding 95%95\%95% confidence interval is:

xˉ±1.962.88710\bar{x}\pm1.96\frac{2.887}{\sqrt{10}}xˉ±1.9610​2.887​

The margin of error is:

E=1.962.88710≈1.79E=1.96\frac{2.887}{\sqrt{10}} \approx1.79E=1.9610​2.887​≈1.79

Thus, if the observed sample mean is approximately $5.46, the interval is approximately:

5.46±1.795.46\pm1.795.46±1.79

or:

(3.67,7.25)(3.67,7.25)(3.67,7.25)

This interval contains the true population mean 555.

Repeating the process

If 100100100 samples are generated and a 95%95\%95% confidence interval is computed for each sample:

  • Approximately 959595 intervals should contain μ=5\mu=5μ=5.

  • Approximately 555 intervals should fail to contain μ=5\mu=5μ=5.

Because simulation involves randomness, the actual result will not necessarily be exactly 959595 and 555. One simulation may produce:

  • 949494 intervals containing 555

  • 666 intervals not containing 555

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%95\%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ˉ\bar{x}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 μ\muμ is 0.950.950.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 μ\muμ is also fixed, although it may be unknown.

Therefore, the interval either contains μ\muμ or it does not. The usual frequentist interpretation does not assign a probability to the completed interval containing μ\muμ.

A preferred interpretation is:

The researcher is 95%95\%95% confident that the interval contains μ\muμ because the method used to construct the interval captures μ\muμ in approximately 95%95\%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 μ\muμ 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%95\%95% method:

Long-run capture rate≈0.95\text{Long-run capture rate}\approx0.95Long-run capture rate≈0.95

However, a simulation does not identify which individual intervals contain μ\muμ when μ\muμ 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 555. 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 σ\sigmaσ with the Sample Standard Deviation

The known-σ\sigmaσ formula is often unrealistic because σ\sigmaσ is usually unknown. In that situation, the population standard deviation is estimated using the sample standard deviation sss.

The confidence interval becomes:

xˉ±tα/2sn\bar{x}\pm t_{\alpha/2}\frac{s}{\sqrt{n}}xˉ±tα/2​n​s​

The endpoints are:

xˉ−tα/2sn\bar{x}-t_{\alpha/2}\frac{s}{\sqrt{n}}xˉ−tα/2​n​s​

and

xˉ+tα/2sn\bar{x}+t_{\alpha/2}\frac{s}{\sqrt{n}}xˉ+tα/2​n​s​

Differences from the known-σ\sigmaσ case

When σ\sigmaσ is known:

xˉ±zα/2σn\bar{x}\pm z_{\alpha/2}\frac{\sigma}{\sqrt{n}}xˉ±zα/2​n​σ​

When σ\sigmaσ is unknown:

xˉ±tα/2sn\bar{x}\pm t_{\alpha/2}\frac{s}{\sqrt{n}}xˉ±tα/2​n​s​

The unknown-σ\sigmaσ interval differs in two important ways:

  • The population parameter σ\sigmaσ is replaced by the statistic sss.

  • The standard normal critical value zα/2z_{\alpha/2}zα/2​ is replaced by a ttt critical value tα/2t_{\alpha/2}tα/2​.

Both xˉ\bar{x}xˉ and sss 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 ttt distribution, the degrees of freedom are:

df=n−1df=n-1df=n−1

If the sample size is n=10n=10n=10, then:

df=10−1=9df=10-1=9df=10−1=9

Degrees of freedom are not always n−1n-1n−1 in every statistical procedure. The correct value depends on the specific problem. Other procedures can use:

  • n−2n-2n−2

  • n−3n-3n−3

  • n−4n-4n−4

  • More complicated formulas

For the one-sample mean interval discussed here, however, the appropriate value is n−1n-1n−1.


13. The ttt Distribution

The ttt distribution is used when estimating a population mean and σ\sigmaσ is unknown.

General features

A ttt distribution:

  • Is bell-shaped.

  • Is centered at 000.

  • 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 sss is being used instead of the known value σ\sigmaσ, there is additional uncertainty. The heavier tails of the ttt distribution account for this extra uncertainty.

The ttt distribution cannot extend below any particular practical restriction on sss 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 ttt distribution becomes less spread out.

  • Its tails become lighter.

  • It becomes increasingly similar to the standard normal distribution.

In the limit:

df→∞df\to\inftydf→∞

the ttt distribution approaches the standard normal distribution.

Thus, for very large samples, the ttt critical value and the corresponding zzz critical value become nearly identical.


14. Example Using the ttt Distribution

Consider a 95%95\%95% confidence interval with sample size n=10n=10n=10.

The degrees of freedom are:

df=9df=9df=9

For a 95%95\%95% interval:

α=0.05\alpha=0.05α=0.05

and:

α2=0.025\frac{\alpha}{2}=0.0252α​=0.025

The relevant critical value is approximately:

t0.025,9=2.262t_{0.025,9}=2.262t0.025,9​=2.262

This value is larger than the standard normal critical value:

z0.025=1.96z_{0.025}=1.96z0.025​=1.96

The confidence interval is therefore:

xˉ±2.262s10\bar{x}\pm2.262\frac{s}{\sqrt{10}}xˉ±2.26210​s​

Compared with the known-σ\sigmaσ formula, the ttt procedure generally produces a wider interval because:

  1. t0.025,9t_{0.025,9}t0.025,9​ is larger than z0.025z_{0.025}z0.025​.

  2. The use of sss introduces additional sampling uncertainty.

  3. The sample standard deviation itself changes from sample to sample.

For example, if xˉ\bar{x}xˉ is approximately 5.47765.47765.4776, the known-σ\sigmaσ interval uses:

5.4776±1.962.887105.4776\pm1.96\frac{2.887}{\sqrt{10}}5.4776±1.9610​2.887​

The unknown-σ\sigmaσ interval uses:

5.4776±2.262s105.4776\pm2.262\frac{s}{\sqrt{10}}5.4776±2.26210​s​

The exact width of the second interval depends on the observed sample standard deviation sss.


15. Why the Unknown-σ\sigmaσ Margin of Error Changes

When σ\sigmaσ is known, the margin of error is:

E=zα/2σnE=z_{\alpha/2}\frac{\sigma}{\sqrt{n}}E=zα/2​n​σ​

Since zα/2z_{\alpha/2}zα/2​, σ\sigmaσ, and nnn are fixed, EEE is constant across samples.

When σ\sigmaσ is unknown, the margin of error is:

E=tα/2snE=t_{\alpha/2}\frac{s}{\sqrt{n}}E=tα/2​n​s​

Although tα/2t_{\alpha/2}tα/2​ and nnn are fixed for a particular confidence level and sample size, sss 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 ttt critical value is larger than the corresponding zzz value, but the resulting interval is not determined by that comparison alone. The observed value of sss may be substantially smaller or larger than the true σ\sigmaσ, affecting the final margin of error.


16. Bias of the Sample Standard Deviation

The sample standard deviation sss estimates the population standard deviation σ\sigmaσ, but sss itself is not generally an unbiased estimator of σ\sigmaσ.

In contrast, the sample variance s2s^2s2 is an unbiased estimator of the population variance σ2\sigma^2σ2 under the usual sample-variance definition:

E(s2)=σ2E(s^2)=\sigma^2E(s2)=σ2

The distinction is important:

  • s2s^2s2 is unbiased for σ2\sigma^2σ2.

  • sss is generally not unbiased for σ\sigmaσ.

Even though sss is not unbiased for σ\sigmaσ, it is still used to estimate σ\sigmaσ in the one-sample ttt confidence interval.


17. Standard Normal and ttt Procedures Compared

Known population standard deviation

  • Parameter assumed known: σ\sigmaσ

  • Critical distribution: standard normal

  • Critical value: zα/2z_{\alpha/2}zα/2​

  • Interval:

    xˉ±zα/2σn\bar{x}\pm z_{\alpha/2}\frac{\sigma}{\sqrt{n}}xˉ±zα/2​n​σ​
  • Margin of error: fixed for fixed α\alphaα, σ\sigmaσ, and nnn

Unknown population standard deviation

  • Parameter estimated: σ\sigmaσ is replaced by sss

  • Critical distribution: ttt distribution

  • Degrees of freedom: n−1n-1n−1

  • Critical value: tα/2,n−1t_{\alpha/2,n-1}tα/2,n−1​

  • Interval:

    xˉ±tα/2,n−1sn\bar{x}\pm t_{\alpha/2,n-1}\frac{s}{\sqrt{n}}xˉ±tα/2,n−1​n​s​
  • Margin of error: changes from sample to sample because sss changes


18. Connection to the Central Limit Theorem

The sample mean xˉ\bar{x}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ˉ\bar{x}xˉ when nnn is large.

The behavior of the sample standard deviation sss is more complicated. Its distribution is not itself directly handled by the same simple Central Limit Theorem explanation used for xˉ\bar{x}xˉ. The ttt distribution accounts for the additional uncertainty created when sss replaces σ\sigmaσ.


19. Main Conceptual Takeaways

A confidence interval is a procedure for producing a range of plausible values for a population parameter.

A 95%95\%95% confidence level means that approximately 95%95\%95% of intervals from repeated samples will contain the true parameter.

The sample mean xˉ\bar{x}xˉ is an unbiased point estimator of μ\muμ, because E(xˉ)=μE(\bar{x})=\muE(xˉ)=μ.

When σ\sigmaσ is known, the standard normal distribution is used; when σ\sigmaσ is unknown, the ttt distribution is used.

The ttt distribution has heavier tails than the standard normal distribution because estimating σ\sigmaσ with sss introduces additional uncertainty.

For a known population standard deviation, the interval width is determined by the confidence level, σ\sigmaσ, and nnn. For an unknown population standard deviation, the width also depends on the observed sample standard deviation sss.

Ask anything

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

FlashcardsQuizFill in the blanksWritten testLessonNotesPodcastContent