The Problem
Example: I need to calculate the minimum sample size needed to ensure that I am 90% confident that my estimate is no more than 7.5 percentage points away from the true population proportion. Such a need frequently arises in surveys, such as in this example:
A political scientist wishes to know the proportion of American voters who support the president’s agenda. She needs to ensure that her estimate is within 7.5 percentage points of the true value with 90% confidence.
With this information, calculate the minimum necessary sample size she will need.
Information given:
To summarize the above, the values of import are:
Summary statistics from the problem
\( E \)
| = |
0.075 |
\( \alpha \)
| = |
0.10 |
\( Z(\alpha/2) \)
| = |
1.645 |
Calculate these values yourself then hover your mouse over the grey spaces to see if you calculated them correctly.
Your Answer
You got the correct answer of n = 121. 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}
n &= \left\lceil 0.25\ \left( \frac{ Z(\alpha/2) }{ E } \right)^2 \right\rceil \\[3em]
&= \left\lceil 0.25\ \left( \frac{ 1.645 }{ 0.075 } \right)^2 \right\rceil \\[1em]
&= \left\lceil 0.25\ \left( 21.933333 \right)^2 \right\rceil \\[1em]
&= \left\lceil 0.25\ \left( 481.071111 \right) \right\rceil \\[1em]
&= \left\lceil\ 120.267778\ \right\rceil \\[1em]
&= 121 \end{align}
$$
And so, the minumum sample size needed is n = 121. If your sample size is at least 121, then you are guaranteed to be within 0.075 of the population proportion with 90% confidence.
Hide the R Code
Because the calculations are so straight forward, R does not have a built-in function to calculate the minimum necessary sample size. The following code echoes the above calculations to provide that sample size.
Copy and paste the following code into your R script window, then run it from there.
E = 0.075
alpha = 0.1
zvalue = abs(qnorm(alpha/2))
n = ceiling(0.250 * (zvalue/E)^2)
n
In the R output, the minimum sample size is the number output after running the final line. Note that R will give you calculations that are more accurate and more precise than doing the calculations by hand. The main source of error enters when calculating the z-value using the table. The rounding is significant.
Hide the Excel Code
Because the calculations are so straight forward, Excel does not have a built-in function to calculate the minimum necessary sample size (there are add-ins that include it, however). The following code echoes the above calculations to provide that sample size.
Copy and paste the following code into your Excel window, making sure the value sample
ends up in A1
after pasting.
How to calculate the test statistic in Excel.
E |
0.075 |
alpha |
0.1 |
|
|
Z(alpha/2) |
=ABS(NORM.S.INV(B2/2)) |
|
|
n: |
=CEILING(0.250*(B4/B1)^2,1) |
The minimum sample size is given in cell B6. Again, when you paste this code into Excel, make sure that you start the pasting in cell A1. To help with that, you may want to also copy this notice. It seems to help.