If you're seeing this message, it means we're having trouble loading external resources on our website.

If you're behind a web filter, please make sure that the domains *.kastatic.org and *.kasandbox.org are unblocked.

# Determining sample size based on confidence and margin of error

AP.STATS:
UNC‑4 (EU)
,
UNC‑4.C (LO)
,
UNC‑4.C.1 (EK)
,
UNC‑4.C.2 (EK)
,
UNC‑4.C.3 (EK)
,
UNC‑4.C.4 (EK)

## Video transcript

we're told della wants to make a one-sample Z interval to estimate what proportion of her community members favor a tax increase for more local school funding she wants her margin of error to be no more than plus or minus 2% at the 95% confidence level what is the smallest sample size required to obtain the desired margin of error so let's just remind ourselves what the confidence interval will look like and what part of it is the margin of error and then we can think about what is her sample size that she would need so she wants to estimate the true population proportion that favorite acts increase she doesn't know what this is so she is going to take a sample size of size N and in fact this question is all about what n does she need in order to have the desired margin of error well whatever sample she takes there she's going to calculate a sample proportion and then the confidence interval that she's going to construct is going to be that sample proportion plus or minus critical value and this critical value is based on the confidence level we'll talk about that in a second what Z star what critical value would correspond to a 95% confidence level x and then you would have times the standard error of her statistic and so in this case it would be the square root would be the standard error of her sample proportion which is the sample proportion times 1 minus the sample proportion all of that over her sample size now she wants the margin of error to be no more than 2% so the margin of error is this part right over here so this part right over there she wants to be no more than 2% has to be less than or equal to 2% that green colors is kind of too shocking it's unpleasant all right less than or equal to 2% right over here so how do we how do we figure that out well the first thing let's just make sure we incorporate the 95% confidence level so we could look at a z table remember 95% confidence level that means if we have a normal distribution here if we have a normal distribution here 95% confidence level means the number of standard deviations we need to go above and beyond this in order to capture 95% of the area right over here so this would be two and a half percent that is unshaded at the top right over there and then this would be two and a half percent right over here and we could look up in a Z table and if you were to look up in a Z table you wouldn't not look up ninety-five percent you would look up the percentage that would leave two and a half percent unshaded at the top so you would actually look up ninety seven point five percent but it's good to know in general that at a 95% confidence level you're looking at a critical value of 1.96 and that's just something good to know we could of course look it up on a Z table so this is 1.96 and so this is going to be 1.96 right over here but what about P hat we don't know what P hat is until we actually take the sample but this whole question is how large of a sample should we take well remember we want this stuff right over here that I'm now circling or squaring in this less less bright color this this blue color we want this thing to be less than or equal to two percent this is our margin of error and so what we could do is we could pick a sample proportion we don't know if that's what's going to be that maximizes this right over here because if we maximize this we know that we're essentially figuring out the largest thing that this could end up being and then then we'll be safe so the P hat the maximum P hat and so if you want to maximize P hat times 1 minus P hat you could do some trial and error here this is a fairly simple quadratic it's actually going to be P hat is 0.5 and I want to be I want to emphasize we don't know she didn't even perform the the sample yet she didn't even take the random sample and calculate the sample proportion but we want to figure out what end to take and so to be safe she says okay well what sample proportion would maximize my margin of error and so let me just assume that and then let me calculate it so let me set up an inequality here we want 1.96 that's our critical value times the square root of we're just going to assume 0.5 for our sample proportion of although of course we don't know what it is yet until we actually take the sample so that's our sample proportion that's one minus our sample proportion all of that over N needs to be less than or equal to two percent we don't want our margin of error to be any larger than two percent and let me just write this as a decimal zero point zero two and now we just have to do a little bit of algebra to calculate this so let's see how we could do this so this could be re-written as we could divide both sides by one point nine six one point nine six one over one point nine six and so this would be equal to on the left hand side we'd have the square root of all of this but that's the same thing as the square root of 0.5 times zero point five so that just be zero point five over the square root of n needs to be less than or equal to lecture let me write it this way this is the same thing as two over 100 so two over 100 times one over one point nine six needs to be less than or equal to 2 over 196 let me scroll down a little bit this is fancier algebra than we typically do in statistics or at least an introductory statistics class all right so see we could take the reciprocal of both sides we could say the square root of n over 0.5 and 196 over a 2 let's see what's 196 divided by 2 that is going to be 98 so this would be 98 and so if we take the reciprocal of both sides then you're gonna swap the inequality so it's going to be greater than or equal to let's see I could multiply both sides of this by 0.5 so 0.5 that's what my I said 0.5 but my fingers wrote down 0.4 it's C 0.5 and so there we get the square root of n needs to be greater than or equal to 49 or n needs to be greater than or equal to 49 squared and what's 49 squared well you know 50 squared is twenty-five hundred so you know it's going to be close to that so you can already make a pretty good estimate that it's going to be d but if you want to multiply it out we can 49 times 49 9 times 9 is 81 9 times 4 is 36 Plus 8 is 44 4 times 9 36 4 times 4 is 16 plus 3 we have 19 and then you add all of that together and you indeed do get so that's 10 and so this is a 4 teen you do indeed get 2,401 so that's the minimum sample size that Delos should take if she genuinely wanted her margin of error to be no more than 2% now it might turn out that her margin of error when she actually takes the sample of size 2,401 it if her sample proportion is less than 0.5 or greater than 0.5 well then she's going to be in a situation where our margin of error might be less than this but she just wanted to be no more than that another important thing to appreciate is it just the math all worked out very nicely just now where I got our n to be actually a whole number but if I got 2,400 and 1.5 then you would have to round up to the nearest whole number because you can't have a your sample size is always going to be a whole number value so I will leave you there
AP® is a registered trademark of the College Board, which has not reviewed this resource.