Weights

Set global or respondent-level weights

38d87d9852a66eea29da00ae16511664

Updated at March 6th, 2020

Protobi allows you to weight data with respondent-level weights.  

By default, Protobi counts each respondent equally. In practice we may need to weight some responses or respondents more than others.

Why weight?

A survey sample might not exactly match the population in some aspect. For instance, in a survey of 1000 consumers we collect a sample that has 600 male and 400 female respondents. However, there is other data that tells us the actual market in that category is 50% male and 50% female. 

In this case, we might need to differentially weight the responses to match the population:

  • Up-weight female respondents by 1.250 (i.e. 400 x 1.250 = 500)
  • Down-weight male respondents by 0.8333 (i.e. 600 x 0.8333 = 500)

In another scenario we might sample one population, but project to another. In a survey of physicians about their treatment patterns, some physicians may treat many patients and some fewer. We might weight respondents by the number of patients the physician treats, so that the results are projectable to the patients they treat.

Define a weight column or value

In your data file

To weight data differentially in Protobi, your dataset must have a column that has a weight value for each respondent. If the column is not already in your data file, you can add it manually and upload the revised data. You name the weight field anything, e.g., 'RESP_WT'. In the example above, the column would have the value 1.25 for female respondents, and 0.8333 for male respondents.

If your SPSS SAV file does identify a weight column, Protobi should automatically recognize it as a global weight.

In Protobi

Alternatively, you can define a weight as a scalar (e.g. 1.02 or 100), instead of a field name. This can be useful if you need to weight all respondents equally but by some number other than one. This works with both global and individual weights.

Set individual weights

More properties dialog

For individual elements specify weights by selecting "More properties" from the context menu. Next to the "weight" field you can enter the data column to reference. 

You can also enter Excel-like formulas to specify weights. 

Below are a few examples:

  • =q1 *q2
  • =q1 * q2 * q3
  • =q1 * ( (+q4_1) + (+q4_2) + (+q4_3))

Note: When adding numbers you need to include a "+" sign before the variable name to tell it to add numerically (2+7=9) not alphabetically ("2" + "7" = "27").  You can avoid doing this if you create a new data column (e.g. q4_sum) to reference instead.

If weights are specified, a default footnote appears, unless you overwrite the footnote yourself.

In JSON editor

Weights for an individual element can be set in JSON as well. Select the element and press "Edit JSON...." to modify the element properties in JSON syntax. Define a property "weight" with the name of the weight field.

Weights on individual elements override any global weights. For instance, to avoid weighting the global weight field by itself, we can specify "weight": null.

The example below is from the car_sales.sav dataset and here we're weighting automobiles by the field sales :

Set a global weight

You can define a weight field globally that applies to all elements. Press the icon under the toolbar to edit Project properties. Enter the name of the column specifying weights.




Toggle weights on/off

If a global weight field is defined for your dataset (e.g., using data column S8), you'll see a new toolbar button "S8" representing the weight that the project is using. 

You can press this to toggle weights on or off. Its name will change from "Weighted" to "Unweighted" so you can quickly see if the results are weighted or unweighted. "Weighted" is the default.

Define more than one global weight scheme

Protobi can include multiple weight schemes. For instance, a study may weight data differently to project results to the population of patients and physicians.   

Protobi looks for a special group element with the key $weights, and interprets each child element of this group as a weight scheme to appear in the Weights dropdown.

Press on the button at the end of the list of tabs, and enter "$weights". This will find or create a group with that key. Within this group add child elements corresponding to each weight column. One way is to drag weight elements from the the tree on the left and drop them into the $weights group (optionally hold the Shift key when dropping to copy rather than move).

Alternatively you can directly specify weight columns by editing the JSON for the $weights group. For example:

{
    "roundby": "auto",
    "key": "$weights",
    "children": [
        "S8v1",
        "S1",
        "S2"
    ],
    "type": "empty"
}

Now the dropdown menu in the Weight button in the toolbar will contain all the children as global weight schemes:


Video Tutorial






Was this article helpful?