The Problem
Example: I need to calculate the minimum sample size needed to ensure that I am 99% confident that my estimate is no more than 5.3 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 5.3 percentage points of the true value with 99% 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.053 |
\( \alpha \)
| = |
0.01 |
\( Z(\alpha/2) \)
| = |
2.575 |
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 = 591. 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{ 2.575 }{ 0.053 } \right)^2 \right\rceil \\[1em]
&= \left\lceil 0.25\ \left( 48.584906 \right)^2 \right\rceil \\[1em]
&= \left\lceil 0.25\ \left( 2360.493058 \right) \right\rceil \\[1em]
&= \left\lceil\ 590.123265\ \right\rceil \\[1em]
&= 591 \end{align}
$$
And so, the minumum sample size needed is n = 591. If your sample size is at least 591, then you are guaranteed to be within 0.053 of the population proportion with 99% 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.053
alpha = 0.01
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.053 |
alpha |
0.01 |
|
|
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.