Session Ready
Exercise

Confidence intervals

Polling data is not perfect. Most polls come with a reported "margin of error," or intervals around estimates that indicate how much true results could vary from sample proportions. In layman's terms, the margin of error is a standard 95% confidence interval around the estimated proportion.

When using polls to predict elections, we use a predictive margin of error, equal to the root-mean-square error (RMSE) of polling in previous years. You'll learn how to calculate and wrangle a variable for the margin of error in polls.

Instructions
100 XP
  • Using the dataset you created in the last exercise, find the root-mean-square of the error variable.
  • Find the standard 95% confidence interval for polling by multiplying the RMSE times 1.96.
  • Append that confidence interval, or "margin of error", to the dataset and save it to a new object, by_year.