Millisecond Forums

reuse of randomly chosen stimuli

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

By piotr_styrkowiec - 5/15/2014

How to do the following thing.
We have set of 20 images. With the help of item property (and the noreplace function) these 20 images are used for the picture element that will serve as a target stimulus. There will be 5 trials in one block. So from the set of 20 images 5 is chosen randomly and presented to the participant. 
In the next block these 5 randomly chosen images need to be shown again. The question is how to record which 5 images were picked up in the first block so exactly these 5 can be used in the second block. What function (if any) can help me to achieve this. Will be very grateful for any help.
Best wishes
Piotr 
By Dave - 5/15/2014

There are a number of ways to do that, I personally prefer using <list> elements:

* Pick 4 items at random onexptbegin and store item numbers in list.chosenitemslist *
<expt>
/ onexptbegin = [list.chosenitemslist.setitem(list.allitemslist.nextvalue, 1);
    list.chosenitemslist.setitem(list.allitemslist.nextvalue, 2);
    list.chosenitemslist.setitem(list.allitemslist.nextvalue, 3);
    list.chosenitemslist.setitem(list.allitemslist.nextvalue, 4);
    ]
/ blocks = [1=a; 2=b]
</expt>

<block a>
/ trials = [1-4=mytrial]
</block>

<block b>
/ trials = [1-4=mytrial]
</block>

<trial mytrial>
/ stimulusframes = [1=mytext]
/ validresponse = (57)
</trial>

* Stimulus Elements *
<text mytext>
/ items = myitems
/ select = list.chosenitemslist.nextvalue
</text>

* 8 Items *
<item myitems>
/ 1 = "A"
/ 2 = "B"
/ 3 = "C"
/ 4 = "D"
/ 5 = "E"
/ 6 = "F"
/ 7 = "G"
/ 8 = "H"
</item>

* List Elements *
* Item numbers for the 8 potential stims *
* At the start of the experiment, 4 item numbers will be drawn from this list *
* and stored in list.chosenitemslist for use throughout the rest of the experiment *
<list allitemslist>
/ items = (1,2,3,4,5,6,7,8)
/ selectionmode = random
/ replace = false
/ selectionrate = always
</list>

* Item numbers will be replaced onexptbegin *
<list chosenitemslist>
/ items = (1,1,1,1)
/ selectionmode = random
/ replace = false
/ selectionrate = trial
</list>

By piotr_styrkowiec - 5/19/2014

Hello Dave
Thank you very much for your help.
It seems very promising though I'm not sure if I know how to modify the script you posted to work the way I want. What I mean is that in your script only FIRST four letters are chosen (this is A, B, C, D) every time the experiment is run. I worked out that I need to change  /items = (1,1,1,1) to /items =(1,2,3,4) in <list chosenitemslist> so not only the A is presented but I don't know how to modify your script so random four letters are chosen in each run of the experiment. Will be very grateful for further help.
Best
Piotr
By Dave - 5/19/2014

> What I mean is that in your script only FIRST four letters are chosen (this is A, B, C, D) every time the experiment is run

No, this is not true (as you can easily see by actually running the code). The code picks four *random* item numbers out of the the set of eight item numbers.
By piotr_styrkowiec - 5/20/2014

Sorry to question what you say though I run the script in Inquisit 4.0 for "few subjects" and it is displaying only the letter A every time....  (I copied and pasted the script you provided; no changes at all). Maybe I have got some implicit settings that are wrong? Believe me I'm saying the truth - when I run it on my computer only the letter A is presented. I have no idea what is wrong...
By Dave - 5/20/2014

I believe you. I also believe you are using a severely outdated Inquisit version. Please make sure you update.
By piotr_styrkowiec - 5/20/2014

'Supreme being' is a fully justified title in your case. Thank you very much for your help. After update everything is working perfectly. 
all the best
P
By piotr_styrkowiec - 5/20/2014

I hope this is the last question. How in the script you gave above make a following trick: all items not chosen onexptbegin are displayed in the block c? 
I'll be very grateful for help
P
By Dave - 5/20/2014

You do this the same way:

#1: Pull x items out and store them in a list to be used in blocks a and b (that's already there).

#2: Pull the remaining items out and store them in a different list to be used in block c (works just like #1).
By piotr_styrkowiec - 5/20/2014

OK, so I did something like this and the procedure displays only As in block c. Please show me where is the mistake.

* Pick 4 items at random onexptbegin and store item numbers in list.chosenitemslist *
<expt>
/ onexptbegin = [list.chosenitemslist.setitem(list.allitemslist.nextvalue, 1);
    list.chosenitemslist.setitem(list.allitemslist.nextvalue, 2);
    list.chosenitemslist.setitem(list.allitemslist.nextvalue, 3);
    list.chosenitemslist.setitem(list.allitemslist.nextvalue, 4);
    list.chosenitemslist_1.setitem(list.allitemslist.nextvalue, 5);
    list.chosenitemslist_1.setitem(list.allitemslist.nextvalue, 6);
    list.chosenitemslist_1.setitem(list.allitemslist.nextvalue, 7);
    list.chosenitemslist_1.setitem(list.allitemslist.nextvalue, 8);
    ]
/ blocks = [1=a; 2=b;  3=c]
</expt>

<block a>
/ trials = [1-4=mytrial]
</block>

<block b>
/ trials = [1-4=mytrial]
</block>

<block c>
/ trials = [1-4=mytrial_1]
</block>

<trial mytrial>
/ stimulusframes = [1=mytext]
/ validresponse = (57)
</trial>

<trial mytrial_1>
/ stimulusframes = [1=mytext_1]
/ validresponse = (57)
</trial>

* Stimulus Elements *
<text mytext>
/ items = myitems
/ select = list.chosenitemslist.nextvalue
</text>

<text mytext_1>
/ items = myitems
/ select = list.chosenitemslist_1.nextvalue
</text>

* 8 Items *
<item myitems>
/ 1 = "A"
/ 2 = "B"
/ 3 = "C"
/ 4 = "D"
/ 5 = "E"
/ 6 = "F"
/ 7 = "G"
/ 8 = "H"
</item>

* List Elements *
* Item numbers for the 8 potential stims *
* At the start of the experiment, 4 item numbers will be drawn from this list *
* and stored in list.chosenitemslist for use throughout the rest of the experiment *
<list allitemslist>
/ items = (1,2,3,4,5,6,7,8)
/ selectionmode = random
/ replace = false
/ selectionrate = always
</list>

* Item numbers will be replaced onexptbegin *
<list chosenitemslist>
/ items = (1,1,1,1)
/ selectionmode = random
/ replace = false
/ selectionrate = trial
</list> 


<list chosenitemslist_1>
/ items = (1,1,1,1)
/ selectionmode = random
/ replace = false
/ selectionrate = trail  
</list>
By Dave - 5/21/2014

    list.chosenitemslist_1.setitem(list.allitemslist.nextvalue, 5);
    list.chosenitemslist_1.setitem(list.allitemslist.nextvalue, 6);
    list.chosenitemslist_1.setitem(list.allitemslist.nextvalue, 7);
    list.chosenitemslist_1.setitem(list.allitemslist.nextvalue, 8);

You don't want to replace items 5-8 in that list (they don't even exist!). You want to replace items 1-4, just as in the other list.
By piotr_styrkowiec - 5/21/2014

Ok, I got it. Now everything's working. Thank you very much for your help.
Best
P
By Dave - 5/21/2014

Wonderful!