In this video, we are going to work backwards with confidence intervals. Specifically, we're going to learn how to calculate the required sample size to achieve a certain margin of error. We're also going to discuss sample size versus accuracy. So there's an interplay between these two. What happens to the accuracy of the confidence interval as the sample size increases or decreases? Given a target margin of error, confidence level, and information on the variability of the sample or the population, we can determine the required sample size to achieve the desired margin of error. We do this by plugging known values into the equation of the margin of error and then rearranging things to solve for the unknown and the sample size. Perhaps this concept is best communicated by an example. So let's do that. Suppose a group of researchers want to test the possible effect of an epilepsy medication taken by pregnant mothers on the cognitive development of their children. As evidence, they want to estimate the IQs of three-year-old children born to mothers who were on this medication during their pregnancy. Previous studies suggest that the standard deviation of IQ scores of three-year-old children is 18 points. How many such children should the researches sample in order to obtain a 90% confidence interval with a margin of error less than or equal to four points? So, we know that the desired margin of error is at most four points. We also know that the confidence level we're going to use is 90%. Therefore the critical value associated with a 90% confidence level is 1.65. You can confirm this number using R or a table or the output. Lastly, we know that the standard deviation of IQ scores of these children is going to be 18 points. So, since here we're referring to all children, I've just denoted that as sigma. Sigma is 18. So what we need to do next, is plug everything that we know into the equation for the margin of error and solve for the n, the sample size that we need to make this margin of error happen. That's four, for the margin of error, equals 1.65, the critical value, times the standard error, that's 18 divided by square root of n. We can move n to the other side of the equation. So, swap n and four and square both sides. And we could write out the equation one more time as 1.65 times 18 divided by 4. Square everything up, this gives us 55.13 as the result. However, since we can't really have 0.13 of a person, we're going to need to round this number. Mathematically this number should round down to 55. However, if we're saying 55.13 is the minimum required sample size it really doesn't make sense to go any lower then that. So even though mathematically this number will be rounded to 55, actually in calculations of minimum required sample size, regardless of the value of the decimal, we always want to round up. Therefore, we need at least 56 such children in the sample to obtain a maximum margin of error of four points. Earlier we found that we needed at least 56 children in the sample to achieve a maximum margin of error of four points. How would the required sample size change if we want to further decrease the margin of error, to two points? We can certainly do this by solving directly for n again, but we can actually also make use of our solution from earlier. Here's the formula again for the margin of error. We have the z*, our critical value times s over square root of n. The previous desired margin of error was four and the new desired margin of error is two points. Therefore, to go from four to two, we can multiple both sides by one-half. This is equivalent to multiplying the sample size by four actually, since the sample size is in denominator and under the square root sign. Long story short, to cut the margin of error by half, we need to quadruple our sample size. This is important for two reasons. You are going to find yourself in many instances suggesting to yourself or other researchers that if they want better results or more accurate results that they should increase their sample size. This is indeed true. However, we can see that in order to start really seeing gains from an increased sample size, you may need to really, really increase your sample size. And that's going to take resources. In addition, we've seen before that n, our sample size, and the margin of error are inversely proportional. But now we have seen that their relationship is actually exponential as well.