Session Ready
Exercise

Calculating error in polls

It is almost always important to know how accurate your data are before you try to predict anything with them. In predictive analytics, especially in politics, we always want to check the past predictive accuracy of our data before making new predictions with them.

In this exercise, you will use your R skills to answer the question: How good are polls at predicting vote outcomes?

Instructions
100 XP
  • Mutate two variables: one each for the Democratic margin in election polls, called Dem.Poll.Margin, and one for the and actual vote margin, called Dem.Vote.Margin, since 1990.
  • Group the dataset by the ElecYear variable and summarise a mean of all the polls.
  • Mutate a variable named "error" that is equal to the difference between the Dem.Poll.Margin and Dem.Vote.Margin variables.