March 16, 2020 The BMS lab

Calculated variables

Quick guide

Calculated variables are made up of the participant’s answer on an specific item within a module.

Create Calculated Variables

Step 1. Choose the item


  1. On the left menu, click on the tab named “Modules”
  2. Open your module
  3. On the right side, click on “Content items”
  4. Choose an item
    Note: Calculated variables will only work with numerical item types (Number input, number slider, number dropdown, and number choice).

Step 2. Enable numeric calculation


Once you have chosen your item, a preview screen will open.
1. After filling in the details of your item, tick the box next to “Used for numeric calculation”
2. Give your numeric calculation a name
Note: no whitespace is allowed
3. Click on the “Save” button

Step 3. Add calculated variable


  1. On the left menu, click on the tab named “Calculated Variables”.
  2. Click on the “Add calculated variable” button 
  3. Enter a unique calculated variable name in ID and a description  
    Note 1: Names of calculated variables must have at least a letter and can have an underscore, and numbers. 
    Note 2: Calculated variables are unique so they cannot be repeated in the same study.  
  4. Input your equation
    Note: Under functions, use the list of formulas to create calculated variables easier 
  5. Click on the “Save” button

Functions explained

Functions:

  • “+” gives the addition of variables
  • “-” gives the subtraction of variables
  • “*” gives the multiplication of variables
  • “/” gives the division of variables
  • “^” gives the exponential value of a number
  • “SUM_ANS(N)” gives the sum of the different participant responses of the variable.
  • “NUM_PS(N)” gives the total number of participants for an indicated variable. Example: three participants are assigned to an intervention, this function will return 3.
  • “NUM_P_ANS(N)” provides the number of participants who answered the indicated variable. Example: three participants are assigned to an intervention, two gave an answer. This function will return 2.
  • “MODE_ANS(N)” gives the most responded number of the indicated variable.
    Note: If there is no mode this function will return the average.
  • “COUNT_ANS(VAR,VAL)” provides the number of times the value of the responses were given in the indicated variable.

Calculated variables as feedback

Step 1. Enable dynamic text


  1. On the left menu, click on the tab named “Modules”
  2. Use a different module by creating a new or using an existing module 
  3. On the right side, click on “Content items”
  4. Create a new item or choose an existing item
    Note: any item type would work
  5. In the question field, click on “Dynamic text”

Step 2. Select calculated variable


  1. On the pop-up screen, click on “Select calculated variable”
  2. In the dropdown list, select your calculated variable
  3. Click “Ok”
    Note: A code will now appear on the preview screen. This code will show a number once the items used for the calculated variable are filled in by the participant.

Calculated variables for time rule intervention


  1. After you have created your calculated variables, click on the tab named “Interventions” on the left menu
  2. Open an intervention
  3. On the right side of the screen, click on “Modules”
  4. Click on the alarm clock symbol next to the module you want to time
  5. Click on the “Enable Timing Rules” button
  6. Choose “Based on a calculated variable”
  7. Select the equal or not equal qualifier
  8. Select the value
    Note 1: If you want to add multiple timing rules together, click on “Add Rule” each time you add one rule
    Note 2: If you want to add multiple timing rules separately, click on “Add Timing Rule” each time you add one rule
  9. Once you have finished adding the timing rules, click on the “Save” button

For more information on time rule interventions, see https://bmslab.utwente.nl/time-rule-interventions/