1. Learn
  2. /
  3. Courses
  4. /
  5. Data Analysis and Statistical Inference

Exercise

The margin of error

Imagine you've set out to survey 1000 people on two questions: are you female? and are you left-handed? Since both of these sample proportions were calculated from the same sample size, they should have the same margin of error, right? Wrong! While the margin of error does change with sample size, it is also affected by the proportion.

Think back to the formula for the standard error:

$$SE = \sqrt{p(1-p)/n}.$$

This is then used in the formula for the margin of error for a 95% confidence interval:

$$ME = 1.96 \times SE = 1.96 \times \sqrt {p(1-p)/n}.$$

Since the population proportion \(p\) is in this \(ME\) formula, it should make sense that the margin of error is in some way dependent on the population proportion.

We can visualize this relationship by creating a plot of \(ME\) vs. \(p\).

Instructions

100 XP
  • Carefully read the code and its comments.
  • Press "Submit Answer" to see the plot appear. Make sure you understand how this plot is related to the formula for standard error, and the formula for the margin of error.
  • Do you see how the margin of error depends on the population proportion?