This article describes how to create weights from variable(s) in Displayr. *Weighting* is a technique which adjusts the results of a survey to bring them into line with some known characteristics of the population. For example, if a sample contains 40% males and the population contains 49% males, weighting can be used to correct the data to adjust for this discrepancy.

- Methods
- Additional techniques
- Combining categories in an adjustment variable
- Creating two-dimensional weights
- Recomputing weights for each category in a variable (e.g. wave-based weighting)
- Making weights sum to sample size or target values
- Selecting a design weight variable
- Specifying upper and lower bounds for weights & specifying alternative weighting algorithms

- Saving a weight variable
- Using weights created outside of Displayr
- Applying weights

## Requirements

- One or more variables in your data set that you want to use as adjustment variables. These variables can be categorical or numeric.
- The targets for each category in the weight variable. These can be percentages or population counts.
**Nominal**or**Numeric**variables can be used as adjustment variables. You cannot use multi-choice variable sets.- Familiarity with weighting survey data. See: How to Weight a Survey

## Methods

### Specifying a single adjustment variable

- In the toolbar, select
**Anything > Weight** - Use the
**Adjustment Variable(s)**box menu to select a categorical or numeric variable you want to weight by. Then specify whether your targets are**Percentages**or**Population/Count**(see Making weights sum to sample size or target values).

If your weight targets are**Percentages**, the total must sum to 100. When using**Population/Count**, this indicates the target numbers are populations (also known as counts). If**Population/Count**are used as targets across multiple adjustment variables, they must all have the same total population/count. - Click the button once it becomes enabled to add the new weight to your data set. If the button is greyed out or disabled, check the Weight diagnostics at the bottom right for any errors or issues.

#### Using targets based on percentages

If your desired targets are 60% Male and 40% Female, you would specify 60 for "Male" and 40 for "Female" as below:

#### Using targets based on population / count

According to U.S. population estimates, in 2020 there are 162.83 million males and 166.24 million females.

### Specifying additional adjustment variable(s)

If you want to weight by more than one variable, click the **Additional adjustment variable set** button and select the variable you want. When you add a second adjustment variable, Displayr will start using Rim weighting or raking. For example, if you want to not only weight by Gender but also how frequently respondents drink coffee, do the following:

- Click
- Add the desired variable, which in this case is Coffee:

### Weight diagnostics

In the lower-right of the window, additional information about the weight is displayed next to the button:

These values are as follows:

**Minimum**: Minimum weight value**Maximum**: Maximum weight value**Maximum / Minimum**: the ratio between the maximum and the minimum**Effective Sample Size**: Effective Sample Size (ESS) is an estimate of the sample size required to achieve the same level of precision if that sample was a simple random sample.

## Additional techniques

### Combining categories in an adjustment variable

You can drag and drop the categories of a variable together to combine them within the weight tool. For example, in the Coffee variable, if you wanted to combine **4 to 5 days a week** with **Every or nearly every day**, simply:

- Click the
**Every or nearly every day**category - Drag and drop it on the
**4 to 5 days a week**category.

Note: your percentages will revert to 0's when you drag and drop one category on another so you will have to specify them again if you haven't already.

### Creating two-dimensional weights

Additionally, within an adjustment variable in the weighting tool, you can add additional variables to create *two-dimensional weights. *Use the **Select ****Adjustment Variable(s)** drop-down to the right of where you selected your adjustment variable.

For example, if you wanted to weight your data according to **Income** by **Gender,** you would specify:

### Recomputing weights for each category in a variable (e.g. wave-based weighting)

In some cases, you want to calculate a weight based on group membership or time period. For example, in longitudinal or tracking studies when the data is collected in waves, it may be necessary to recompute the weight for each date period (week, month, etc.). That way each wave uses the same weighting targets, but each wave's weight is calculated separately.

By default, weights in Displayr are computed for the entire data set. Using the **Recompute **feature, you can enter the targets that will be used for each wave, rather than the total sample. To do this, use a **Nominal** variable that has each "wave" as a category.

As with all Displayr's weighting, the weights are recalculated whenever new data is imported, so this option enables the weighting tool to automatically compute new weights for new waves as they appear in the data.

#### To recompute weights by category:

- From the
**Recompute weights for**menu, select the grouping variable. In this example, the variable is called Interview Date.

The categories of the variable selected in that box will be used to divide up the cases and the weight will calculate separately for respondents in each of those categories.

### Making weights sum to sample size or target values

When **sample size** is selected in this drop-down, Displayr will ensure that the final weight produces **Weighted Count **sizes that sum to the data file's sample size. When **target values **is selected, the numbers entered as targets are used to produce the final weight, so the total **Weighted Count **on tables will equal the sum of the population targets entered in the weighting tool.

In this example, the unweighted sample size is 327 but the weight has targets of 162,830,000 for men and 166,240,000 for women, so the sum of the targets in the weighting tool is 329,070,000.

### Selecting a design weight variable

*Design weights* are used to compensate for non-proportional stratification. For example, in a population containing 100,000,000 men and 100,000,000 women, if you used quotas or stratification to achieve a sample of 80 men and 20 women, then a design weight is created to take this non-proportional stratification into account. To learn more about Design Weights, click here.

To use a design weight in Displayr, use the **Select Design Weight Variable** drop down box to select the design weight variable in your data set.

### Specifying upper and lower bounds for weights & specifying alternative weighting algorithms

On the lower left, the **Minimum weight **and **Maximum weight **boxes allow you to specify upper and lower bounds for your weights. This technique is called trimming and is designed to ensure that the weight factors are calculated to within certain bounds. For example, if you if you don't want weights larger than 3, then set maximum to 3 and minimum to 0. If the bounds you set are not possible, you will get an error message to that effect.

You can also change the algorithm as well. The choices are Linear, Raking and Logit. The default is Raking. Click here to learn more about how to use trimming and the different algorithms.

By default the controls in this section are greyed out and disabled. To enable them, either select *two** or more* adjustment variables, which enables rim weighting/raking, or select a design weight variable.

### Saving a weight variable

Once you have an appropriate weight specified, on the bottom-right the **+ New Weight **button becomes active. Pressing this button takes you back to the main interface and you see the weight variable being added (saved) to the **Data Sets** tree.

### Using weights created outside of Displayr

In addition to building weights in Displayr, you can use weights calculated outside of Displayr. See: How to Use a Weight Created Outside of Displayr for more information.

### Applying weights

To apply a variable as a weight:

- Select the object (e.g., page) to be weighted.
- Choose the appropriate weight from
**Inputs > FILTERS & WEIGHT > Weight**.

## Next

If issues arise with using your weight, please see How to Troubleshoot Weights

How To Apply Different Weighting Structures To Sub-Samples

How to Create a New Variable with Merged/Combined Categories

How to Change Weighting using a Control Box

How to Apply a Weight to a Specific Column Only

How to Use a Weight Created Outside of Displayr

How to Troubleshoot Errors in Weights

## Comments

0 comments

Article is closed for comments.