Skip to main content

Registration is now open for this year's LibreFest! Join us virtually the week of July 13.

Register here
Statistics LibreTexts

7.3: Confidence Intervals for a Population Mean

  • Page ID
    58916
  • \( \newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \)

    \( \newcommand{\vecd}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}} \)

    \( \newcommand{\dsum}{\displaystyle\sum\limits} \)

    \( \newcommand{\dint}{\displaystyle\int\limits} \)

    \( \newcommand{\dlim}{\displaystyle\lim\limits} \)

    \( \newcommand{\id}{\mathrm{id}}\) \( \newcommand{\Span}{\mathrm{span}}\)

    ( \newcommand{\kernel}{\mathrm{null}\,}\) \( \newcommand{\range}{\mathrm{range}\,}\)

    \( \newcommand{\RealPart}{\mathrm{Re}}\) \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\)

    \( \newcommand{\Argument}{\mathrm{Arg}}\) \( \newcommand{\norm}[1]{\| #1 \|}\)

    \( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\)

    \( \newcommand{\Span}{\mathrm{span}}\)

    \( \newcommand{\id}{\mathrm{id}}\)

    \( \newcommand{\Span}{\mathrm{span}}\)

    \( \newcommand{\kernel}{\mathrm{null}\,}\)

    \( \newcommand{\range}{\mathrm{range}\,}\)

    \( \newcommand{\RealPart}{\mathrm{Re}}\)

    \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\)

    \( \newcommand{\Argument}{\mathrm{Arg}}\)

    \( \newcommand{\norm}[1]{\| #1 \|}\)

    \( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\)

    \( \newcommand{\Span}{\mathrm{span}}\) \( \newcommand{\AA}{\unicode[.8,0]{x212B}}\)

    \( \newcommand{\vectorA}[1]{\vec{#1}}      % arrow\)

    \( \newcommand{\vectorAt}[1]{\vec{\text{#1}}}      % arrow\)

    \( \newcommand{\vectorB}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \)

    \( \newcommand{\vectorC}[1]{\textbf{#1}} \)

    \( \newcommand{\vectorD}[1]{\overrightarrow{#1}} \)

    \( \newcommand{\vectorDt}[1]{\overrightarrow{\text{#1}}} \)

    \( \newcommand{\vectE}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash{\mathbf {#1}}}} \)

    \( \newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \)

    \(\newcommand{\longvect}{\overrightarrow}\)

    \( \newcommand{\vecd}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}} \)

    \(\newcommand{\avec}{\mathbf a}\) \(\newcommand{\bvec}{\mathbf b}\) \(\newcommand{\cvec}{\mathbf c}\) \(\newcommand{\dvec}{\mathbf d}\) \(\newcommand{\dtil}{\widetilde{\mathbf d}}\) \(\newcommand{\evec}{\mathbf e}\) \(\newcommand{\fvec}{\mathbf f}\) \(\newcommand{\nvec}{\mathbf n}\) \(\newcommand{\pvec}{\mathbf p}\) \(\newcommand{\qvec}{\mathbf q}\) \(\newcommand{\svec}{\mathbf s}\) \(\newcommand{\tvec}{\mathbf t}\) \(\newcommand{\uvec}{\mathbf u}\) \(\newcommand{\vvec}{\mathbf v}\) \(\newcommand{\wvec}{\mathbf w}\) \(\newcommand{\xvec}{\mathbf x}\) \(\newcommand{\yvec}{\mathbf y}\) \(\newcommand{\zvec}{\mathbf z}\) \(\newcommand{\rvec}{\mathbf r}\) \(\newcommand{\mvec}{\mathbf m}\) \(\newcommand{\zerovec}{\mathbf 0}\) \(\newcommand{\onevec}{\mathbf 1}\) \(\newcommand{\real}{\mathbb R}\) \(\newcommand{\twovec}[2]{\left[\begin{array}{r}#1 \\ #2 \end{array}\right]}\) \(\newcommand{\ctwovec}[2]{\left[\begin{array}{c}#1 \\ #2 \end{array}\right]}\) \(\newcommand{\threevec}[3]{\left[\begin{array}{r}#1 \\ #2 \\ #3 \end{array}\right]}\) \(\newcommand{\cthreevec}[3]{\left[\begin{array}{c}#1 \\ #2 \\ #3 \end{array}\right]}\) \(\newcommand{\fourvec}[4]{\left[\begin{array}{r}#1 \\ #2 \\ #3 \\ #4 \end{array}\right]}\) \(\newcommand{\cfourvec}[4]{\left[\begin{array}{c}#1 \\ #2 \\ #3 \\ #4 \end{array}\right]}\) \(\newcommand{\fivevec}[5]{\left[\begin{array}{r}#1 \\ #2 \\ #3 \\ #4 \\ #5 \\ \end{array}\right]}\) \(\newcommand{\cfivevec}[5]{\left[\begin{array}{c}#1 \\ #2 \\ #3 \\ #4 \\ #5 \\ \end{array}\right]}\) \(\newcommand{\mattwo}[4]{\left[\begin{array}{rr}#1 \amp #2 \\ #3 \amp #4 \\ \end{array}\right]}\) \(\newcommand{\laspan}[1]{\text{Span}\{#1\}}\) \(\newcommand{\bcal}{\cal B}\) \(\newcommand{\ccal}{\cal C}\) \(\newcommand{\scal}{\cal S}\) \(\newcommand{\wcal}{\cal W}\) \(\newcommand{\ecal}{\cal E}\) \(\newcommand{\coords}[2]{\left\{#1\right\}_{#2}}\) \(\newcommand{\gray}[1]{\color{gray}{#1}}\) \(\newcommand{\lgray}[1]{\color{lightgray}{#1}}\) \(\newcommand{\rank}{\operatorname{rank}}\) \(\newcommand{\row}{\text{Row}}\) \(\newcommand{\col}{\text{Col}}\) \(\renewcommand{\row}{\text{Row}}\) \(\newcommand{\nul}{\text{Nul}}\) \(\newcommand{\var}{\text{Var}}\) \(\newcommand{\corr}{\text{corr}}\) \(\newcommand{\len}[1]{\left|#1\right|}\) \(\newcommand{\bbar}{\overline{\bvec}}\) \(\newcommand{\bhat}{\widehat{\bvec}}\) \(\newcommand{\bperp}{\bvec^\perp}\) \(\newcommand{\xhat}{\widehat{\xvec}}\) \(\newcommand{\vhat}{\widehat{\vvec}}\) \(\newcommand{\uhat}{\widehat{\uvec}}\) \(\newcommand{\what}{\widehat{\wvec}}\) \(\newcommand{\Sighat}{\widehat{\Sigma}}\) \(\newcommand{\lt}{<}\) \(\newcommand{\gt}{>}\) \(\newcommand{\amp}{&}\) \(\definecolor{fillinmathshade}{gray}{0.9}\)

    Suppose a health researcher is studying caffeine consumption among college students. She surveys a random sample of 20 students and finds they consume an average of 215 milligrams of caffeine per day, with a sample standard deviation of 48 mg/day. She wants to estimate the true average caffeine intake for all students on campus at 90% confidence. How can we do a similar estimation for means as we did with proportions in the last section?


    The t-Distribution

    Back in Chapter 6, we explored the Central Limit Theorem, which told us that the sampling distribution of sample means forms a normal distribution with certain characteristics. The mean of the sample means (\(\mu_{\bar{x}}\)) matched the population mean (\(\mu\)), which is what we're trying to estimate. And the standard error (\(\sigma_{\bar{x}}\) or SE) could be calculated based on the population standard deviation \(SE = \frac{\sigma}{\sqrt{n}}\).

    But in real-world data, we almost never know the population standard deviation. In this case, we have to approximate the population deviation \(\sigma\) with the sample deviation \(s\). However, as seen in our original definition for the standard deviation: 2.2: Measures of Spread- Range, Variance, and Standard Deviation, the sample standard deviation tends to underestimate the population standard deviation. We can mathematically show that if we use a t-distribution instead of a normal distribution for our sample distribution, then we will no longer bias towards an underestimated standard deviation.


    What Is the t-Distribution?

    The t-distribution is a family of curves that look similar to the normal distribution, bell-shaped and symmetric, but with heavier tails. This means that they are more spread out, leading to wider intervals for the same confidence level.

    Just like the normal distribution is used with z-scores, the t-distribution is used with t-scores. We’ll use it any time we’re:

    • Estimating a population mean and...
    • ...we don’t know the population standard deviation

    Degrees of Freedom (df)

    There is more than one t-distribution, in fact, there’s an infinite set of different curves! Each one is described by a number called degrees of freedom (usually noted as \( df \)).

    When estimating a single mean, degrees of freedom equals the sample size minus one:

    \[ df = n - 1 \]

    As your sample size increases, the t-distribution gets closer and closer to the normal distribution, the extra uncertainty becomes negligible when samples are large (usually \( n > 30 \)). See the desmos slider below to watch the t-distribution converge to the normal. The normal is in red and the t-distribution in blue.

    As you can see, the t-distribution and normal distribution are centered at the same mean, but the t-distribution is wider. As you slide the sample size to become larger, watch how the blue t-distribution changes.


    Example: Estimating Caffeine Consumption

    Consider the health researcher studying caffeine consumption mentioned earlier. Since she doesn’t know the population standard deviation, she will use the t-distribution, not the normal curve. The degrees of freedom will be \( df = 20 - 1 = 19 \).

    We’ll walk through how to calculate confidence intervals with the t-distribution below.


    Definition: Confidence Interval for a Population Mean

    A confidence interval for a population mean is a range of values built around a sample mean, showing the plausible values for the population mean \( \mu \). As in the case for proportions, if we were to take many different samples, we expect that the proportion of confidence intervals generated that cover the true mean will match the confidence level.

    As stated above, when the population standard deviation \( \sigma \) is unknown, we will use the t-distribution and construct intervals as follows:

    \[ \bar{x} - t^* \left( \frac{s}{\sqrt{n}}\right) < \mu < \bar{x} + t^* \left( \frac{s}{\sqrt{n}}\right) \]

    • \( \bar{x} \): sample mean
    • \( s \): sample standard deviation
    • \( n \): sample size
    • \( t^* \): critical value from the t-distribution for the desired confidence level

    It is also correct to call \( \bar{x}\) the point estimate for \(\mu\) and \(t^* \left(\frac{s}{\sqrt{n}}\right)\) the margin of error (ME).

     

    Constructing a Confidence Interval

    Let us revisit the opening example where we are interested in constructing a 90% confidence interval. We have a sample size of 20 students, with an average caffeine intake of 215 mg/day and sample standard deviation of 48 mg/day. Our degrees of freedom are \(df = 19\) and so we determine the t-value corresponding to a confidence level of 90% and the degree of freedom. We obtain a score of \(t^* \approx 1.729\). Using the formula yields a margin of error of:

    \[ME = t^*\frac{s}{\sqrt{n}} = 1.729\cdot\frac{48}{\sqrt{20}} \approx 19\]

    Now that we have the margin of error, we can independently subtract and add to the sample mean to obtain our confidence interval. We have a lower bound of \(215 - 19 = 196\) mg/day and an upper bound of \(215 + 19 = 234\) mg/day. We can express our interval in various ways such as the following:

    \[ 196 \text{ mg/day } \leq \mu \leq 234 \text{ mg/day}\]

    We would verbally say that we have 90% confidence that the true value of the average caffeine consumption falls between 196 and 234 mg/day.


    What the Confidence Interval is Not

    The confidence interval tells us about the strength and probability of our methodology, not necessarily our results. A difficult concept to come around to is the fact that we assume the population average exists, but is simply unknown. Therefore we can't talk about the probability of the population average because it is not a random variable. The confidence statement says how likely it is that a perfect random sample of data correctly approximates the population value. A few statements to avoid:

    • We are not talking about the probability of the population parameter being in a range of values. This parameter is fixed but unknown.
    • We are not talking about proportions of the data like we did in chapter 5. The t-distribution isn't describing the data, it is describing the probability of obtaining sample means.
    • It also doesn't tell us anything about how good our sampling was. To use an effective confidence interval, we need to assume our sample was sufficiently representative and unbiased.
    • Finally, since we don't know the population parameter, we are not assessing how well this interval was. We have confidence that an interval generated from this method has a certain likelihood of capturing the true value.

    Choosing a Confidence Level

    So far, we worked with a 90% confidence intervals. That’s a common choice, but it’s not the only one. Confidence levels are flexible, and we choose them depending on the situation and how much uncertainty we’re willing to accept.

    Here are some common levels:

    • 90% confidence: narrower interval, less confidence
    • 95% confidence: a standard balance of precision and confidence
    • 99% confidence: wider interval, more confidence

    The general rule is:

    Higher confidence → wider interval
    Lower confidence → narrower interval

    Consider why this intuitively makes sense. If I want to be more confident that my interval covers the true population, I can make it wider. However, if we create too much confidence then we may end up with an interval that is too wide to be useful! Consider, we have 100% confidence our population mean is between \(-\infty\) and \(\infty\)! We need to find a balance between higher confidence and a useful interval. If our sample is too small, we may need to state a lower confidence to have a maneagable interval. This illustrates how critical it is to both state the confidence level and to understand what it means. If we have a 50% confidence interval, it means that there was a 50/50 chance- a coin flip- to cover the true value.


    Example 2: Sleep Hours Estimate

    A sample of 25 students reports an average of 6.9 hours of sleep per night, with a standard deviation of 1.3 hours. Construct a 95% confidence interval for the average amount of sleep all students get.

    • \( \bar{x} = 6.9 \), \( s = 1.3 \), \( n = 25 \), degrees of freedom = 24
    • From the t-table, critical value for 95% confidence and df = 24 is \( t^* \approx 2.064 \)
    • Standard error: \( \frac{1.3}{\sqrt{25}} = 0.26 \)
    • Margin of error: \( 2.064 \cdot 0.26 = 0.537 \)
    • Interval: \( (6.9 - 0.54, 6.9 + 0.54) = (6.36, 7.44) \)

    Interpretation: We are 95% confident that the average sleep among all students is between 6.36 and 7.44 hours per night.


    Example 3: Mean Rent for Off-Campus Housing

    A city planner wants to estimate the average rent of apartments near campus. She samples 50 listings and finds a mean rent of \$1,465.05 with a standard deviation of \$167.11. Let us construct a 99% confidence interval:

    • \( \bar{x} = 1465.05, s = 167.11, n = 50 \), so we have 49 degrees of freedom. Calculating the t-score yields: \( t^* \approx 2.680 \)
    • Standard error: \( \frac{167.11}{\sqrt{50}} \approx 23.63 \)
    • Margin of error: \( 2.680 \cdot 23.63 \approx 63.34 \)
    • Interval: \( (1401.71, 1528.39) \)

    Conclusion: We are 99% confident that the true average rent in this area is between \$1401.71 and \$1528.39 per month.


    Reflection: Shifting the Statistic

    So far, we've built confidence intervals based on the sample mean and on the sample proportion. In both cases we follow the same procedure (but with different calculations):

    • We take a sample
    • We compute a statistic (a mean or a proportion)
    • We estimate a margin of error
    • We build an interval that likely contains the population value

    Related Video


    Up Next:

    In the next section, we'll take a closer look at the connections between the margin of error, the confidence level, and the sample size


    This page titled 7.3: Confidence Intervals for a Population Mean is shared under a CC BY 4.0 license and was authored, remixed, and/or curated by Mathematics Department.

    • Was this article helpful?