As it's usual with data analysis, the first step is to understand the data we will be working with. In this case, the data is the same as in Chapter 2, Understanding Votes with Descriptive Statistics, and we have already understood some of its main characteristics. Mainly, we've understood that age, education, and race have considerable effects over the propensity to vote in favor of the UK leaving or remaining in the EU.
The focus of this chapter will be on using linear models to predict the Proportion and Vote variables, which contain the percentage of votes in favor of leaving the EU and whether the ward had more votes for "Leave" or "Remain", respectively. Both variables have similar information, the difference being that one is a numerical continuous variable with values between 0 and 1 (Proportion) and the other is a categorical...