Calculating ratios

Protobi is smart enough to make calculating ratios simple

38d87d9852a66eea29da00ae16511664

Updated at February 10th, 2020

Let's say your survey asked for quantities in absolute counts. But now you want the option to report them as percentages. This tutorial demonstrates how you can do just that, and correctly preserve percentages, frequencies and averages.

Example

Here, we have two questions:

  • S8: How many patients do you treat for Condition X?
  • Q1: How many of those patients do you treat with a Gamma Agonist?

To create an element that displays percentages of respondents' patients being treated with a Gamma Agonist we need to calculate a ratio (Q1 / S8).

Calculate ratios of elements

First, we've cloned Q1 to create a new element and named it Q1vS8 (see Move, mirror, clone tutorial.) You don't have to clone the element, but you may want to see both the original counts and the ratio.

For the new element, press the circle edit icon and choose "More properties..." from the context menu. Then, next to "denominator" enter "S8" and press Ok.

Voilá! We now have a new element that is defined as Q1 / S8.

Note: In this example we also set the "scale" to 100 in the "More Properties..." menu. As an analyst you may be familiar seeing percentages in the interval of 0 to 1. But your client may prefer to see ratio on an interval of 0 to 100.

Means are ratio of averages

By default, when you use the "denominator" property, the mean is intelligently weighted to show the ratio average, (i.e., the sum of numerators over sum of denominators, excluding rows with missing values for either). You can verify this yourself, as 12.1 / 36.9 x 100 = 32.8.

Alternative: average of ratios

If you want to calculate average of ratios-- as in, calculate Q1/Q8 for each respondent, and then average the resulting ratios, you can turn ratioMean off be using the attribute in JSON:

"ratioMean":false 

Video tutorial




Was this article helpful?