Set global or respondent-level weights


Updated at January 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.

1. Define a weight column or value

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 dataset, you'll need to add it and upload the revised data. If your SPSS SAV file identifies a weight column, Protobi should recognize it as a global weight.

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.

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.

2. Set a global weight

You can define a weight field globally that applies to all elements. Press the icon in the toolbar to edit project properties, and select "Weight field". Enter the name of the column specifying weights.

3. Set individual weights

In Protobi you can set weights for an individual element. Select the item and press "Edit...." This will bring up an advanced edit dialog with the element properties in JSON syntax. Define a property `"weight"` with the name of the weight field.

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

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

4. 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.

5. 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": [
    "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?