Member-only story

Survey Weights in R

Anthony B. Masters
2 min readNov 2, 2019

--

The analysis of survey data usually uses weighting, to make the sample look more like the intended population of the survey.

This article looks at the basic tools in Prof Lumley’s survey R package.

Weighting with dummy data

What weights should be used is a major question in survey research. (Photo: Steen Jepsen/Pixabay)

Weights are often discussed in the analysis of survey data. As an example, if there are slightly fewer women in our sample than we would expect (based on information from the census), researchers may then ‘weigh’ the survey data so the responses for women count for a little more.

I start off by creating some dummy survey data, sampling four variables — meant to resemble age, income, gender and region.

Prof Lumley (University of Auckland) authored the survey package to analyse complex survey data — a major impetus for statistical analysis.

Once we have the survey data, we need to create a survey design object to represent the survey’s design.The svydesign function takes three main arguments:

  • ids: this is used to identify clusters, or ~0 or ~1 if there are no clusters;
  • data: this is the survey data-set;
  • weights: this is the weights used for that data-set, or NULL for unweighted data.

--

--

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