Randomly assigning participants


Author
Message
dinghu
dinghu
Associate Member (62 reputation)Associate Member (62 reputation)Associate Member (62 reputation)Associate Member (62 reputation)Associate Member (62 reputation)Associate Member (62 reputation)Associate Member (62 reputation)Associate Member (62 reputation)Associate Member (62 reputation)
Group: Forum Members
Posts: 6, Visits: 23
I am a novice to Inquisit and I am trying to code an experiment in which participants are first randomly assigned to one of two possible groups, and then further randomly assigned to one of 3 groups within the parent group. I am not sure how to accomplish that. Currently, the code I have written is just for the child group, seen below. I am not sure how to layer this into a parent group, and I'm not even sure if I am approaching this correctly in the first place. I am planning to run this through Inquisit Web using a participant pool from Prolific, if that makes a difference! Thank you in advance for any help.


<variables>
/ group = (1 of 3) (firstblock=data_50, secondblock=data_500, thirdblock=data_10000)
/ group = (2 of 3) (firstblock=data_500, secondblock=data_10000, thirdblock=data_50)
/ group = (3 of 3) (firstblock=data_10000, secondblock=data_50, thirdblock=data_500)
</variables>
Dave
Dave
Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)
Group: Administrators
Posts: 12K, Visits: 98K
dinghu - 3/22/2024
I am a novice to Inquisit and I am trying to code an experiment in which participants are first randomly assigned to one of two possible groups, and then further randomly assigned to one of 3 groups within the parent group. I am not sure how to accomplish that. Currently, the code I have written is just for the child group, seen below. I am not sure how to layer this into a parent group, and I'm not even sure if I am approaching this correctly in the first place. I am planning to run this through Inquisit Web using a participant pool from Prolific, if that makes a difference! Thank you in advance for any help.


<variables>
/ group = (1 of 3) (firstblock=data_50, secondblock=data_500, thirdblock=data_10000)
/ group = (2 of 3) (firstblock=data_500, secondblock=data_10000, thirdblock=data_50)
/ group = (3 of 3) (firstblock=data_10000, secondblock=data_50, thirdblock=data_500)
</variables>

The <variables> element is obsolete and no longer available. To counterbalance block orders between groups, you need to define multiple <expt> elements in the script, with the different orders speciied in their respective /blocks attributes. Assignment to one of the expts (and therefore block order) can be based on either subject or group number.

For anything further, you need to provide a better description of what you aim to do. While it's clear from the <variables> element you posted that the "child" groups involve assignment to three different block orders, it remains unclear what the two "parent" groups entail.

Edited Last Month by Dave
dinghu
dinghu
Associate Member (62 reputation)Associate Member (62 reputation)Associate Member (62 reputation)Associate Member (62 reputation)Associate Member (62 reputation)Associate Member (62 reputation)Associate Member (62 reputation)Associate Member (62 reputation)Associate Member (62 reputation)
Group: Forum Members
Posts: 6, Visits: 23
Dave - 3/22/2024
dinghu - 3/22/2024
I am a novice to Inquisit and I am trying to code an experiment in which participants are first randomly assigned to one of two possible groups, and then further randomly assigned to one of 3 groups within the parent group. I am not sure how to accomplish that. Currently, the code I have written is just for the child group, seen below. I am not sure how to layer this into a parent group, and I'm not even sure if I am approaching this correctly in the first place. I am planning to run this through Inquisit Web using a participant pool from Prolific, if that makes a difference! Thank you in advance for any help.


<variables>
/ group = (1 of 3) (firstblock=data_50, secondblock=data_500, thirdblock=data_10000)
/ group = (2 of 3) (firstblock=data_500, secondblock=data_10000, thirdblock=data_50)
/ group = (3 of 3) (firstblock=data_10000, secondblock=data_50, thirdblock=data_500)
</variables>

The <variables> element is obsolete and no longer available. To counterbalance block orders between groups, you need to define multiple <expt> elements in the script, with the different orders speciied in their respective /blocks attributes. Assignment to one of the expts (and therefore block order) can be based on either subject or group number.

For anything further, you need to provide a better description of what you aim to do. While it's clear from the <variables> element you posted that the "child" groups involve assignment to three different block orders, it remains unclear what the two "parent" groups entail.

Thank you for that explanation! So, to explain it a little more, I am doing an experiment in which I have two major stimulus types: artwork and website screenshots. These are the two parent groups. Within each stimulus type, I am presenting the image for 50, 500, and 10000ms so that all participants go through all presentation time lengths. I have the 3 groups of different orders of presentation time (adjusted according to a Latin square) so that I can randomly assign participants to one of these. I am concerned with your advice that variables is obsolete, because the code was still running. I've included the code I that I have in its current state. Is what I have written using other obsolete or inefficient methods?

Thank you!
Attachments
all conditions code.iqx (31 views, 16.00 KB)
Dave
Dave
Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)
Group: Administrators
Posts: 12K, Visits: 98K
dinghu - 3/22/2024
Dave - 3/22/2024
dinghu - 3/22/2024
I am a novice to Inquisit and I am trying to code an experiment in which participants are first randomly assigned to one of two possible groups, and then further randomly assigned to one of 3 groups within the parent group. I am not sure how to accomplish that. Currently, the code I have written is just for the child group, seen below. I am not sure how to layer this into a parent group, and I'm not even sure if I am approaching this correctly in the first place. I am planning to run this through Inquisit Web using a participant pool from Prolific, if that makes a difference! Thank you in advance for any help.


<variables>
/ group = (1 of 3) (firstblock=data_50, secondblock=data_500, thirdblock=data_10000)
/ group = (2 of 3) (firstblock=data_500, secondblock=data_10000, thirdblock=data_50)
/ group = (3 of 3) (firstblock=data_10000, secondblock=data_50, thirdblock=data_500)
</variables>

The <variables> element is obsolete and no longer available. To counterbalance block orders between groups, you need to define multiple <expt> elements in the script, with the different orders speciied in their respective /blocks attributes. Assignment to one of the expts (and therefore block order) can be based on either subject or group number.

For anything further, you need to provide a better description of what you aim to do. While it's clear from the <variables> element you posted that the "child" groups involve assignment to three different block orders, it remains unclear what the two "parent" groups entail.

Thank you for that explanation! So, to explain it a little more, I am doing an experiment in which I have two major stimulus types: artwork and website screenshots. These are the two parent groups. Within each stimulus type, I am presenting the image for 50, 500, and 10000ms so that all participants go through all presentation time lengths. I have the 3 groups of different orders of presentation time (adjusted according to a Latin square) so that I can randomly assign participants to one of these. I am concerned with your advice that variables is obsolete, because the code was still running. I've included the code I that I have in its current state. Is what I have written using other obsolete or inefficient methods?

Thank you!

There is no attempt whatsoever in the code to even use the <variables> element, so that is why it's running.

Please comment your code to make clear what is what (e.g. which elements belong to which parent group, etc,). You should also generally spell out, in comments to your code, what it is intended to do. Otherwise it is not possible for any person to assess whether what the code does matches what the code is intended to do.



dinghu
dinghu
Associate Member (62 reputation)Associate Member (62 reputation)Associate Member (62 reputation)Associate Member (62 reputation)Associate Member (62 reputation)Associate Member (62 reputation)Associate Member (62 reputation)Associate Member (62 reputation)Associate Member (62 reputation)
Group: Forum Members
Posts: 6, Visits: 23
Dave - 3/22/2024
dinghu - 3/22/2024
Dave - 3/22/2024
dinghu - 3/22/2024
I am a novice to Inquisit and I am trying to code an experiment in which participants are first randomly assigned to one of two possible groups, and then further randomly assigned to one of 3 groups within the parent group. I am not sure how to accomplish that. Currently, the code I have written is just for the child group, seen below. I am not sure how to layer this into a parent group, and I'm not even sure if I am approaching this correctly in the first place. I am planning to run this through Inquisit Web using a participant pool from Prolific, if that makes a difference! Thank you in advance for any help.


<variables>
/ group = (1 of 3) (firstblock=data_50, secondblock=data_500, thirdblock=data_10000)
/ group = (2 of 3) (firstblock=data_500, secondblock=data_10000, thirdblock=data_50)
/ group = (3 of 3) (firstblock=data_10000, secondblock=data_50, thirdblock=data_500)
</variables>

