How to randomise users into more than two groups

From Lifeguide Wiki
Jump to: navigation, search

Randomisation Example: Splitting end-users into more than two groups

Splitting end-users into more than two groups requires additional logic commands. This is because once you have split the end-users once on one line of logic you will have less to go into the next line of logic, meaning that end-users will not be evenly split between them. This is best explained by an example:

If your smoking questionnaire was split into three groups (those shown no images, those shown images relating to health consequences to the person and those shown images of how smoking my impact on children) and you wanted end-users to be split evenly into these three groups you cannot simply use the following logic.

after welcome if (randomnumber (0,2) = 0) goto group3 *

after welcome if (randomnumber (0,2) = 1) goto group2 **

  • 33% of end-users will be split into group3
    • 33% of the remaining 66% will go to group2 (so only 21.8% of users)

Leaving the last 45% (those randomised as 2) to go to group1

One way to get around this problem would be to use the following logic:

after welcome if (randomnumber (0,2) = 0) goto group3

after welcome if (randomnumber (0,1) = 0) goto group2

as 50% of the remaining 66% (ie 33%) will go to group2, and the other 33% will go to group1. However, this can get complicated with more and more groups, so a simpler method might be to use the set command. See the example below.

show welcome

• Shows end-users the first page of the intervention which has been given the unique name welcome

set random to randomnumber (0,2)

• This command sets the variable random to whatever randomnumber the end-user is assigned to (either 0, 1 or 2). This variable could be named anything at all as long as it is unique and you use that same variable name in the logic every time you want to refer to an end-users’ randomisation number.

after welcome if (random = 0) goto group1

after welcome if (random = 1) goto group2

after welcome if (random = 2) goto group3

This logic then sends users to the corresponding sections for their group. So those randomised to 0 will go to group1, 1 to group2 and 2 to group 3.

begin group1

show q1p1

show q1p2

• Unlike Randomisation Example 1, it does not matter which order you present the sections as only those set to that group will be able to view the corresponding section. • The last page on each section will either need a jump button to a final page that users of both groups can see (as in this example) or no button at all. If this page had a next button end-users of the first group will then go straight into the section for the second group.


• Whenever you start a section you must remember to end it with the command end (this is explained in the Logic Dictionary)

begin group2

show q2p1

show q2p2


• Shows the pages for group2 that only those randomised to 1 will see.

begin group3

show q3p1

show q3p2


• Shows the pages for group3 that only those randomised to 2 will see.

show final

• Shows all users the final page for the intervention.