Millisecond Forums

Integrating a pre-defined randomization list in script

https://forums.millisecond.com/Topic19661.aspx

By thestruggleisreal - 9/6/2016

Hi
We’re planning a study that includes 3 versions of a GO/NoGo Task with Inquisit web. These versions only differ regarding the GO/NoGo ratio. Is it possible to include these 3 versions within one script and that participants are assigned to one of the three conditions at login ?
Our idea is that the script includes a list (i.e. our randomization list, which is pre-defined according to a stratified randomization strategy) in which participant numbers are assigned to one of the three conditions (e.g. participant 001 = condition 3, participant 006 = condition 2, participant 134 = condition 3). We would like for the participant to log in with his/her number and automatically be presented with the assigned condition. Does anybody have an idea what could be done here?
Thanks in advance for your advice !

By Dave - 9/7/2016

You should set up a <batch> script like so.

<batch>
/ subjects = (1 of 3)
/ groupassignment = groupnumber
/ file = "a.iqx"
</batch>

<batch>
/ subjects = (2 of 3)
/ groupassignment = groupnumber
/ file = "b.iqx"
</batch>

<batch>
/ subjects = (3 of 3)
/ groupassignment = groupnumber
/ file = "c.iqx"
</batch>

where a, b and c.iqx are your three versions / conditions of the go-nogo. Call the file containing the 3 <batch> elements "batch.iqx" and register it as your active web script (you upload then "actual" scripts a to c in the next step along with any other files those scripts need).

Configure your web experiment to read both the subject id AND the group id from URL query parameters. You can then ensure that a given subject receives the proper, pre-assigned condition by simply giving them an individualized link:

https://research.millisecond.com/yourusername/batch.web?subjectid=1&groupid=3

and so forth.
By thestruggleisreal - 9/7/2016

Hi Dave
Thanks so much for your answer! However, I should have also mentioned that we're conducting a double-blind randomized study so the problem is that I would see which condition was assigned to which participant. It's important that I who will be interacting with the participants (including starting the Experiment) may not see which condition was assigned to which participant. So what we would like to have would be a list that we could integrate in the script but that an independent blinder could then alter (e.g. participant 001 = condition 3, participant 065 = condition 1 etc.) without us seeing it. That way, the participant would just enter his/her number and be refered to the assigned condition. Since our participants are in-patients, some of them with few cognitive resources nor email access, it is unfortunately not possible for the blinder to directly send a link to participants.

I would be very grateful if you knew another way of handling this.

Thanks again for your support!
By Dave - 9/8/2016

Okay, then you need to make use of conditional <include> elements and list the respective subject ids as /precondition:

A file called main.iqx would contain something like this:
// subject ids that should be administered condition #1
<include>
/ precondition = [script.subjectid == "002" || script.subjectid == "003" || script.subjectid == "008" || script.subjectid == "011"
]
/ file = "condition_1.iqx"
</include>

// subject ids that should be administered condition #2
<include>
/ precondition = [script.subjectid == "001" || script.subjectid == "004" || script.subjectid == "009" || script.subjectid == "012"
]
/ file = "condition_2.iqx"
</include>

// subject ids that should be administered condition #3
<include>
/ precondition = [script.subjectid == "005" || script.subjectid == "006" || script.subjectid == "007" || script.subjectid == "010"
]
/ file = "condition_3.iqx"
</include>

with "condition_1.iqx", "condition_2.iqx" and "condition_3.iqx" being the "actual" go-nogo scripts.

Basic example attached. Double-click on main.iqx and enter a subject id between 001 and 012 -- the appropriate condition script will be administered. This would work the same way on the web -- you register "main.iqx" as your active web script, upload the to-be-included "actual" scripts, and configure your launch page to have participants enter their pre-assigned ID.
By thestruggleisreal - 9/8/2016

Hi again, Dave!
Thank you so much for your help, which is very much appreciated. We'll try what you suggested!
By tela - 9/14/2016

Thanks for the suggestions.
I am somewhat concerned about equal assignment of conditions, so I am a bit apprehensive to use random assignment.

The other solution you suggested (precondition) would work if I could do something like:
<include>
/ precondition = [script.subjectid < "5000" ]
/ file = "condition_1.iqx"
</include>

We have generated random IDs for participants, but they can be sorted. One more question, can precondition be included in the block element so that I don't have to separate the two conditions into separate files? Or perhaps I could use branch for that? Currently I have for condition 1:

<expt>
/ subjects =  (1 of 2)
/ groupassignment = subjectnumber
/ preinstructions = (welcome_p)
/ blocks = [1 = consent_b; 2 = practice_b; 3 = subprime_trust_b; 4 = playerA_b; 5 = donation_b]
</expt>






By Dave - 9/15/2016

What <include> does is effectively paste the contents of one file (the one referenced in the <include> element) into another file (the one that contains the <include> element). <include> is the very first thing that gets executed when Inquisit parses a script -- there is no way to have it in a <block> element. I don't see how /branch gets you anywhere here either. If you have two conditions that only differ in their respective <expt> definitions, you'd have

- One file that contains everything *except* any <expt> element. That file contains your <include> elements.
- Two additional files that each contain the respective <expt> element only -- one file with the <expt> definition for the 1st condition, one file with the <expt> definition for the 2nd condition.
By AnnaSchimm - 7/11/2017

Dave - Wednesday, September 7, 2016
You should set up a <batch> script like so.

<batch>
/ subjects = (1 of 3)
/ groupassignment = groupnumber
/ file = "a.iqx"
</batch>

<batch>
/ subjects = (2 of 3)
/ groupassignment = groupnumber
/ file = "b.iqx"
</batch>

<batch>
/ subjects = (3 of 3)
/ groupassignment = groupnumber
/ file = "c.iqx"
</batch>

where a, b and c.iqx are your three versions / conditions of the go-nogo. Call the file containing the 3 <batch> elements "batch.iqx" and register it as your active web script (you upload then "actual" scripts a to c in the next step along with any other files those scripts need).

Configure your web experiment to read both the subject id AND the group id from URL query parameters. You can then ensure that a given subject receives the proper, pre-assigned condition by simply giving them an individualized link:

https://research.millisecond.com/yourusername/batch.web?subjectid=1&groupid=3

and so forth.

Does this also work if I am counterbalancing the order of 3 tasks, thus 6 groups? ex:

<batch>
/ subjects = (1 of 6)
/groupassignment = groupnumber
/ file = "practice.iqx"
/ file = "negative.iqx"
/ file = "neutral.iqx"
/ file = "color.iqx"
/ file = "end.iqx"
</batch>

<batch>
/ subjects = (2 of 6)
/groupassignment = groupnumber
/ file = "practice.iqx"
/ file = "negative and neutral.iqx"
/ file = "color word.iqx"
/ file = "neutral.iqx"
/ file = "end.iqx"

etc. 

How can I have subjects randomly assigned to each group? 
By Dave - 7/11/2017

AnnaSchimm - Tuesday, July 11, 2017
Dave - Wednesday, September 7, 2016
You should set up a <batch> script like so.

<batch>
/ subjects = (1 of 3)
/ groupassignment = groupnumber
/ file = "a.iqx"
</batch>

<batch>
/ subjects = (2 of 3)
/ groupassignment = groupnumber
/ file = "b.iqx"
</batch>

<batch>
/ subjects = (3 of 3)
/ groupassignment = groupnumber
/ file = "c.iqx"
</batch>

where a, b and c.iqx are your three versions / conditions of the go-nogo. Call the file containing the 3 <batch> elements "batch.iqx" and register it as your active web script (you upload then "actual" scripts a to c in the next step along with any other files those scripts need).

Configure your web experiment to read both the subject id AND the group id from URL query parameters. You can then ensure that a given subject receives the proper, pre-assigned condition by simply giving them an individualized link:

https://research.millisecond.com/yourusername/batch.web?subjectid=1&groupid=3

and so forth.

Does this also work if I am counterbalancing the order of 3 tasks, thus 6 groups? ex:

<batch>
/ subjects = (1 of 6)
/groupassignment = groupnumber
/ file = "practice.iqx"
/ file = "negative.iqx"
/ file = "neutral.iqx"
/ file = "color.iqx"
/ file = "end.iqx"
</batch>

<batch>
/ subjects = (2 of 6)
/groupassignment = groupnumber
/ file = "practice.iqx"
/ file = "negative and neutral.iqx"
/ file = "color word.iqx"
/ file = "neutral.iqx"
/ file = "end.iqx"

etc. 

How can I have subjects randomly assigned to each group? 

It works the same no matter how many groups / conditions there are, whether it be 2, 3, 6, 12, 42 or more.

> How can I have subjects randomly assigned to each group?

Assuming you are deploying this online via Inquisit Web, you simply have the launch page generate a random group id (that's the default option anyway).