The <variables> element is obsolete and no longer available. To counterbalance block orders between groups, you need to define multiple <expt> elements in the script, with the different orders speciied in their respective /blocks attributes. Assignment to one of the expts (and therefore block order) can be based on either subject or group number.

For anything further, you need to provide a better description of what you aim to do. While it's clear from the <variables> element you posted that the "child" groups involve assignment to three different block orders, it remains unclear what the two "parent" groups entail.

Thank you for that explanation! So, to explain it a little more, I am doing an experiment in which I have two major stimulus types: artwork and website screenshots. These are the two parent groups. Within each stimulus type, I am presenting the image for 50, 500, and 10000ms so that all participants go through all presentation time lengths. I have the 3 groups of different orders of presentation time (adjusted according to a Latin square) so that I can randomly assign participants to one of these. I am concerned with your advice that variables is obsolete, because the code was still running. I've included the code I that I have in its current state. Is what I have written using other obsolete or inefficient methods?

Thank you!

There is no attempt whatsoever in the code to even use the <variables> element, so that is why it's running.

Please comment your code to make clear what is what (e.g. which elements belong to which parent group, etc,). You should also generally spell out, in comments to your code, what it is intended to do. Otherwise it is not possible for any person to assess whether what the code does matches what the code is intended to do.



Oh, I see. Wow, thank you very much. Like I said, I am a total novice, this is one of my first experiences with any kind of programming. I will try and clean this up and post here again later today!
dinghu
dinghu
Associate Member (62 reputation)Associate Member (62 reputation)Associate Member (62 reputation)Associate Member (62 reputation)Associate Member (62 reputation)Associate Member (62 reputation)Associate Member (62 reputation)Associate Member (62 reputation)Associate Member (62 reputation)
Group: Forum Members
Posts: 6, Visits: 23
Dave - 3/22/2024
dinghu - 3/22/2024
Dave - 3/22/2024
dinghu - 3/22/2024
I am a novice to Inquisit and I am trying to code an experiment in which participants are first randomly assigned to one of two possible groups, and then further randomly assigned to one of 3 groups within the parent group. I am not sure how to accomplish that. Currently, the code I have written is just for the child group, seen below. I am not sure how to layer this into a parent group, and I'm not even sure if I am approaching this correctly in the first place. I am planning to run this through Inquisit Web using a participant pool from Prolific, if that makes a difference! Thank you in advance for any help.


<variables>
/ group = (1 of 3) (firstblock=data_50, secondblock=data_500, thirdblock=data_10000)
/ group = (2 of 3) (firstblock=data_500, secondblock=data_10000, thirdblock=data_50)
/ group = (3 of 3) (firstblock=data_10000, secondblock=data_50, thirdblock=data_500)
</variables>

The <variables> element is obsolete and no longer available. To counterbalance block orders between groups, you need to define multiple <expt> elements in the script, with the different orders speciied in their respective /blocks attributes. Assignment to one of the expts (and therefore block order) can be based on either subject or group number.

For anything further, you need to provide a better description of what you aim to do. While it's clear from the <variables> element you posted that the "child" groups involve assignment to three different block orders, it remains unclear what the two "parent" groups entail.

Thank you for that explanation! So, to explain it a little more, I am doing an experiment in which I have two major stimulus types: artwork and website screenshots. These are the two parent groups. Within each stimulus type, I am presenting the image for 50, 500, and 10000ms so that all participants go through all presentation time lengths. I have the 3 groups of different orders of presentation time (adjusted according to a Latin square) so that I can randomly assign participants to one of these. I am concerned with your advice that variables is obsolete, because the code was still running. I've included the code I that I have in its current state. Is what I have written using other obsolete or inefficient methods?

Thank you!

There is no attempt whatsoever in the code to even use the <variables> element, so that is why it's running.

Please comment your code to make clear what is what (e.g. which elements belong to which parent group, etc,). You should also generally spell out, in comments to your code, what it is intended to do. Otherwise it is not possible for any person to assess whether what the code does matches what the code is intended to do.



I've updated my script with comments to try and explain what I am getting at. I put comments under the "Experiment", "Block", and "Trial" sections. Upon looking at it again, I realized I had already started dealing with the issue of using expt instead of variables, which is why the variables portion is not used in the script.

The issue is that I am not sure if this is the right way to go about what I was trying to do. The big picture look at the experiment is two large groups (website and artwork). Each of these groups will be a 3 (filter type - between subjects) x3 (viewing time -within subjects) design. The filter type can be randomly assigned, but I have the viewing time order specifically controlled so that I can compare the initial block of 50, 500, and 10000ms groups.

As you can see in the comments, this script currently only accounts for one of the stimulus types (one of the two parent groups I mentioned) in 9 between-subjects groups. Since I wasn't sure whether there was a way to group them according to the big picture design, so I wrote them as these distinct groups rather than the parent grouping I was explaining. Once I add the other stimulus type, it would become 18 groups total. Does that seem correct?

Finally, I am planning to use the Prolific participant pool (also my first time dealing with it so I don't know what it looks like on that end), and I don't know how my code needs to join up with that in order to randomly assign participants. Is there some script I need to have at the beginning of the script to handshake with Prolific?

Please let me know if I am not explaining this clearly enough, and thank you so much for your time!
Attachments
all conditions code.iqx (29 views, 17.00 KB)
Dave
Dave
Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)
Group: Administrators
Posts: 12K, Visits: 98K
dinghu - 3/22/2024
Dave - 3/22/2024
dinghu - 3/22/2024
Dave - 3/22/2024
dinghu - 3/22/2024
I am a novice to Inquisit and I am trying to code an experiment in which participants are first randomly assigned to one of two possible groups, and then further randomly assigned to one of 3 groups within the parent group. I am not sure how to accomplish that. Currently, the code I have written is just for the child group, seen below. I am not sure how to layer this into a parent group, and I'm not even sure if I am approaching this correctly in the first place. I am planning to run this through Inquisit Web using a participant pool from Prolific, if that makes a difference! Thank you in advance for any help.


<variables>
/ group = (1 of 3) (firstblock=data_50, secondblock=data_500, thirdblock=data_10000)
/ group = (2 of 3) (firstblock=data_500, secondblock=data_10000, thirdblock=data_50)
/ group = (3 of 3) (firstblock=data_10000, secondblock=data_50, thirdblock=data_500)
</variables>

The <variables> element is obsolete and no longer available. To counterbalance block orders between groups, you need to define multiple <expt> elements in the script, with the different orders speciied in their respective /blocks attributes. Assignment to one of the expts (and therefore block order) can be based on either subject or group number.

For anything further, you need to provide a better description of what you aim to do. While it's clear from the <variables> element you posted that the "child" groups involve assignment to three different block orders, it remains unclear what the two "parent" groups entail.

Thank you for that explanation! So, to explain it a little more, I am doing an experiment in which I have two major stimulus types: artwork and website screenshots. These are the two parent groups. Within each stimulus type, I am presenting the image for 50, 500, and 10000ms so that all participants go through all presentation time lengths. I have the 3 groups of different orders of presentation time (adjusted according to a Latin square) so that I can randomly assign participants to one of these. I am concerned with your advice that variables is obsolete, because the code was still running. I've included the code I that I have in its current state. Is what I have written using other obsolete or inefficient methods?

Thank you!

There is no attempt whatsoever in the code to even use the <variables> element, so that is why it's running.

Please comment your code to make clear what is what (e.g. which elements belong to which parent group, etc,). You should also generally spell out, in comments to your code, what it is intended to do. Otherwise it is not possible for any person to assess whether what the code does matches what the code is intended to do.



I've updated my script with comments to try and explain what I am getting at. I put comments under the "Experiment", "Block", and "Trial" sections. Upon looking at it again, I realized I had already started dealing with the issue of using expt instead of variables, which is why the variables portion is not used in the script.

The issue is that I am not sure if this is the right way to go about what I was trying to do. The big picture look at the experiment is two large groups (website and artwork). Each of these groups will be a 3 (filter type - between subjects) x3 (viewing time -within subjects) design. The filter type can be randomly assigned, but I have the viewing time order specifically controlled so that I can compare the initial block of 50, 500, and 10000ms groups.

