Millisecond Forums

Inquisit 5 noreplace/repeat problem

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

By canlabstudies - 10/19/2017

Hi there,
I'm programming a task that people rate two images on how similar they are. I have 8 images in total and if people rate image 1 with image 1, image 1 with image 2, image 1 with image 3.. etc. it would be 36 times of rating in total if each image is compared with all other images and itself. But I cant figure out how I can make people only rate each pair only once without repeats. Is there a command that I can use for that? 
Here is my script.

<data>
/ separatefiles = true
/ columns = [build, computer.platform, date, time, subject, group, blockcode, blocknum,
trialcode, values.trialnum, stimulusitem, values.left_alien, values.right_alien
response, latency]
</data>

<summarydata>
/columns = (script.filename,script.startdate, script.starttime,
script.subjectid, script.groupid, script.elapsedtime, computer.platform,
values.completed, values.attentioncheck_correct)
/ separatefiles = true
</summarydata>

<item images>
/1 = "A1.jpg"
/2 = "A2.jpg"
/3 = "A3.jpg"
/4 = "A4.jpg"
/5 = "A5.jpg"
/6 = "A6.jpg"
/7 = "A7.jpg"
/8 = "A8.jpg"
</item>

<values>
/response = 0
/trialnum = 0
/attentioncheck_correct = 0
/completed = 0
/left_alien = ""
/right_alien = ""
</values>

<picture left_images>
/ items = images
/ position = (30, 50)
/ select = noreplacenorepeat
</picture>

<picture right_images>
/ items = images
/ position = (70, 50)
/ select = noreplacenorepeat
</picture>

<picture scale>
/ items = ("scale.jpg")
/ size = (50%, 50%)
/ position = (50, 80)
</picture>

