Member-only story

Applying Weights

What difference does applying survey weights make?

Anthony B. Masters
3 min readAug 4, 2020

Weights adjust survey responses, when producing survey statistics.

This article looks at R code for applying survey weights. We find the difference that applying those weights make.

Importing the data

This article uses European Social Survey data for the United Kingdom. NatCen conducted the ninth wave, interviewing 2,204 UK adults aged 15 or over. These face-to-face interviews were between 31st August 2018 and 22nd February 2019.

The question of interest is:

If there were to be a new referendum tomorrow, would you vote for the UK to remain a member of the European Union or leave the European Union?

First, let’s import the SAS data file into R, with the haven package:

ESS09GB_sav <- read_sav("ESS9GB.sav")

In its current form, responses to the EU referendum vote intention question look like:

  • 1: Remain a member of the European Union;
  • 2: Leave the European Union;
  • 33: Would submit a blank ballot paper.

There are other coded responses too. The data file does not code unsure or refused responses. This is not as useful as it could be. We need to replace the enumerated responses with what they mean in the code book:

ESS09GB_sav_df <- ESS09GB_sav %>%

--

--

Anthony B. Masters
Anthony B. Masters

Written by Anthony B. Masters

This blog looks at the use of statistics in Britain and beyond. It is written by RSS Statistical Ambassador and Chartered Statistician @anthonybmasters.

No responses yet