Randomisation

From Lifeguide Wiki
Jump to navigation Jump to search

Randomisation in LifeGuide

A simple line of logic can be written to enable your intervention to automatically randomise end-users into different groups.

This is done using the command randomnumber followed by the range of groups (as a numerical value) that you wish to randomise end-users into.

For example:

after page1 if (randomnumber (0,1) = 0) goto page5

show page2

– end-users will be automatically randomised into two groups (0 and 1). End-users have a 50/50 chance of going to the ‘0’ group or the ‘1’ group. If they are in group 0 they will be sent to page5 all other users (i.e. those in group 1) will go to the next line of logic.

If the logic command included randomnumber (0 , 3) – end-users will be automatically randomised into 4 groups (0, 1, 2, and 3). End-users have a 25% chance of going into group 0, 1, 2, or 3.

The rest of this section will give some examples of the use of randomisation and a further explanation of how the logic commands are used.

Here you can view the pages alongside the tutorial or download the files so you can view the full logic file and the intervention pages

Randomisation Example 1: Splitting end-users into two groups

A study exploring the perspectives of taking up smoking

A demo of this example is available at the following address: http://www.lifeguideonline.org/manager/intervention/show/10

This example requires end-users to be automatically randomised into one of two groups; group 1 will receive questions about the uptake of smoking alongside images of health messages whilst group 2 will receive only the questions. If this were a real study the purpose of this might be to see how the presence of the images might affect the answers given.


show welcome

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

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

• This is the command that randomises end-users into one of two groups and then sends them onto the right section. So a more detailed explanation of this logic sees that after the end-users have moved past the welcome page they will be automatically assigned to one of two groups using the command randomnumber (0,1). Those in the ‘0’ group will then be sent to the section that has been labelled group2

NB: It is important that you do not repeat the logic command for group 1 as otherwise that will not be split evenly (see explanation in example 2 below)

begin group1

show q1p1

show q1p2


• The other 50% of end-users will be sent to the section for “group1”. This consists of two pages of questions named q1p1 and q1p2.

• It is important for this section to come before the section that the rest of the group has been sent to in the randomisation logic. If not the logic will simply move onto the next line of commands and send all end-users to that group.

• The last page on each section will either need a jump button to a final page that users of both groups can see (as has been done on q1p2 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.

end

• Remember that 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

end

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

show final

• Shows all users the final page for the intervention.

Randomisation Example 2: 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.

end

• 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 end

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


begin group3 show q3p1 show q3p2 end

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


show final

• Shows all users the final page for the intervention.


Randomisation Example 3: Other randomisation functions

This example shows two other randomisation functions:

  1. ) Multiple randomisations – splitting users into groups and then splitting them off again
  1. ) Unequal randomisation – sending more end-users into one group than another.

For this example, end-users are again asked about their perspectives of taking up smoking.

They are first split into two groups:

- group 1 – who will see health messages - group 2 – who will not see health messages

We want the majority of group 1 to see health messages that include images and words, so we will send around 66% of those in group 1 to this condition and the remaining 33% will view health messages made up of words only.

show welcome

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

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

• This is the first randomisation which will split end-users equally into either group1 or group2

begin group2 show q1p1 show q1p2 end

begin group1

show explain

• Show explain’ refers to a page that will explain a bit more about the questionnaire. Here, we have a page that all of the end-users in group1 will see so that we can then write the randomisation commands that can then split them back up again.


set random to randomnumber (0,2)

• This is randomising and setting end-users into one of three groups (0, 1 or 2).

after explain if (random <= 1) goto imageonly


• All end-users randomised to 1 and below will be sent to the ‘imageonly’ page which shows end-users health warnings containing images. This means that those in 0 and 1 (around 66%) will view this condition.


after explain if (random = 2) goto words

• Those randomised to 2 will be sent to the ‘words’ page, a page set up to display written health messages about smoking.

show words show imageonly

• The buttons on the ‘words’ and ‘imageonly’ pages are set to all jump to the ‘q2p1’ page where end-users are asked questions about their perspectives of smoking

show q1p1 named q2p1 show q1p2 named q2p1

• As the show logic cannot be used more than once for each page the named key command is used to enable these pages to be re-shown for those who have not seen them earlier on in the logic.

end



show final

• All end-users, including those in group2 are then directed to the same final page.