The Problem
Example #38: 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:
51, 33, 41, 27, 48, 39, 28, 35, 43, 29, 24, 44, 35, 40, 39, 41, 36, 26, 32, 41, 39
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 90% confidence interval.
Information given:
To summarize the above, the values of import are:
Summary statistics from the problem
\( \bar{x} \)
| = |
36.7143 |
\( n \)
| = |
21 |
\( \alpha \)
| = |
0.1 |
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 90% confidence: (33.9813, 39.4473). 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{90% Confidence Bounds} &= \bar{x} \pm t(\alpha/2,\nu) \frac{s}{\sqrt{n}} \\[1em]
&= 36.7143 \pm 1.725\ \frac{7.26046}{\sqrt{21}} \\[1em]
&= 36.7143 \pm 2.733 \\[1em]
\end{align} $$
Thus, we are 90% confident that the mean height for the population is between 33.9813 and 39.4473.
Note that the value following the plus/minus sign ± is known as the margin of error, \( E = 2.733 \), 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(51, 33, 41, 27, 48, 39, 28, 35, 43, 29, 24, 44, 35, 40, 39, 41, 36, 26, 32, 41, 39)
t.test(sample, conf.level=0.9)
The limits of the 90% confidence interval follow the line “90 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 | | |
51 |
s: |
=STDEV.S(A:A) |
33 |
x-bar: |
=AVERAGE(A:A) |
41 |
mult: |
=T.INV(0.05,COUNT(A:A)-1) |
27 |
lcl: |
=C3-C4*C2/SQRT(count(A:A)) |
48 |
ucl: |
=C3+C4*C2/SQRT(count(A:A)) |
39 |
|
|
28 |
|
|
35 |
|
|
43 |
|
|
29 |
|
|
24 |
|
|
44 |
|
|
35 |
|
|
40 |
|
|
39 |
|
|
41 |
|
|
36 |
|
|
26 |
|
|
32 |
|
|
41 |
|
|
39 |
|
|
The limits for the 90% 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.