<text instructions>
/items= ("
In this task, you are asked to rate how similar

two alien images are on a scale from 1 to 4,

with 1 indicating extremely dissimilar to 4 extremely similar.

Use the number keys (1, 2, 3, 4) to respond.

Please press the spacebar to continue.")
</text>

<text attentioncheck>
/items = ("
This is an attention check question.
Please press 'f' on your keyboard.
")
/ position = (50, 70)
/ fontstyle =("Helvetica", 2.5%, false, false, false, false, 5, 0)
</text>

<text end>
/items = ("
Thanks for participating!

Please press the space bar to exit.")
</text>

<trial instructions>
/ stimulusframes = [1 = instructions]
/ validresponse = (57)
/ recorddata = false
</trial>

<trial end>
/ stimulusframes = [1 = end]
/ validresponse = (57)
/ recorddata = false
</trial>


<trial rating>
/ ontrialbegin = [values.left_alien= picture.left_images.currentitem;
values.right_alien = picture.right_images.currentitem]
/ stimulusframes = [1=picture.scale, picture.right_images, picture.left_images]
/ validresponse = (2, 3, 4, 5)
/ ontrialend = [values.trialnum = values.trialnum + 1]
</trial>

<trial attentioncheck>
/ stimulusframes = [1=attentioncheck, picture.scale, picture.right_images, picture.left_images]
/ validresponse = (2, 3, 4, 5, 33)
/ ontrialend = [if (trial.attentioncheck.response == 33) {values.attentioncheck_correct = 1}]
</trial>

<block rating>
/trials = [1=instructions; 2-18=rating; 19=attentioncheck; 20-38 = rating; 39 = end]
</block>

<expt >
/ blocks = [1=rating]
/ onexptend = [values.completed = 1]
</expt >



By Dave - 10/19/2017

canlabstudies - Thursday, October 19, 2017
Hi there,
I'm programming a task that people rate two images on how similar they are. I have 8 images in total and if people rate image 1 with image 1, image 1 with image 2, image 1 with image 3.. etc. it would be 36 times of rating in total if each image is compared with all other images and itself. But I cant figure out how I can make people only rate each pair only once without repeats. Is there a command that I can use for that? 
Here is my script.

<data>
/ separatefiles = true
/ columns = [build, computer.platform, date, time, subject, group, blockcode, blocknum,
trialcode, values.trialnum, stimulusitem, values.left_alien, values.right_alien
response, latency]
</data>

<summarydata>
/columns = (script.filename,script.startdate, script.starttime,
script.subjectid, script.groupid, script.elapsedtime, computer.platform,
values.completed, values.attentioncheck_correct)
/ separatefiles = true
</summarydata>

<item images>
/1 = "A1.jpg"
/2 = "A2.jpg"
/3 = "A3.jpg"
/4 = "A4.jpg"
/5 = "A5.jpg"
/6 = "A6.jpg"
/7 = "A7.jpg"
/8 = "A8.jpg"
</item>

<values>
/response = 0
/trialnum = 0
/attentioncheck_correct = 0
/completed = 0
/left_alien = ""
/right_alien = ""
</values>

<picture left_images>
/ items = images
/ position = (30, 50)
/ select = noreplacenorepeat
</picture>

<picture right_images>
/ items = images
/ position = (70, 50)
/ select = noreplacenorepeat
</picture>

<picture scale>
/ items = ("scale.jpg")
/ size = (50%, 50%)
/ position = (50, 80)
</picture>

<text instructions>
/items= ("
In this task, you are asked to rate how similar

two alien images are on a scale from 1 to 4,

with 1 indicating extremely dissimilar to 4 extremely similar.

Use the number keys (1, 2, 3, 4) to respond.

Please press the spacebar to continue.")
</text>

<text attentioncheck>
/items = ("
This is an attention check question.
Please press 'f' on your keyboard.
")
/ position = (50, 70)
/ fontstyle =("Helvetica", 2.5%, false, false, false, false, 5, 0)
</text>

<text end>
/items = ("
Thanks for participating!

Please press the space bar to exit.")
</text>

<trial instructions>
/ stimulusframes = [1 = instructions]
/ validresponse = (57)
/ recorddata = false
</trial>

<trial end>
/ stimulusframes = [1 = end]
/ validresponse = (57)
/ recorddata = false
</trial>


<trial rating>
/ ontrialbegin = [values.left_alien= picture.left_images.currentitem;
values.right_alien = picture.right_images.currentitem]
/ stimulusframes = [1=picture.scale, picture.right_images, picture.left_images]
/ validresponse = (2, 3, 4, 5)
/ ontrialend = [values.trialnum = values.trialnum + 1]
</trial>

<trial attentioncheck>
/ stimulusframes = [1=attentioncheck, picture.scale, picture.right_images, picture.left_images]
/ validresponse = (2, 3, 4, 5, 33)
/ ontrialend = [if (trial.attentioncheck.response == 33) {values.attentioncheck_correct = 1}]
</trial>

<block rating>
/trials = [1=instructions; 2-18=rating; 19=attentioncheck; 20-38 = rating; 39 = end]
</block>

<expt >
/ blocks = [1=rating]
/ onexptend = [values.completed = 1]
</expt >




The solution is to encode the 36 pairings using e.g. two linked <list> elements, and then randomly sample the 36 pairs:

//the 36 pairs expressed as pairings of item numbers
//the 1st item in list.1stitem is paired with the 1st item in list.2nditem and so forth
<list 1stitem>
/ items = (
    1,1,1,1,1,1,1,1,
    2,2,2,2,2,2,2,
    3,3,3,3,3,3,
    4,4,4,4,4,
    5,5,5,5,
    6,6,6,
    7,7,
    8
    )
/ selectionmode = random
/ replace = false
/ maxrunsize = 1
</list>

<list 2nditem>
/ items = (
    1,2,3,4,5,6,7,8,
    2,3,4,5,6,7,8,
    3,4,5,6,7,8,
    4,5,6,7,8,
    5,6,7,8,
    6,7,8,
    7,8,
    8
    )
/ selectionmode = list.1stitem.currentindex
</list>


Full code would look along the lines of this:

<data>
/ separatefiles = true
/ columns = [build, computer.platform, date, time, subject, group, blockcode, blocknum,
trialcode, values.trialnum, stimulusitem, values.left_alien, values.right_alien
response, latency, values.1stitem, values.2nditem]
</data>

<summarydata>
/columns = (script.filename,script.startdate, script.starttime,
script.subjectid, script.groupid, script.elapsedtime, computer.platform,
values.completed, values.attentioncheck_correct)
/ separatefiles = true
</summarydata>

<item images>
/1 = "A1.jpg"
/2 = "A2.jpg"
/3 = "A3.jpg"
/4 = "A4.jpg"
/5 = "A5.jpg"
/6 = "A6.jpg"
/7 = "A7.jpg"
/8 = "A8.jpg"
</item>

<values>
/response = 0
/trialnum = 0
/attentioncheck_correct = 0
/completed = 0
/left_alien = ""
/right_alien = ""
/1stitem = 1
/2nditem = 1
</values>

//the 36 pairs expressed as pairings of item numbers
//the 1st item in list.1stitem is paired with the 1st item in list.2nditem and so forth
<list 1stitem>
/ items = (
    1,1,1,1,1,1,1,1,
    2,2,2,2,2,2,2,
    3,3,3,3,3,3,
    4,4,4,4,4,
    5,5,5,5,
    6,6,6,
    7,7,
    8)
/ selectionmode = random
/ replace = false
/ maxrunsize = 1
</list>

<list 2nditem>
/ items = (
    1,2,3,4,5,6,7,8,
    2,3,4,5,6,7,8,
    3,4,5,6,7,8,
    4,5,6,7,8,
    5,6,7,8,
    6,7,8,
    7,8,
    8)
/ selectionmode = list.1stitem.currentindex
</list>

//randomizes whether the 1st item of the pair is displayed on the left or the right:
<list rand_left_right>
/ items = (values.1stitem, values.2nditem)
/ selectionrate = always
</list>

<picture left_images>
/ items = images
/ position = (30, 50)
/ select = list.rand_left_right.nextvalue
</picture>

<picture right_images>
/ items = images
/ position = (70, 50)
/ select = list.rand_left_right.nextvalue
</picture>

<picture scale>
/ items = ("scale.jpg")
/ size = (50%, 50%)
/ position = (50, 80)
</picture>

<text instructions>
/items= ("
In this task, you are asked to rate how similar

two alien images are on a scale from 1 to 4,

with 1 indicating extremely dissimilar to 4 extremely similar.

Use the number keys (1, 2, 3, 4) to respond.

Please press the spacebar to continue.")
</text>

<text attentioncheck>
/items = ("
This is an attention check question.
Please press 'f' on your keyboard.
")
/ position = (50, 70)
/ fontstyle =("Helvetica", 2.5%, false, false, false, false, 5, 0)
</text>

<text end>
/items = ("
Thanks for participating!

Please press the space bar to exit.")
</text>

<trial instructions>
/ stimulusframes = [1 = instructions]
/ validresponse = (57)
/ recorddata = false
</trial>

<trial end>
/ stimulusframes = [1 = end]
/ validresponse = (57)
/ recorddata = false
</trial>


<trial rating>
/ ontrialbegin = [
    values.1stitem = list.1stitem.nextvalue;
    values.2nditem = list.2nditem.nextvalue;
]
/ ontrialend = [values.left_alien= picture.left_images.currentitem;
values.right_alien = picture.right_images.currentitem]
/ stimulusframes = [1=picture.scale, picture.right_images, picture.left_images]
/ validresponse = (2, 3, 4, 5)
/ ontrialend = [values.trialnum = values.trialnum + 1]
</trial>

<trial attentioncheck>
/ stimulusframes = [1=attentioncheck, picture.scale, picture.right_images, picture.left_images]
/ validresponse = (2, 3, 4, 5, 33)
/ ontrialend = [if (trial.attentioncheck.response == 33) {values.attentioncheck_correct = 1}]
</trial>

<block rating>
/trials = [1=instructions; 2-18=rating; 19=attentioncheck; 20-38 = rating; 39 = end]
</block>

<expt >
/ blocks = [1=rating]
/ onexptend = [values.completed = 1]
</expt>


Hope this helps!
By canlabstudies - 10/20/2017

Dave - Thursday, October 19, 2017
canlabstudies - Thursday, October 19, 2017
Hi there,
I'm programming a task that people rate two images on how similar they are. I have 8 images in total and if people rate image 1 with image 1, image 1 with image 2, image 1 with image 3.. etc. it would be 36 times of rating in total if each image is compared with all other images and itself. But I cant figure out how I can make people only rate each pair only once without repeats. Is there a command that I can use for that? 
Here is my script.

<data>
/ separatefiles = true
/ columns = [build, computer.platform, date, time, subject, group, blockcode, blocknum,
trialcode, values.trialnum, stimulusitem, values.left_alien, values.right_alien
response, latency]
</data>

<summarydata>
/columns = (script.filename,script.startdate, script.starttime,
script.subjectid, script.groupid, script.elapsedtime, computer.platform,
values.completed, values.attentioncheck_correct)
/ separatefiles = true
</summarydata>

<item images>
/1 = "A1.jpg"
/2 = "A2.jpg"
/3 = "A3.jpg"
/4 = "A4.jpg"
/5 = "A5.jpg"
/6 = "A6.jpg"
/7 = "A7.jpg"
/8 = "A8.jpg"
</item>

<values>
/response = 0
/trialnum = 0
/attentioncheck_correct = 0
/completed = 0
/left_alien = ""
/right_alien = ""
</values>

<picture left_images>
/ items = images
/ position = (30, 50)
/ select = noreplacenorepeat
</picture>

<picture right_images>
/ items = images
/ position = (70, 50)
/ select = noreplacenorepeat
</picture>

<picture scale>
/ items = ("scale.jpg")
/ size = (50%, 50%)
/ position = (50, 80)
</picture>

<text instructions>
/items= ("
In this task, you are asked to rate how similar

two alien images are on a scale from 1 to 4,

with 1 indicating extremely dissimilar to 4 extremely similar.

Use the number keys (1, 2, 3, 4) to respond.

Please press the spacebar to continue.")
</text>

<text attentioncheck>
/items = ("
This is an attention check question.
Please press 'f' on your keyboard.
")
/ position = (50, 70)
/ fontstyle =("Helvetica", 2.5%, false, false, false, false, 5, 0)
</text>

<text end>
/items = ("
Thanks for participating!

Please press the space bar to exit.")
</text>

<trial instructions>
/ stimulusframes = [1 = instructions]
/ validresponse = (57)
/ recorddata = false
</trial>

<trial end>
/ stimulusframes = [1 = end]
/ validresponse = (57)
/ recorddata = false
</trial>


<trial rating>
/ ontrialbegin = [values.left_alien= picture.left_images.currentitem;
values.right_alien = picture.right_images.currentitem]
/ stimulusframes = [1=picture.scale, picture.right_images, picture.left_images]
/ validresponse = (2, 3, 4, 5)
/ ontrialend = [values.trialnum = values.trialnum + 1]
</trial>

<trial attentioncheck>
/ stimulusframes = [1=attentioncheck, picture.scale, picture.right_images, picture.left_images]
/ validresponse = (2, 3, 4, 5, 33)
/ ontrialend = [if (trial.attentioncheck.response == 33) {values.attentioncheck_correct = 1}]
</trial>

<block rating>
/trials = [1=instructions; 2-18=rating; 19=attentioncheck; 20-38 = rating; 39 = end]
</block>

<expt >
/ blocks = [1=rating]
/ onexptend = [values.completed = 1]
</expt >




The solution is to encode the 36 pairings using e.g. two linked <list> elements, and then randomly sample the 36 pairs:

//the 36 pairs expressed as pairings of item numbers
//the 1st item in list.1stitem is paired with the 1st item in list.2nditem and so forth
<list 1stitem>
/ items = (
    1,1,1,1,1,1,1,1,
    2,2,2,2,2,2,2,
    3,3,3,3,3,3,
    4,4,4,4,4,
    5,5,5,5,
    6,6,6,
    7,7,
    8
    )
/ selectionmode = random
/ replace = false
/ maxrunsize = 1
</list>

<list 2nditem>
/ items = (
    1,2,3,4,5,6,7,8,
    2,3,4,5,6,7,8,
    3,4,5,6,7,8,
    4,5,6,7,8,
    5,6,7,8,
    6,7,8,
    7,8,
    8
    )
/ selectionmode = list.1stitem.currentindex
</list>


Full code would look along the lines of this:

<data>
/ separatefiles = true
/ columns = [build, computer.platform, date, time, subject, group, blockcode, blocknum,
trialcode, values.trialnum, stimulusitem, values.left_alien, values.right_alien
response, latency, values.1stitem, values.2nditem]
</data>

<summarydata>
/columns = (script.filename,script.startdate, script.starttime,
script.subjectid, script.groupid, script.elapsedtime, computer.platform,
values.completed, values.attentioncheck_correct)
/ separatefiles = true
</summarydata>

<item images>
/1 = "A1.jpg"
/2 = "A2.jpg"
/3 = "A3.jpg"
/4 = "A4.jpg"
/5 = "A5.jpg"
/6 = "A6.jpg"
/7 = "A7.jpg"
/8 = "A8.jpg"
</item>

<values>
/response = 0
/trialnum = 0
/attentioncheck_correct = 0
/completed = 0
/left_alien = ""
/right_alien = ""
/1stitem = 1
/2nditem = 1
</values>

//the 36 pairs expressed as pairings of item numbers
//the 1st item in list.1stitem is paired with the 1st item in list.2nditem and so forth
<list 1stitem>
/ items = (
    1,1,1,1,1,1,1,1,
    2,2,2,2,2,2,2,
    3,3,3,3,3,3,
    4,4,4,4,4,
    5,5,5,5,
    6,6,6,
    7,7,
    8)
/ selectionmode = random
/ replace = false
/ maxrunsize = 1
</list>

<list 2nditem>
/ items = (
    1,2,3,4,5,6,7,8,
    2,3,4,5,6,7,8,
    3,4,5,6,7,8,
    4,5,6,7,8,
    5,6,7,8,
    6,7,8,
    7,8,
    8)
/ selectionmode = list.1stitem.currentindex
</list>

//randomizes whether the 1st item of the pair is displayed on the left or the right:
<list rand_left_right>
/ items = (values.1stitem, values.2nditem)
/ selectionrate = always
</list>

<picture left_images>
/ items = images
/ position = (30, 50)
/ select = list.rand_left_right.nextvalue
</picture>

<picture right_images>
/ items = images
/ position = (70, 50)
/ select = list.rand_left_right.nextvalue
</picture>

<picture scale>
/ items = ("scale.jpg")
/ size = (50%, 50%)
/ position = (50, 80)
</picture>

<text instructions>
/items= ("
In this task, you are asked to rate how similar

two alien images are on a scale from 1 to 4,

with 1 indicating extremely dissimilar to 4 extremely similar.

Use the number keys (1, 2, 3, 4) to respond.

Please press the spacebar to continue.")
</text>

<text attentioncheck>
/items = ("
This is an attention check question.
Please press 'f' on your keyboard.
")
/ position = (50, 70)
/ fontstyle =("Helvetica", 2.5%, false, false, false, false, 5, 0)
</text>

<text end>
/items = ("
Thanks for participating!

Please press the space bar to exit.")
</text>

<trial instructions>
/ stimulusframes = [1 = instructions]
/ validresponse = (57)
/ recorddata = false
</trial>

<trial end>
/ stimulusframes = [1 = end]
/ validresponse = (57)
/ recorddata = false
</trial>


<trial rating>
/ ontrialbegin = [
    values.1stitem = list.1stitem.nextvalue;
    values.2nditem = list.2nditem.nextvalue;
]
/ ontrialend = [values.left_alien= picture.left_images.currentitem;
values.right_alien = picture.right_images.currentitem]
/ stimulusframes = [1=picture.scale, picture.right_images, picture.left_images]
/ validresponse = (2, 3, 4, 5)
/ ontrialend = [values.trialnum = values.trialnum + 1]
</trial>

<trial attentioncheck>
/ stimulusframes = [1=attentioncheck, picture.scale, picture.right_images, picture.left_images]
/ validresponse = (2, 3, 4, 5, 33)
/ ontrialend = [if (trial.attentioncheck.response == 33) {values.attentioncheck_correct = 1}]
</trial>

<block rating>
/trials = [1=instructions; 2-18=rating; 19=attentioncheck; 20-38 = rating; 39 = end]
</block>

<expt >
/ blocks = [1=rating]
/ onexptend = [values.completed = 1]
</expt>


Hope this helps!

Thank you so much! This is extremely helpful!!