Session Ready
Exercise

Training a model

In this exercise, you will extend the generic ballot model you made in chapter 2 by adding a new variable, the party_in_power variable, so that your linear regression model can know which party is currently in control of the presidency. Adding more than one variable to a regression model changes is from a bivariate model to a multivariate model.

The dataset you'll use is called polls_predict and has already been loaded for you.

Instructions
100 XP
  • Specify a linear model to predict the Democratic vote share in congressional elections since 1980, Dem.Vote.Margin, with the average polling margin since August and November, Dem.Poll.Margin, and a variable indicating which party the president belongs to, party_in_power.
  • Create a summary of the linear model.