How To Set The Weighted Sample Size

From Q
Jump to navigation Jump to search

It is often desirable to choose the weighted sample size (Population) that is shown when a weight is applied to a table. For example, you may wish to have weights specified such that the Base Population matches the known population size of the country in which the study was conducted.

If you use the default settings when creating a weight in Q, the Base Population will match the Base n. The methods below can be used to choose the desired weighted sample size.

Method 1

When creating the weight in Q, you can set targets by Population numbers rather than percentages.

  1. Select Create > Variables and Questions > Variables > Weight.
  2. Under the Target Numbers section:
    1. Click Population/Count.
    2. Un-tick Force sum of weights to equal sample size.
  3. Set your weight targets as normal, but instead of specifying targets as percentages, specify counts such that they add up to the desired population number.

If using the Recompute for each option then this will result in Populations which are equal to the given total for each of the categories in the selected question.

Method 2

When the weights have been set up already, either in Q or in the raw data, then a JavaScript Variable can be created to adjust the weights. This approach is only applicable when you are weighting up to a single population total, and when the number of cases is not going to change (in other cases it is better to use the method above):

  1. In the Variables and Questions tab, right-click and select Insert Variables > JavaScript Formulas > Numeric.
  2. In the Expression use the formula: my_weight * 600 / 602
  3. Replace my_weight with the Variable Name of your existing weight variable.
  4. Replace 600 with the desired weighted sample size.
  5. Replace 602 with the current sample size in your data file.
  6. Change the Label to something appropriate, for example - Population Adjusted Weight.
  7. Click OK.