As you can see in the comments, this script currently only accounts for one of the stimulus types (one of the two parent groups I mentioned) in 9 between-subjects groups. Since I wasn't sure whether there was a way to group them according to the big picture design, so I wrote them as these distinct groups rather than the parent grouping I was explaining. Once I add the other stimulus type, it would become 18 groups total. Does that seem correct?

Finally, I am planning to use the Prolific participant pool (also my first time dealing with it so I don't know what it looks like on that end), and I don't know how my code needs to join up with that in order to randomly assign participants. Is there some script I need to have at the beginning of the script to handshake with Prolific?

Please let me know if I am not explaining this clearly enough, and thank you so much for your time!

> Once I add the other stimulus type, it would become 18 groups total. Does that seem correct?

Yes, that is correct.

You don't need any handshaking code, all that is done in the web experiment settings in your account. E.g. you can have Prolific forward a unique participant identifer via URL parameter and have the Inquisit Web experiment read that in. The same is also possible for the group ID, if you want an external site to perform the condition assignment for you. Otherwise you simply let Inquisit do the group assignment, i.e. select random or sequential group ID generation in the web experiment's settings and indicated the number of groups you have (18 in your case).

I've looked over your code; it's fine and does what it's supposed to do. There's a lot of redundancy in it, which is not a flaw or mistake per se, but at some point things become somewhat unmaintainable. There are a bunch of advanced features you could make use of to reduce the amount of code significantly and make it easier to maintain (i.e. you only have to change a thing in one spot, not 20 different spots). Among those features are the ability to change stimulus timings dynamically via functions (e.g. insertstimulustime()) and conditional <include> elements to pipe in the applicable items pertaining to a given filter group. Example below:

*************************************************

*************************************************
<include filtergroup1>
/ precondition = [
    mod(script.groupid, 9) == 1 || mod(script.groupid, 9) == 2 || mod(script.groupid, 9) == 3
]
/ file = "filtergroup1.iqx"
</include>

<include filtergroup2>
/ precondition = [
    mod(script.groupid, 9) == 4 || mod(script.groupid, 9) == 5 || mod(script.groupid, 9) == 6
]
/ file = "filtergroup2.iqx"
</include>

<include filtergroup3>
/ precondition = [
    mod(script.groupid, 9) == 7 || mod(script.groupid, 9) == 8 || mod(script.groupid, 9) == 0
]
/ file = "filtergroup3.iqx"
</include>

*************************************************
Experiment
*************************************************
<list viewtime_order1>
/ items = (50, 500, 10000)
/ selectionmode = sequence
</list>
<list viewtime_order2>
/ items = (500, 10000, 50)
/ selectionmode = sequence
</list>
<list viewtime_order3>
/ items = (10000, 50, 500)
/ selectionmode = sequence
</list>

<list viewtime>
/ items = (list.viewtime_order1.nextvalue, list.viewtime_order2.nextvalue, list.viewtime_order3.nextvalue)
/ selectionmode = values.viewtimegroup
</list>

<values>
/ filtergroup = 0
/ viewtimegroup = 0
/ viewtime = 0
</values>

// Filter Group 1
<expt>
/ onexptbegin = [
    values.filtergroup = 1;
    values.viewtimegroup = 1;
]
/ postinstructions = (end)
/ blocks = [1 = practice; 2 - 4 = test]
/ groups = (1 of 9)
</expt>

<expt>
/ onexptbegin = [
    values.filtergroup = 1;
    values.viewtimegroup = 2;
]
/ postinstructions = (end)
/ blocks = [1 = practice; 2 - 4 = test]
/ groups = (2 of 9)
</expt>

<expt>
/ onexptbegin = [
    values.filtergroup = 1;
    values.viewtimegroup = 3;
]
/ postinstructions = (end)
/ blocks = [1 = practice; 2 - 4 = test]
/ groups = (3 of 9)
</expt>

// Filter Group 2
<expt>
/ onexptbegin = [
    values.filtergroup = 2;
    values.viewtimegroup = 1;
]
/ postinstructions = (end)
/ blocks = [1 = practice; 2 - 4 = test]
/ groups = (4 of 9)
</expt>

<expt>
/ onexptbegin = [
    values.filtergroup = 2;
    values.viewtimegroup = 2;
]
/ postinstructions = (end)
/ blocks = [1 = practice; 2 - 4 = test]
/ groups = (5 of 9)
</expt>

<expt>
/ onexptbegin = [
    values.filtergroup = 2;
    values.viewtimegroup = 3;
]
/ postinstructions = (end)
/ blocks = [1 = practice; 2 - 4 = test]
/ groups = (6 of 9)
</expt>

// Filter Group 3
<expt>
/ onexptbegin = [
    values.filtergroup = 3;
    values.viewtimegroup = 1;
]
/ postinstructions = (end)
/ blocks = [1 = practice; 2 - 4 = test]
/ groups = (7 of 9)
</expt>

<expt>
/ onexptbegin = [
    values.filtergroup = 3;
    values.viewtimegroup = 2;
]
/ postinstructions = (end)
/ blocks = [1 = practice; 2 - 4 = test]
/ groups = (8of 9)
</expt>

<expt>
/ onexptbegin = [
    values.filtergroup = 3;
    values.viewtimegroup = 3;
]
/ postinstructions = (end)
/ blocks = [1 = practice; 2 - 4 = test]
/ groups = (9 of 9)
</expt>

<defaults>
/ fontstyle = ("Arial", 14pt)
/ screencolor = (150, 150, 150)
</defaults>

*************************************************
Block
*************************************************

<block practice>
/ onblockbegin = [
    values.viewtime = 50; // 50 ms viewtime during practice
]
/ preinstructions = (intro1)
/ trials = [1-3 = ratingtrial]
</block>

<block test>
/ onblockbegin = [
    values.viewtime = list.viewtime.nextvalue;
]
/ trials = [1-50 = ratingtrial]
</block>


*************************************************
Trials
*************************************************

<likert ratingtrial>
/ ontrialbegin = [
    likert.ratingtrial.resetstimulusframes();
    likert.ratingtrial.insertstimulustime(picture.mask, 250 + values.viewtime); // mask the site stimulus after viewtime
    likert.ratingtrial.insertstimulustime(clearscreen, 250 + values.viewtime + 50); // erase screen 50ms after mask
]
/ pretrialpause = 300
/ stimulustimes = [0=fix; 200=mask; 250=site]
/ anchors=[1="very unaesthetic"; 2="unaesthetic"; 3="somewhat unaesthetic"; 4="neutral"; 5="somewhat aesthetic"; 6="aesthetic"; 7="very aesthetic"]
/ numpoints = 7
/ position=(50, 50)
/ posttrialpause = 100
/ buttonvalues = [1="1",2="2",3="3",4="4",5="5",6="6",7="7"]
/ mouse = false
</likert>

*************************************************
Stimuli
*************************************************

<text fix>
/ items = ("+")
/ txbgcolor = (150,150,150)
/ txcolor = (0,0,0)
/ font = ("Arial", -25, 400, 0, 34)
/erase = false
</text>

<picture mask>
/ items = maskitems
/ select = noreplace
</picture>

<picture site>
/ items = siteitems
/ select = current(mask)
</picture>


*************************************************
Instructions
*************************************************

<page intro1>
If you have read the instructions and there are no more unanswered questions, you can now start the experiment.
Get ready for the first stimulus as soon as you start the experiment.
</page>

<page end>
The experiment is now finished.
</page>

<instruct>
/ nextkey = ("5")
</instruct>

<data>
/ columns = (build date time subject group session values.filtergroup values.viewtimegroup blocknum blockcode trialnum trialcode
    stimulusnumber stimulusitem stimulusonset
    stimulusnumber stimulusitem stimulusonset
    stimulusnumber stimulusitem stimulusonset
    stimulusnumber stimulusitem stimulusonset
    stimulusnumber stimulusitem stimulusonset
    values.viewtime response latency correct
    )
</data>

Attachments
all conditions code.rev.iqx (26 views, 5.00 KB)
filtergroup1.iqx (22 views, 2.00 KB)
filtergroup2.iqx (23 views, 2.00 KB)
filtergroup3.iqx (23 views, 2.00 KB)
dinghu
dinghu
Associate Member (62 reputation)Associate Member (62 reputation)Associate Member (62 reputation)Associate Member (62 reputation)Associate Member (62 reputation)Associate Member (62 reputation)Associate Member (62 reputation)Associate Member (62 reputation)Associate Member (62 reputation)
Group: Forum Members
Posts: 6, Visits: 23
Dave - 3/22/2024
dinghu - 3/22/2024
Dave - 3/22/2024
dinghu - 3/22/2024
Dave - 3/22/2024
dinghu - 3/22/2024
I am a novice to Inquisit and I am trying to code an experiment in which participants are first randomly assigned to one of two possible groups, and then further randomly assigned to one of 3 groups within the parent group. I am not sure how to accomplish that. Currently, the code I have written is just for the child group, seen below. I am not sure how to layer this into a parent group, and I'm not even sure if I am approaching this correctly in the first place. I am planning to run this through Inquisit Web using a participant pool from Prolific, if that makes a difference! Thank you in advance for any help.


<variables>
/ group = (1 of 3) (firstblock=data_50, secondblock=data_500, thirdblock=data_10000)
/ group = (2 of 3) (firstblock=data_500, secondblock=data_10000, thirdblock=data_50)
/ group = (3 of 3) (firstblock=data_10000, secondblock=data_50, thirdblock=data_500)
</variables>

The <variables> element is obsolete and no longer available. To counterbalance block orders between groups, you need to define multiple <expt> elements in the script, with the different orders speciied in their respective /blocks attributes. Assignment to one of the expts (and therefore block order) can be based on either subject or group number.

For anything further, you need to provide a better description of what you aim to do. While it's clear from the <variables> element you posted that the "child" groups involve assignment to three different block orders, it remains unclear what the two "parent" groups entail.

Thank you for that explanation! So, to explain it a little more, I am doing an experiment in which I have two major stimulus types: artwork and website screenshots. These are the two parent groups. Within each stimulus type, I am presenting the image for 50, 500, and 10000ms so that all participants go through all presentation time lengths. I have the 3 groups of different orders of presentation time (adjusted according to a Latin square) so that I can randomly assign participants to one of these. I am concerned with your advice that variables is obsolete, because the code was still running. I've included the code I that I have in its current state. Is what I have written using other obsolete or inefficient methods?

Thank you!

There is no attempt whatsoever in the code to even use the <variables> element, so that is why it's running.

Please comment your code to make clear what is what (e.g. which elements belong to which parent group, etc,). You should also generally spell out, in comments to your code, what it is intended to do. Otherwise it is not possible for any person to assess whether what the code does matches what the code is intended to do.



I've updated my script with comments to try and explain what I am getting at. I put comments under the "Experiment", "Block", and "Trial" sections. Upon looking at it again, I realized I had already started dealing with the issue of using expt instead of variables, which is why the variables portion is not used in the script.

The issue is that I am not sure if this is the right way to go about what I was trying to do. The big picture look at the experiment is two large groups (website and artwork). Each of these groups will be a 3 (filter type - between subjects) x3 (viewing time -within subjects) design. The filter type can be randomly assigned, but I have the viewing time order specifically controlled so that I can compare the initial block of 50, 500, and 10000ms groups.

As you can see in the comments, this script currently only accounts for one of the stimulus types (one of the two parent groups I mentioned) in 9 between-subjects groups. Since I wasn't sure whether there was a way to group them according to the big picture design, so I wrote them as these distinct groups rather than the parent grouping I was explaining. Once I add the other stimulus type, it would become 18 groups total. Does that seem correct?

Finally, I am planning to use the Prolific participant pool (also my first time dealing with it so I don't know what it looks like on that end), and I don't know how my code needs to join up with that in order to randomly assign participants. Is there some script I need to have at the beginning of the script to handshake with Prolific?

Please let me know if I am not explaining this clearly enough, and thank you so much for your time!

> Once I add the other stimulus type, it would become 18 groups total. Does that seem correct?

Yes, that is correct.

You don't need any handshaking code, all that is done in the web experiment settings in your account. E.g. you can have Prolific forward a unique participant identifer via URL parameter and have the Inquisit Web experiment read that in. The same is also possible for the group ID, if you want an external site to perform the condition assignment for you. Otherwise you simply let Inquisit do the group assignment, i.e. select random or sequential group ID generation in the web experiment's settings and indicated the number of groups you have (18 in your case).

I've looked over your code; it's fine and does what it's supposed to do. There's a lot of redundancy in it, which is not a flaw or mistake per se, but at some point things become somewhat unmaintainable. There are a bunch of advanced features you could make use of to reduce the amount of code significantly and make it easier to maintain (i.e. you only have to change a thing in one spot, not 20 different spots). Among those features are the ability to change stimulus timings dynamically via functions (e.g. insertstimulustime()) and conditional <include> elements to pipe in the applicable items pertaining to a given filter group. Example below:

*************************************************

*************************************************
<include filtergroup1>
/ precondition = [
    mod(script.groupid, 9) == 1 || mod(script.groupid, 9) == 2 || mod(script.groupid, 9) == 3
]
/ file = "filtergroup1.iqx"
</include>

<include filtergroup2>
/ precondition = [
    mod(script.groupid, 9) == 4 || mod(script.groupid, 9) == 5 || mod(script.groupid, 9) == 6
]
/ file = "filtergroup2.iqx"
</include>

<include filtergroup3>
/ precondition = [
    mod(script.groupid, 9) == 7 || mod(script.groupid, 9) == 8 || mod(script.groupid, 9) == 0
]
/ file = "filtergroup3.iqx"
</include>

*************************************************
Experiment
*************************************************
<list viewtime_order1>
/ items = (50, 500, 10000)
/ selectionmode = sequence
</list>
<list viewtime_order2>
/ items = (500, 10000, 50)
/ selectionmode = sequence
</list>
<list viewtime_order3>
/ items = (10000, 50, 500)
/ selectionmode = sequence
</list>

<list viewtime>
/ items = (list.viewtime_order1.nextvalue, list.viewtime_order2.nextvalue, list.viewtime_order3.nextvalue)
/ selectionmode = values.viewtimegroup
</list>

<values>
/ filtergroup = 0
/ viewtimegroup = 0
/ viewtime = 0
</values>

// Filter Group 1
<expt>
/ onexptbegin = [
    values.filtergroup = 1;
    values.viewtimegroup = 1;
]
/ postinstructions = (end)
/ blocks = [1 = practice; 2 - 4 = test]
/ groups = (1 of 9)
</expt>

<expt>
/ onexptbegin = [
    values.filtergroup = 1;
    values.viewtimegroup = 2;
]
/ postinstructions = (end)
/ blocks = [1 = practice; 2 - 4 = test]
/ groups = (2 of 9)
</expt>

<expt>
/ onexptbegin = [
    values.filtergroup = 1;
    values.viewtimegroup = 3;
]
/ postinstructions = (end)
/ blocks = [1 = practice; 2 - 4 = test]
/ groups = (3 of 9)
</expt>

// Filter Group 2
<expt>
/ onexptbegin = [
    values.filtergroup = 2;
    values.viewtimegroup = 1;
]
/ postinstructions = (end)
/ blocks = [1 = practice; 2 - 4 = test]
/ groups = (4 of 9)
</expt>

<expt>
/ onexptbegin = [
    values.filtergroup = 2;
    values.viewtimegroup = 2;
]
/ postinstructions = (end)
/ blocks = [1 = practice; 2 - 4 = test]
/ groups = (5 of 9)
</expt>

<expt>
/ onexptbegin = [
    values.filtergroup = 2;
    values.viewtimegroup = 3;
]
/ postinstructions = (end)
/ blocks = [1 = practice; 2 - 4 = test]
/ groups = (6 of 9)
</expt>

// Filter Group 3
<expt>
/ onexptbegin = [
    values.filtergroup = 3;
    values.viewtimegroup = 1;
]
/ postinstructions = (end)
/ blocks = [1 = practice; 2 - 4 = test]
/ groups = (7 of 9)
</expt>

<expt>
/ onexptbegin = [
    values.filtergroup = 3;
    values.viewtimegroup = 2;
]
/ postinstructions = (end)
/ blocks = [1 = practice; 2 - 4 = test]
/ groups = (8of 9)
</expt>

<expt>
/ onexptbegin = [
    values.filtergroup = 3;
    values.viewtimegroup = 3;
]
/ postinstructions = (end)
/ blocks = [1 = practice; 2 - 4 = test]
/ groups = (9 of 9)
</expt>

<defaults>
/ fontstyle = ("Arial", 14pt)
/ screencolor = (150, 150, 150)
</defaults>

*************************************************
Block
*************************************************

<block practice>
/ onblockbegin = [
    values.viewtime = 50; // 50 ms viewtime during practice
]
/ preinstructions = (intro1)
/ trials = [1-3 = ratingtrial]
</block>

<block test>
/ onblockbegin = [
    values.viewtime = list.viewtime.nextvalue;
]
/ trials = [1-50 = ratingtrial]
</block>


*************************************************
Trials
*************************************************

<likert ratingtrial>
/ ontrialbegin = [
    likert.ratingtrial.resetstimulusframes();
    likert.ratingtrial.insertstimulustime(picture.mask, 250 + values.viewtime); // mask the site stimulus after viewtime
    likert.ratingtrial.insertstimulustime(clearscreen, 250 + values.viewtime + 50); // erase screen 50ms after mask
]
/ pretrialpause = 300
/ stimulustimes = [0=fix; 200=mask; 250=site]
/ anchors=[1="very unaesthetic"; 2="unaesthetic"; 3="somewhat unaesthetic"; 4="neutral"; 5="somewhat aesthetic"; 6="aesthetic"; 7="very aesthetic"]
/ numpoints = 7
/ position=(50, 50)
/ posttrialpause = 100
/ buttonvalues = [1="1",2="2",3="3",4="4",5="5",6="6",7="7"]
/ mouse = false
</likert>

*************************************************
Stimuli
*************************************************

<text fix>
/ items = ("+")
/ txbgcolor = (150,150,150)
/ txcolor = (0,0,0)
/ font = ("Arial", -25, 400, 0, 34)
/erase = false
</text>

<picture mask>
/ items = maskitems
/ select = noreplace
</picture>

<picture site>
/ items = siteitems
/ select = current(mask)
</picture>


*************************************************
Instructions
*************************************************

<page intro1>
If you have read the instructions and there are no more unanswered questions, you can now start the experiment.
Get ready for the first stimulus as soon as you start the experiment.
</page>

<page end>
The experiment is now finished.
</page>

<instruct>
/ nextkey = ("5")
</instruct>

<data>
/ columns = (build date time subject group session values.filtergroup values.viewtimegroup blocknum blockcode trialnum trialcode
    stimulusnumber stimulusitem stimulusonset
    stimulusnumber stimulusitem stimulusonset
    stimulusnumber stimulusitem stimulusonset
    stimulusnumber stimulusitem stimulusonset
    stimulusnumber stimulusitem stimulusonset
    values.viewtime response latency correct
    )
</data>

Wow, this code was cool to see, and I really appreciate the work you put in here to demonstrate the efficiency for me! I have spent a while just trying to read through and try to understand what each thing does. Is there a resource for me to read up on the terms? I don't see all of them explained or defined in the manual. Regardless, I think I've come to understand how this script runs for the most part. I was wondering about a few small things now:

  1. I am not sure if it was intentional, but the filtergroup segment at the end had mod(script.groupid, 9) == 0 instead of == 1. So once I expanded it to 18 groups, should that still be a 0 such that it is mod(script.groupid, 18) == 0?
  2. How would I format the pre and post instructions so that it is more centered and nice to read? At the moment, it's just a block of text right at the top of the screen.
  3. What happens once the script completes? From the participant end, say I still wanted them to do another Qualtrics survey for demographics and other information, can I redirect them through Inquisit tools, or is that something I'd have to just instruct participants to do?


I've added on my full set of stimuli for the whole experiment, but I've noticed a few errors that I think I ended up finding solutions to. I'm curious to see if I have solved it correctly.
The first error was that the viewing time sequence was not changing within each filtergroup, but I think I fixed that by changing the viewtime list selectionmode to values.viewtimegroup rather than filtergroup.

The second issue I found was that with the later art stimuli, some of them are not the exact dimensions as the visual mask images I am using, so then parts of the visual mask stay on the screen while the stimuli is shown, only being cleared once the full screen is cleared with the "clearscreen" command.
I just added 250=clearscreen to the line:
/ stimulustimes = [0=fix; 200=mask; 250=clearscreen; 250=site]
Which seemed to work!
Dave
Dave
Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)
Group: Administrators
Posts: 12K, Visits: 98K
dinghu - 3/30/2024
Dave - 3/22/2024
dinghu - 3/22/2024
Dave - 3/22/2024
dinghu - 3/22/2024
Dave - 3/22/2024
dinghu - 3/22/2024
I am a novice to Inquisit and I am trying to code an experiment in which participants are first randomly assigned to one of two possible groups, and then further randomly assigned to one of 3 groups within the parent group. I am not sure how to accomplish that. Currently, the code I have written is just for the child group, seen below. I am not sure how to layer this into a parent group, and I'm not even sure if I am approaching this correctly in the first place. I am planning to run this through Inquisit Web using a participant pool from Prolific, if that makes a difference! Thank you in advance for any help.


<variables>
/ group = (1 of 3) (firstblock=data_50, secondblock=data_500, thirdblock=data_10000)
/ group = (2 of 3) (firstblock=data_500, secondblock=data_10000, thirdblock=data_50)
/ group = (3 of 3) (firstblock=data_10000, secondblock=data_50, thirdblock=data_500)
</variables>

The <variables> element is obsolete and no longer available. To counterbalance block orders between groups, you need to define multiple <expt> elements in the script, with the different orders speciied in their respective /blocks attributes. Assignment to one of the expts (and therefore block order) can be based on either subject or group number.

For anything further, you need to provide a better description of what you aim to do. While it's clear from the <variables> element you posted that the "child" groups involve assignment to three different block orders, it remains unclear what the two "parent" groups entail.

Thank you for that explanation! So, to explain it a little more, I am doing an experiment in which I have two major stimulus types: artwork and website screenshots. These are the two parent groups. Within each stimulus type, I am presenting the image for 50, 500, and 10000ms so that all participants go through all presentation time lengths. I have the 3 groups of different orders of presentation time (adjusted according to a Latin square) so that I can randomly assign participants to one of these. I am concerned with your advice that variables is obsolete, because the code was still running. I've included the code I that I have in its current state. Is what I have written using other obsolete or inefficient methods?

Thank you!

There is no attempt whatsoever in the code to even use the <variables> element, so that is why it's running.

Please comment your code to make clear what is what (e.g. which elements belong to which parent group, etc,). You should also generally spell out, in comments to your code, what it is intended to do. Otherwise it is not possible for any person to assess whether what the code does matches what the code is intended to do.



I've updated my script with comments to try and explain what I am getting at. I put comments under the "Experiment", "Block", and "Trial" sections. Upon looking at it again, I realized I had already started dealing with the issue of using expt instead of variables, which is why the variables portion is not used in the script.

The issue is that I am not sure if this is the right way to go about what I was trying to do. The big picture look at the experiment is two large groups (website and artwork). Each of these groups will be a 3 (filter type - between subjects) x3 (viewing time -within subjects) design. The filter type can be randomly assigned, but I have the viewing time order specifically controlled so that I can compare the initial block of 50, 500, and 10000ms groups.

As you can see in the comments, this script currently only accounts for one of the stimulus types (one of the two parent groups I mentioned) in 9 between-subjects groups. Since I wasn't sure whether there was a way to group them according to the big picture design, so I wrote them as these distinct groups rather than the parent grouping I was explaining. Once I add the other stimulus type, it would become 18 groups total. Does that seem correct?

Finally, I am planning to use the Prolific participant pool (also my first time dealing with it so I don't know what it looks like on that end), and I don't know how my code needs to join up with that in order to randomly assign participants. Is there some script I need to have at the beginning of the script to handshake with Prolific?

Please let me know if I am not explaining this clearly enough, and thank you so much for your time!

> Once I add the other stimulus type, it would become 18 groups total. Does that seem correct?

Yes, that is correct.

You don't need any handshaking code, all that is done in the web experiment settings in your account. E.g. you can have Prolific forward a unique participant identifer via URL parameter and have the Inquisit Web experiment read that in. The same is also possible for the group ID, if you want an external site to perform the condition assignment for you. Otherwise you simply let Inquisit do the group assignment, i.e. select random or sequential group ID generation in the web experiment's settings and indicated the number of groups you have (18 in your case).

I've looked over your code; it's fine and does what it's supposed to do. There's a lot of redundancy in it, which is not a flaw or mistake per se, but at some point things become somewhat unmaintainable. There are a bunch of advanced features you could make use of to reduce the amount of code significantly and make it easier to maintain (i.e. you only have to change a thing in one spot, not 20 different spots). Among those features are the ability to change stimulus timings dynamically via functions (e.g. insertstimulustime()) and conditional <include> elements to pipe in the applicable items pertaining to a given filter group. Example below:

*************************************************

*************************************************
<include filtergroup1>
/ precondition = [
    mod(script.groupid, 9) == 1 || mod(script.groupid, 9) == 2 || mod(script.groupid, 9) == 3
]
/ file = "filtergroup1.iqx"
</include>

<include filtergroup2>
/ precondition = [
    mod(script.groupid, 9) == 4 || mod(script.groupid, 9) == 5 || mod(script.groupid, 9) == 6
]
/ file = "filtergroup2.iqx"
</include>

<include filtergroup3>
/ precondition = [
    mod(script.groupid, 9) == 7 || mod(script.groupid, 9) == 8 || mod(script.groupid, 9) == 0
]
/ file = "filtergroup3.iqx"
</include>

*************************************************
Experiment
*************************************************
<list viewtime_order1>
/ items = (50, 500, 10000)
/ selectionmode = sequence
</list>
<list viewtime_order2>
/ items = (500, 10000, 50)
/ selectionmode = sequence
</list>
<list viewtime_order3>
/ items = (10000, 50, 500)
/ selectionmode = sequence
</list>

<list viewtime>
/ items = (list.viewtime_order1.nextvalue, list.viewtime_order2.nextvalue, list.viewtime_order3.nextvalue)
/ selectionmode = values.viewtimegroup
</list>

<values>
/ filtergroup = 0
/ viewtimegroup = 0
/ viewtime = 0
</values>

// Filter Group 1
<expt>
/ onexptbegin = [
    values.filtergroup = 1;
    values.viewtimegroup = 1;
]
/ postinstructions = (end)
/ blocks = [1 = practice; 2 - 4 = test]
/ groups = (1 of 9)
</expt>

<expt>
/ onexptbegin = [
    values.filtergroup = 1;
    values.viewtimegroup = 2;
]
/ postinstructions = (end)
/ blocks = [1 = practice; 2 - 4 = test]
/ groups = (2 of 9)
</expt>

<expt>
/ onexptbegin = [
    values.filtergroup = 1;
    values.viewtimegroup = 3;
]
/ postinstructions = (end)
/ blocks = [1 = practice; 2 - 4 = test]
/ groups = (3 of 9)
</expt>

// Filter Group 2
<expt>
/ onexptbegin = [
    values.filtergroup = 2;
    values.viewtimegroup = 1;
]
/ postinstructions = (end)
/ blocks = [1 = practice; 2 - 4 = test]
/ groups = (4 of 9)
</expt>

<expt>
/ onexptbegin = [
    values.filtergroup = 2;
    values.viewtimegroup = 2;
]
/ postinstructions = (end)
/ blocks = [1 = practice; 2 - 4 = test]
/ groups = (5 of 9)
</expt>

<expt>
/ onexptbegin = [
    values.filtergroup = 2;
    values.viewtimegroup = 3;
]
/ postinstructions = (end)
/ blocks = [1 = practice; 2 - 4 = test]
/ groups = (6 of 9)
</expt>

// Filter Group 3
<expt>
/ onexptbegin = [
    values.filtergroup = 3;
    values.viewtimegroup = 1;
]
/ postinstructions = (end)
/ blocks = [1 = practice; 2 - 4 = test]
/ groups = (7 of 9)
</expt>

<expt>
/ onexptbegin = [
    values.filtergroup = 3;
    values.viewtimegroup = 2;
]
/ postinstructions = (end)
/ blocks = [1 = practice; 2 - 4 = test]
/ groups = (8of 9)
</expt>

<expt>
/ onexptbegin = [
    values.filtergroup = 3;
    values.viewtimegroup = 3;
]
/ postinstructions = (end)
/ blocks = [1 = practice; 2 - 4 = test]
/ groups = (9 of 9)
</expt>

<defaults>
/ fontstyle = ("Arial", 14pt)
/ screencolor = (150, 150, 150)
</defaults>

*************************************************
Block
*************************************************

<block practice>
/ onblockbegin = [
    values.viewtime = 50; // 50 ms viewtime during practice
]
/ preinstructions = (intro1)
/ trials = [1-3 = ratingtrial]
</block>

<block test>
/ onblockbegin = [
    values.viewtime = list.viewtime.nextvalue;
]
/ trials = [1-50 = ratingtrial]
</block>


*************************************************
Trials
*************************************************

<likert ratingtrial>
/ ontrialbegin = [
    likert.ratingtrial.resetstimulusframes();
    likert.ratingtrial.insertstimulustime(picture.mask, 250 + values.viewtime); // mask the site stimulus after viewtime
    likert.ratingtrial.insertstimulustime(clearscreen, 250 + values.viewtime + 50); // erase screen 50ms after mask
]
/ pretrialpause = 300
/ stimulustimes = [0=fix; 200=mask; 250=site]
/ anchors=[1="very unaesthetic"; 2="unaesthetic"; 3="somewhat unaesthetic"; 4="neutral"; 5="somewhat aesthetic"; 6="aesthetic"; 7="very aesthetic"]
/ numpoints = 7
/ position=(50, 50)
/ posttrialpause = 100
/ buttonvalues = [1="1",2="2",3="3",4="4",5="5",6="6",7="7"]
/ mouse = false
</likert>

*************************************************
Stimuli
*************************************************

<text fix>
/ items = ("+")
/ txbgcolor = (150,150,150)
/ txcolor = (0,0,0)
/ font = ("Arial", -25, 400, 0, 34)
/erase = false
</text>

<picture mask>
/ items = maskitems
/ select = noreplace
</picture>

<picture site>
/ items = siteitems
/ select = current(mask)
</picture>


*************************************************
Instructions
*************************************************

<page intro1>
If you have read the instructions and there are no more unanswered questions, you can now start the experiment.
Get ready for the first stimulus as soon as you start the experiment.
</page>

<page end>
The experiment is now finished.
</page>

<instruct>
/ nextkey = ("5")
</instruct>

<data>
/ columns = (build date time subject group session values.filtergroup values.viewtimegroup blocknum blockcode trialnum trialcode
    stimulusnumber stimulusitem stimulusonset
    stimulusnumber stimulusitem stimulusonset
    stimulusnumber stimulusitem stimulusonset
    stimulusnumber stimulusitem stimulusonset
    stimulusnumber stimulusitem stimulusonset
    values.viewtime response latency correct
    )
</data>

Wow, this code was cool to see, and I really appreciate the work you put in here to demonstrate the efficiency for me! I have spent a while just trying to read through and try to understand what each thing does. Is there a resource for me to read up on the terms? I don't see all of them explained or defined in the manual. Regardless, I think I've come to understand how this script runs for the most part. I was wondering about a few small things now:

  1. I am not sure if it was intentional, but the filtergroup segment at the end had mod(script.groupid, 9) == 0 instead of == 1. So once I expanded it to 18 groups, should that still be a 0 such that it is mod(script.groupid, 18) == 0?
  2. How would I format the pre and post instructions so that it is more centered and nice to read? At the moment, it's just a block of text right at the top of the screen.
  3. What happens once the script completes? From the participant end, say I still wanted them to do another Qualtrics survey for demographics and other information, can I redirect them through Inquisit tools, or is that something I'd have to just instruct participants to do?


I've added on my full set of stimuli for the whole experiment, but I've noticed a few errors that I think I ended up finding solutions to. I'm curious to see if I have solved it correctly.
The first error was that the viewing time sequence was not changing within each filtergroup, but I think I fixed that by changing the viewtime list selectionmode to values.viewtimegroup rather than filtergroup.

The second issue I found was that with the later art stimuli, some of them are not the exact dimensions as the visual mask images I am using, so then parts of the visual mask stay on the screen while the stimuli is shown, only being cleared once the full screen is cleared with the "clearscreen" command.
I just added 250=clearscreen to the line:
/ stimulustimes = [0=fix; 200=mask; 250=clearscreen; 250=site]
Which seemed to work!

As for resources, read the Programmer's Manual ( https://www.millisecond.com/support/Inquisit%20Programmer's%20Manual.pdf ) and refer to the documentation ( https://www.millisecond.com/support/docs/current/html/viewer.htm ), particularly the language reference where every element, attribute, property, function, etc. is documented ( https://www.millisecond.com/support/docs/current/html/language/languagereference.htm ).

> I am not sure if it was intentional, but the filtergroup segment at the end had mod(script.groupid, 9) == 0 instead of == 1. So once I expanded it to 18 groups, should that still be a 0 such that it is mod(script.groupid, 18) == 0?

Yes, 9 modulo 9 is 0, and 18 modulo 18 is 0. That is how modular arithmetic works.

> How would I format the pre and post instructions so that it is more centered and nice to read? At the moment, it's just a block of text right at the top of the screen.

You can format text in <page> elements using HTML tags. https://www.millisecond.com/support/docs/current/html/language/markup.htm

> What happens once the script completes? From the participant end, say I still wanted them to do another Qualtrics survey for demographics and other information, can I redirect them through Inquisit tools, or is that something I'd have to just instruct participants to do?

You can specify a URL to redirect to in your web experiment's settings.

dinghu
dinghu
Associate Member (62 reputation)Associate Member (62 reputation)Associate Member (62 reputation)Associate Member (62 reputation)Associate Member (62 reputation)Associate Member (62 reputation)Associate Member (62 reputation)Associate Member (62 reputation)Associate Member (62 reputation)
Group: Forum Members
Posts: 6, Visits: 23
Dave - 3/30/2024
dinghu - 3/30/2024
Dave - 3/22/2024
dinghu - 3/22/2024
Dave - 3/22/2024
dinghu - 3/22/2024
Dave - 3/22/2024
dinghu - 3/22/2024
I am a novice to Inquisit and I am trying to code an experiment in which participants are first randomly assigned to one of two possible groups, and then further randomly assigned to one of 3 groups within the parent group. I am not sure how to accomplish that. Currently, the code I have written is just for the child group, seen below. I am not sure how to layer this into a parent group, and I'm not even sure if I am approaching this correctly in the first place. I am planning to run this through Inquisit Web using a participant pool from Prolific, if that makes a difference! Thank you in advance for any help.


<variables>
/ group = (1 of 3) (firstblock=data_50, secondblock=data_500, thirdblock=data_10000)
/ group = (2 of 3) (firstblock=data_500, secondblock=data_10000, thirdblock=data_50)
/ group = (3 of 3) (firstblock=data_10000, secondblock=data_50, thirdblock=data_500)
</variables>

The <variables> element is obsolete and no longer available. To counterbalance block orders between groups, you need to define multiple <expt> elements in the script, with the different orders speciied in their respective /blocks attributes. Assignment to one of the expts (and therefore block order) can be based on either subject or group number.

For anything further, you need to provide a better description of what you aim to do. While it's clear from the <variables> element you posted that the "child" groups involve assignment to three different block orders, it remains unclear what the two "parent" groups entail.

Thank you for that explanation! So, to explain it a little more, I am doing an experiment in which I have two major stimulus types: artwork and website screenshots. These are the two parent groups. Within each stimulus type, I am presenting the image for 50, 500, and 10000ms so that all participants go through all presentation time lengths. I have the 3 groups of different orders of presentation time (adjusted according to a Latin square) so that I can randomly assign participants to one of these. I am concerned with your advice that variables is obsolete, because the code was still running. I've included the code I that I have in its current state. Is what I have written using other obsolete or inefficient methods?

Thank you!

There is no attempt whatsoever in the code to even use the <variables> element, so that is why it's running.

Please comment your code to make clear what is what (e.g. which elements belong to which parent group, etc,). You should also generally spell out, in comments to your code, what it is intended to do. Otherwise it is not possible for any person to assess whether what the code does matches what the code is intended to do.



I've updated my script with comments to try and explain what I am getting at. I put comments under the "Experiment", "Block", and "Trial" sections. Upon looking at it again, I realized I had already started dealing with the issue of using expt instead of variables, which is why the variables portion is not used in the script.

The issue is that I am not sure if this is the right way to go about what I was trying to do. The big picture look at the experiment is two large groups (website and artwork). Each of these groups will be a 3 (filter type - between subjects) x3 (viewing time -within subjects) design. The filter type can be randomly assigned, but I have the viewing time order specifically controlled so that I can compare the initial block of 50, 500, and 10000ms groups.

As you can see in the comments, this script currently only accounts for one of the stimulus types (one of the two parent groups I mentioned) in 9 between-subjects groups. Since I wasn't sure whether there was a way to group them according to the big picture design, so I wrote them as these distinct groups rather than the parent grouping I was explaining. Once I add the other stimulus type, it would become 18 groups total. Does that seem correct?

Finally, I am planning to use the Prolific participant pool (also my first time dealing with it so I don't know what it looks like on that end), and I don't know how my code needs to join up with that in order to randomly assign participants. Is there some script I need to have at the beginning of the script to handshake with Prolific?

Please let me know if I am not explaining this clearly enough, and thank you so much for your time!

> Once I add the other stimulus type, it would become 18 groups total. Does that seem correct?

Yes, that is correct.

You don't need any handshaking code, all that is done in the web experiment settings in your account. E.g. you can have Prolific forward a unique participant identifer via URL parameter and have the Inquisit Web experiment read that in. The same is also possible for the group ID, if you want an external site to perform the condition assignment for you. Otherwise you simply let Inquisit do the group assignment, i.e. select random or sequential group ID generation in the web experiment's settings and indicated the number of groups you have (18 in your case).

I've looked over your code; it's fine and does what it's supposed to do. There's a lot of redundancy in it, which is not a flaw or mistake per se, but at some point things become somewhat unmaintainable. There are a bunch of advanced features you could make use of to reduce the amount of code significantly and make it easier to maintain (i.e. you only have to change a thing in one spot, not 20 different spots). Among those features are the ability to change stimulus timings dynamically via functions (e.g. insertstimulustime()) and conditional <include> elements to pipe in the applicable items pertaining to a given filter group. Example below:

*************************************************

*************************************************
<include filtergroup1>
/ precondition = [
    mod(script.groupid, 9) == 1 || mod(script.groupid, 9) == 2 || mod(script.groupid, 9) == 3
]
/ file = "filtergroup1.iqx"
</include>

<include filtergroup2>
/ precondition = [
    mod(script.groupid, 9) == 4 || mod(script.groupid, 9) == 5 || mod(script.groupid, 9) == 6
]
/ file = "filtergroup2.iqx"
</include>

<include filtergroup3>
/ precondition = [
    mod(script.groupid, 9) == 7 || mod(script.groupid, 9) == 8 || mod(script.groupid, 9) == 0
]
/ file = "filtergroup3.iqx"
</include>

*************************************************
Experiment
*************************************************
<list viewtime_order1>
/ items = (50, 500, 10000)
/ selectionmode = sequence
</list>
<list viewtime_order2>
/ items = (500, 10000, 50)
/ selectionmode = sequence
</list>
<list viewtime_order3>
/ items = (10000, 50, 500)
/ selectionmode = sequence
</list>

<list viewtime>
/ items = (list.viewtime_order1.nextvalue, list.viewtime_order2.nextvalue, list.viewtime_order3.nextvalue)
/ selectionmode = values.viewtimegroup
</list>

<values>
/ filtergroup = 0
/ viewtimegroup = 0
/ viewtime = 0
</values>

// Filter Group 1
<expt>
/ onexptbegin = [
    values.filtergroup = 1;
    values.viewtimegroup = 1;
]
/ postinstructions = (end)
/ blocks = [1 = practice; 2 - 4 = test]
/ groups = (1 of 9)
</expt>

<expt>
/ onexptbegin = [
    values.filtergroup = 1;
    values.viewtimegroup = 2;
]
/ postinstructions = (end)
/ blocks = [1 = practice; 2 - 4 = test]
/ groups = (2 of 9)
</expt>

<expt>
/ onexptbegin = [
    values.filtergroup = 1;
    values.viewtimegroup = 3;
]
/ postinstructions = (end)
/ blocks = [1 = practice; 2 - 4 = test]
/ groups = (3 of 9)
</expt>

// Filter Group 2
<expt>
/ onexptbegin = [
    values.filtergroup = 2;
    values.viewtimegroup = 1;
]
/ postinstructions = (end)
/ blocks = [1 = practice; 2 - 4 = test]
/ groups = (4 of 9)
</expt>

<expt>
/ onexptbegin = [
    values.filtergroup = 2;
    values.viewtimegroup = 2;
]
/ postinstructions = (end)
/ blocks = [1 = practice; 2 - 4 = test]
/ groups = (5 of 9)
</expt>

<expt>
/ onexptbegin = [
    values.filtergroup = 2;
    values.viewtimegroup = 3;
]
/ postinstructions = (end)
/ blocks = [1 = practice; 2 - 4 = test]
/ groups = (6 of 9)
</expt>

// Filter Group 3
<expt>
/ onexptbegin = [
    values.filtergroup = 3;
    values.viewtimegroup = 1;
]
/ postinstructions = (end)
/ blocks = [1 = practice; 2 - 4 = test]
/ groups = (7 of 9)
</expt>

<expt>
/ onexptbegin = [
    values.filtergroup = 3;
    values.viewtimegroup = 2;
]
/ postinstructions = (end)
/ blocks = [1 = practice; 2 - 4 = test]
/ groups = (8of 9)
</expt>

<expt>
/ onexptbegin = [
    values.filtergroup = 3;
    values.viewtimegroup = 3;
]
/ postinstructions = (end)
/ blocks = [1 = practice; 2 - 4 = test]
/ groups = (9 of 9)
</expt>

<defaults>
/ fontstyle = ("Arial", 14pt)
/ screencolor = (150, 150, 150)
</defaults>

*************************************************
Block
*************************************************

<block practice>
/ onblockbegin = [
    values.viewtime = 50; // 50 ms viewtime during practice
]
/ preinstructions = (intro1)
/ trials = [1-3 = ratingtrial]
</block>

<block test>
/ onblockbegin = [
    values.viewtime = list.viewtime.nextvalue;
]
/ trials = [1-50 = ratingtrial]
</block>


*************************************************
Trials
*************************************************

<likert ratingtrial>
/ ontrialbegin = [
    likert.ratingtrial.resetstimulusframes();
    likert.ratingtrial.insertstimulustime(picture.mask, 250 + values.viewtime); // mask the site stimulus after viewtime
    likert.ratingtrial.insertstimulustime(clearscreen, 250 + values.viewtime + 50); // erase screen 50ms after mask
]
/ pretrialpause = 300
/ stimulustimes = [0=fix; 200=mask; 250=site]
/ anchors=[1="very unaesthetic"; 2="unaesthetic"; 3="somewhat unaesthetic"; 4="neutral"; 5="somewhat aesthetic"; 6="aesthetic"; 7="very aesthetic"]
/ numpoints = 7
/ position=(50, 50)
/ posttrialpause = 100
/ buttonvalues = [1="1",2="2",3="3",4="4",5="5",6="6",7="7"]
/ mouse = false
</likert>

*************************************************
Stimuli
*************************************************

<text fix>
/ items = ("+")
/ txbgcolor = (150,150,150)
/ txcolor = (0,0,0)
/ font = ("Arial", -25, 400, 0, 34)
/erase = false
</text>

<picture mask>
/ items = maskitems
/ select = noreplace
</picture>

<picture site>
/ items = siteitems
/ select = current(mask)
</picture>


*************************************************
Instructions
*************************************************

<page intro1>
If you have read the instructions and there are no more unanswered questions, you can now start the experiment.
Get ready for the first stimulus as soon as you start the experiment.
</page>

<page end>
The experiment is now finished.
</page>

<instruct>
/ nextkey = ("5")
</instruct>

<data>
/ columns = (build date time subject group session values.filtergroup values.viewtimegroup blocknum blockcode trialnum trialcode
    stimulusnumber stimulusitem stimulusonset
    stimulusnumber stimulusitem stimulusonset
    stimulusnumber stimulusitem stimulusonset
    stimulusnumber stimulusitem stimulusonset
    stimulusnumber stimulusitem stimulusonset
    values.viewtime response latency correct
    )
</data>

Wow, this code was cool to see, and I really appreciate the work you put in here to demonstrate the efficiency for me! I have spent a while just trying to read through and try to understand what each thing does. Is there a resource for me to read up on the terms? I don't see all of them explained or defined in the manual. Regardless, I think I've come to understand how this script runs for the most part. I was wondering about a few small things now:

  1. I am not sure if it was intentional, but the filtergroup segment at the end had mod(script.groupid, 9) == 0 instead of == 1. So once I expanded it to 18 groups, should that still be a 0 such that it is mod(script.groupid, 18) == 0?
  2. How would I format the pre and post instructions so that it is more centered and nice to read? At the moment, it's just a block of text right at the top of the screen.
  3. What happens once the script completes? From the participant end, say I still wanted them to do another Qualtrics survey for demographics and other information, can I redirect them through Inquisit tools, or is that something I'd have to just instruct participants to do?


I've added on my full set of stimuli for the whole experiment, but I've noticed a few errors that I think I ended up finding solutions to. I'm curious to see if I have solved it correctly.
The first error was that the viewing time sequence was not changing within each filtergroup, but I think I fixed that by changing the viewtime list selectionmode to values.viewtimegroup rather than filtergroup.

The second issue I found was that with the later art stimuli, some of them are not the exact dimensions as the visual mask images I am using, so then parts of the visual mask stay on the screen while the stimuli is shown, only being cleared once the full screen is cleared with the "clearscreen" command.
I just added 250=clearscreen to the line:
/ stimulustimes = [0=fix; 200=mask; 250=clearscreen; 250=site]
Which seemed to work!

As for resources, read the Programmer's Manual ( https://www.millisecond.com/support/Inquisit%20Programmer's%20Manual.pdf ) and refer to the documentation ( https://www.millisecond.com/support/docs/current/html/viewer.htm ), particularly the language reference where every element, attribute, property, function, etc. is documented ( https://www.millisecond.com/support/docs/current/html/language/languagereference.htm ).

> I am not sure if it was intentional, but the filtergroup segment at the end had mod(script.groupid, 9) == 0 instead of == 1. So once I expanded it to 18 groups, should that still be a 0 such that it is mod(script.groupid, 18) == 0?

Yes, 9 modulo 9 is 0, and 18 modulo 18 is 0. That is how modular arithmetic works.

> How would I format the pre and post instructions so that it is more centered and nice to read? At the moment, it's just a block of text right at the top of the screen.

You can format text in <page> elements using HTML tags. https://www.millisecond.com/support/docs/current/html/language/markup.htm

> What happens once the script completes? From the participant end, say I still wanted them to do another Qualtrics survey for demographics and other information, can I redirect them through Inquisit tools, or is that something I'd have to just instruct participants to do?

You can specify a URL to redirect to in your web experiment's settings.

Thank you so much! I think I have the script running the way I had imagined. Now I just need to make the instruction pages look nicer and I'll be ready to go. I'll take a shot at html now too, I suppose! I haven't messed with HTML since middle school, so this will be interesting.
I appreciate those links!
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Reading This Topic

Explore
Messages
Mentions
Search