Prepare your dataset

For this section we will be using data from the ‘British Election Study’ survey to investigate the effect of perceptions about the economy on party choice. This is part of a broader research examining the effect of political issues on party choice and especialy on the effect of the economy on the party in government.

Lewis-Beck, Michael S., and Martin Paldam. “Economic voting: an introduction.” Electoral studies 19.2-3 (2000): 113-121.


We will analyse data from the 2017 general election, and we will test whether citizens’ who feel that the economy is doing better will support the party in government.

We can download the full dataset from the website below:

British Election Study

We should download the post-election study entitled: 2017 Face-to-face Post-election Survey Version 1.3

We will use the following variables from the dataset:

Name Description (name in the dataset in parenthesis)
incumbent (1) The respondent will vote for the party in government (0) will vote for another party (b02)
left-right position on the left- right spectrum (e01)
egocentric_retro retrospective evaluation of personal finances (l01)
egocentric_pros prospective evaluation of personal finances (l02)
sociotropic_retro retrospective evaluation of UK’s economy (l04)
sociotropic_pros prospective evaluation of UK’s economy (l03)

Create a subset

Our next step is to create a sub-set including only the variables we will include in our analysis

eco_voting<-bes %>%select(b02,Age,edlevel,e01,l01,l02,l03,l04,p01)

Note: If you use RStudio, you can type the pipe (\(%>%\)) with Ctrl + Shift + M if you have a PC or Cmd + Shift + M if you have a Mac.

Assign missing cases

Our next step is to replace the negative values (-1, -2) to NAs

eco_voting[eco_voting <=-1] <- NA
eco_voting[eco_voting <=-2] <- NA

Rename your independent variables

We will use the rename() function which is part dplyr:

eco_voting<-eco_voting %>% rename(left_right=e01, egocentric_retro=l01,egocentric_pros=l02,sociotropic_pros=l03,sociotropic_retro=l04,brexit=p01)