Sometimes it is desirable to only weight a part of the data file. For example, data may have been collected in two regions, and it may be appropriate to weight only one of those regions. The basic process is to set up a weight such that the calculations are done separately for the weighted and non-weighted part of the sample, and to then use a formula variable to remove the weighting from the part of the sample which does not need to be weighted.
Requirements
- Both the weighted and unweighted groups need to have (enough) respondents in all the target categories for the calculation to converge.
- The sample sizes of the weighted/unweighted respondents do not need to match before and after weighting the data.
If either requirement is not met, you will need to use the How To Apply Different Weighting Structures To Sub-Samples process, which is more robust.
Method
Part 1 - Create a filter to identify the sample to be weighted
The first step is to create a variable that separates the part of the sample you want to weight from the total sample.
- Create a filter that represents the respondents to be weighted, calling this filter Sample to be weighted.
- In the Variables and Questions tab, change the Name for the filter to weighted.
Part 2 - Set up the weight variable
Next, you need to set up the weight. This is the same as a normal weight, but incorporates the variable you made above.
- In the Variables and Questions tab, right-click and select Insert Variables > Weight.
- Set up your weight in the normal way, as though you were setting targets for the total sample. For more info on setting targets, see How to Configure a Weight from Variable(s).
- In the Recompute weights for menu, select your Sample to be weighted filter.
- Click OK.
- Change the Name of the newly-created variable to totalWeight.
Placing the Sample to be weighted variable into the Recompute weights for menu causes the weight to be calculated separately for the part of the sample that you want to weight and for the part of the sample that you don't want to weight. While we won't use the weight values that are calculated for the part of the sample which will remain un-weighted, Q does require that a valid weight value be computed for all parts of the sample.
Part 3 - Reset the values for the un-weighted part of the sample
Finally, you can use a formula to reset the weight values for the part of the sample that does not need to be weighted. This is done by assigning a value of 1 in place of the weight values that were calculated in the last section.
- In the Variables and Questions tab, right-click on the row number to the left of totalWeight and select Insert Variable(s) > JavaScript Formula > Numeric.
- Change the Label of Partial Weight.
- Enter the Expression: if (weighted) totalWeight; else 1
- Press OK.
- Press the yellow W for the variable in the Tags column.
Your weight is now ready to use.
Next
How to Configure a Weight from Variable(s)