Sometimes there is a need to create weights using data which includes people that screened out of a study. This is to reduce the selection bias for how people who were screened in might not be a representative sample of the population. Thus including the people who were screened out adjusts the weighting to be more reflective of reality. For example, the first two questions may be age and gender and the third question the screener, but there is a need to weight the age and gender of those screened into the study to the entire population/those who received the study.
Requirements
- A data file that includes the data for the respondents that were screened out but need to be taken into account when creating the weight.
- A Unique identifier selected for the data set, see How to Delete Cases From a Data Set.
Please note these steps require a Displayr license.
Method
Note if the data file is huge, you should perform this process in a data preparation document and import the revised data set into the document you are using for reporting, see Create a Separate Data Preparation Document.
- Create the weight, see How to Configure a Weight from Variable(s) using data across all respondents, including those screened out.
- Now you will need to hardcode these values so that they don't change when you delete the respondents that are screened out. In the Data Sources pane, right click on the weight variable and View in Data Editor.
- Right click on the column in the Data Editor and click Copy.
- Paste into Excel and change the name in the header to something different (must follow typical variable naming conventions in Displayr).
- Copy the data from Excel including the header.
- Right click on the original weight column in the Data Editor and Insert new variable(s). This pastes in hardcoded values for the weight in your data set. (If you haven't set your unique identifier you'll get an error.)
- Select the new variable and in the object inspector change Structure > Numeric and check Usable as a weight.
- Delete the respondents in the data set that were screened out of the study, see How to Delete Cases From a Data Set.
Rescaling the weight so it has an average of 1.0
If you wish to rescale the variable so that it has an average of 1.0:
- In the Data Sets tree, hover and click + > Custom Code > R-Numeric.
- In the object inspector > R CODE paste in the following code and modify based on your weight variable name:
#rescale weight to 1 - replace theweight below with the name of your weight variable
theweight/Average(theweight) - Click Calculate if it doesn't calculate automatically.
- Check Usable as a weight to have it show up in the Weight dropdown on items.