The Problem
Example #45: Let us estimate the mean height of a population, using a confidence interval to indicate our level of uncertainty. To estimate μ, we collect data. These data are the heights of a sample from this population. The sample values are:
60, 88, 93, 81, 86, 74, 97, 82, 71, 114, 76, 101, 134, 87, 89, 78, 68, 71, 101, 78, 76, 132, 100, 95, 74, 62, 61, 63, 118, 76
In addition to these data, we also know that the data are generated from a Normal process (they come from a Normally distributed population). With this information, let us estimate the population mean using a 95% confidence interval.
Information given:
To summarize the above, the values of import are:
Summary statistics from the problem
\( \bar{x} \)
| = |
86.2 |
\( n \)
| = |
30 |
\( \alpha \)
| = |
0.05 |
Note that there is no value given for μ0. This is because confidence intervals are based solely on the data, and not on any hypothesized values.
It may be helpful if you calculate these values yourself. Once you have, you can check your answers by hovering your mouse over the grey spaces to see if you calculated them correctly.
Your Answer
You got the correct endpoints to the 95% confidence: (78.9037, 93.4963). Congratulations!
Unfortunately, your answer was not correct. Either try again or click on “Show Solution” below to see how to obtain the correct answer.
Assistance
Hide Solution
$$ \begin{align}
\text{95% Confidence Bounds} &= \bar{x} \pm t(\alpha/2,\nu) \frac{s}{\sqrt{n}} \\[1em]
&= 86.2 \pm 2.045\ \frac{19.541997}{\sqrt{30}} \\[1em]
&= 86.2 \pm 7.2963 \\[1em]
\end{align} $$
Thus, we are 95% confident that the mean height for the population is between 78.9037 and 93.4963.
Note that the value following the plus/minus sign ± is known as the margin of error, \( E = 7.2963 \), and is always half of the width of the confidence interval. The margin of error is affected by the sample size, the level of confidence, and the variability of the population. If n increases, the margin of error shrinks. If the level of confidence increases, the margin of error expands. If the variability in the population increases, the margin of error expands.
Hide the R Code
The following code will perform the t-test using R’ built-in function. Copy and paste the following code into your R script window, then run it from there.
sample = c(60, 88, 93, 81, 86, 74, 97, 82, 71, 114, 76, 101, 134, 87, 89, 78, 68, 71, 101, 78, 76, 132, 100, 95, 74, 62, 61, 63, 118, 76)
t.test(sample, conf.level=0.95)
The limits of the 95% confidence interval follow the line “95 percent confidence interval:
” near the middle of the output.
Hide the Excel Code
The z-procedures are sensitive to knowing the population variance. Logic dictates that if we do not know the population mean, then we will not know the population variance. As such, the z-procedures are rarely used now. As such, there is no z-test in the base Excel program.
Copy and paste the following code into your Excel spreadsheet window, making sure the value x
ends up in A1
after pasting.
How to calculate the expected value in Excel.
sample | | |
60 |
s: |
=STDEV.S(A:A) |
88 |
x-bar: |
=AVERAGE(A:A) |
93 |
mult: |
=T.INV(0.025,COUNT(A:A)-1) |
81 |
lcl: |
=C3-C4*C2/SQRT(count(A:A)) |
86 |
ucl: |
=C3+C4*C2/SQRT(count(A:A)) |
74 |
|
|
97 |
|
|
82 |
|
|
71 |
|
|
114 |
|
|
76 |
|
|
101 |
|
|
134 |
|
|
87 |
|
|
89 |
|
|
78 |
|
|
68 |
|
|
71 |
|
|
101 |
|
|
78 |
|
|
76 |
|
|
132 |
|
|
100 |
|
|
95 |
|
|
74 |
|
|
62 |
|
|
61 |
|
|
63 |
|
|
118 |
|
|
76 |
|
|
The limits for the 95% confidence interval are the numbers calculated in cells C5 and C6.
Again, when you paste this code into Excel, make sure that you start the pasting in call A1. To help with that, you may want to also copy this notice. It seems to help.