Millisecond Forums

fully randomized conditional presentation of three stimuli

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

By René Kopietz - 12/10/2014

Hello,

we're currently programming a study using based on Gawronski & Walther (2008) TAR effect, in which there are 60 trials presenting three stimuli each.
Each trial involves a picture of a person (LEFT) as source of an evaluation (likes/dislikes; MIDDLE) about another person (RIGHT). 
In the original paradigm 12 pictures are chosen as source (picture on the left side) and 5 as targets (pictures on the right side).
Each source is then presented with five different targets, always liking OR disliking them. Ideally, we would like to randomize who is source and who is target for each participant, so that at the beginning of each session two temporary lists (one with the 12 targets, one with the 5 sources) is generated. Additionally, Inquest would need to chose whether sources like or dislike their 5 targets and REMEMBER that, so that each source consistently dis/likes their target.

Is that possible? We couldn't find any obvious way of programming this. If not, what would be the best possible compromise?


Thanks,
Rene

By Dave - 12/11/2014

Yes, that's perfectly possible. You can dynamically fill e.g. <list> elements at the beginning of the procedure. Suppose you have 6 items A-F. You want to randomly assign 4 of them as "source", 2 as "target".

<block myblock>
/ onblockbegin = [list.sourceitems.appenditem(list.allitems.nextindex); list.sourceitems.appenditem(list.allitems.nextindex);
    list.sourceitems.appenditem(list.allitems.nextindex); list.sourceitems.appenditem(list.allitems.nextindex);
    list.targetitems.appenditem(list.allitems.nextindex); list.targetitems.appenditem(list.allitems.nextindex);]
/ trials = [1-4=showsources; 5-6=showtargets]
</block>

<trial showsources>
/ stimulusframes = [1=sourcetxt]
/ validresponse = (57)
</trial>

<trial showtargets>
/ stimulusframes = [1=targettxt]
/ validresponse = (57)
</trial>

<text sourcetxt>
/items = myitems
/ select = list.sourceitems.nextvalue
/ txcolor = blue
</text>

<text targettxt>
/items = myitems
/ select = list.targetitems.nextvalue
/ txcolor = red
</text>

<item myitems>
/ 1 = "A"
/ 2 = "B"
/ 3 = "C"
/ 4 = "D"
/ 5 = "E"
/ 6 = "F"
</item>

<list allitems>
/ poolsize = 6
/ selectionrate = always
</list>

<list sourceitems>
</list>

<list targetitems>
</list>

Assigning the like / dislike dimension etc. works analogously.
By Christina F - 3/29/2015

Concerning the previous post, there are some questions left.
The relevant part of our script is attached.

1. Most of the time, sources
and targets are presented correctly.
But in some tri
als the target-picture appears as source and target at the same time.
C
an you detect the error?

2. In the current version, sources and targets are randomly combined.
In our experiment
each source should be presented with each target once:
Source 1 + Target 1
Source 1 + Target 2
Source 2 + Target 1
Source 2 + Target 2
Source 3 + Target 1
Source 3 + Target 2
Source 4 + Target 1
Source 4 + Target 2
Is there
any way to control this combination?

Th
anks,
Christin
a

<block relation>
/ onblockbegin = [list.sourceitemslike.appenditem(list.allitems.nextindex); list.sourceitemslike.appenditem(list.allitems.nextindex);
    list.sourceitemsdislike.appenditem(list.allitems.nextindex); list.sourceitemsdislike.appenditem(list.allitems.nextindex);
    list.targetitems.appenditem(list.allitems.nextindex); list.targetitems.appenditem(list.allitems.nextindex);]
/ trials = [1-8 = noreplace(relationlike, relationdislike)]
</block>

<trial relationlike>
/ stimulusframes = [1=sourcelike; 2=target; 3=like]
/timeout = 5000
/pretrialpause= 1000
</trial>

<trial relationdislike>
/ stimulusframes = [1=sourcedislike; 2=target; 3=dislike]
/timeout = 5000
/pretrialpause= 1000
</trial>

<text like>
/items = ("mag")
/position= (50,50)
/fontstyle= ("ARIAL", 40, true, false, false, false, 5, 0)
/ select = replace
</text>

<text dislike>
/items = ("mag nicht")
/position= (50,50)
/fontstyle= ("ARIAL", 40, true, false, false, false, 5, 0)
/ select = replace
</text>

<picture sourcelike>
/items = kollegen
/ select = list.sourceitemslike.nextvalue
/ position= (25,50)
/ size = (30%, 30%)
</picture>

<picture sourcedislike>
/items = kollegen
/ select = list.sourceitemsdislike.nextvalue
/ position= (25,50)
/ size = (30%, 30%)
</picture>

<picture target>
/items = kollegen
/ select = list.targetitems.nextvalue
/ position= (75,50)
/ size = (30%, 30%)
</picture>

<item kollegen>
/1 = "2.jpg"
/2 = "3.jpg"
/3 = "4.jpg"
/4 = "5.bmp"
/5 = "6.jpg"
/6 = "7.jpg"
/7 = "8.jpg"
/8 = "9.bmp"
/9 = "10.jpg"
/10 = "11.bmp"
</item>

<list allitems>
/ poolsize = 10
/ selectionrate = always
</list>

<list sourceitemslike>
</list>

<list sourceitemsdislike>
</list>

<list targetitems>
</list>
By Dave - 3/29/2015

Re #1: That cannot happen *if* you run <block relation> only once. It can happen if you run it repeatedly in your full script. You sample 6 random items from <list allitems> /onblockbegin. After that, 4 unsampled items are left in that list. If you run <block relations> (or another block sampling from the list) again -- again taking 6 samples -- the list has to reset after 4 items, returning all 10 items back into the pool, and you may end up with the same item(s) sampled again. The solution is to make use of a list reset() before you do that, i.e.

/ onblockbegin = [list.allitems.reset(); ]

Similarly, you'll want to call the clearitems() function on the source and target lists before you assign any new items to them.

/ onblockbegin = [list.sourceitemsdislike.clearitems(); ...]


Re. #2: Yes. You need to link your source and target lists and set up the desired combinations via /onblockbegin.
<block relation>
/ onblockbegin = [list.sourceitemslike.appenditem(list.allitems.nextindex); list.sourceitemslike.appenditem(list.allitems.currentindex);
    list.sourceitemslike.appenditem(list.allitems.nextindex); list.sourceitemslike.appenditem(list.allitems.currentindex);
  
    list.sourceitemsdislike.appenditem(list.allitems.nextindex); list.sourceitemsdislike.appenditem(list.allitems.currentindex);
    list.sourceitemsdislike.appenditem(list.allitems.nextindex); list.sourceitemsdislike.appenditem(list.allitems.currentindex);

    list.targetitemslike.appenditem(list.allitems.nextindex); list.targetitemslike.appenditem(list.allitems.nextindex);
    list.targetitemslike.appenditem(list.targetitemslike.item(1)); list.targetitemslike.appenditem(list.targetitemslike.item(2));

    list.targetitemsdislike.appenditem(list.targetitemslike.item(1)); list.targetitemsdislike.appenditem(list.targetitemslike.item(2));
    list.targetitemsdislike.appenditem(list.targetitemslike.item(1)); list.targetitemsdislike.appenditem(list.targetitemslike.item(2));
]
/ trials = [1-8 = noreplace(relationlike, relationdislike)]
</block>

<trial relationlike>
/ stimulusframes = [1=sourcelike; 2=targetlike; 3=like]
/timeout = 5000
/pretrialpause= 1000
</trial>

<trial relationdislike>
/ stimulusframes = [1=sourcedislike; 2=targetdislike; 3=dislike]
/timeout = 5000
/pretrialpause= 1000
</trial>

<text like>
/items = ("mag")
/position= (50,50)
/fontstyle= ("ARIAL", 40, true, false, false, false, 5, 0)
/ select = replace
</text>

<text dislike>
/items = ("mag nicht")
/position= (50,50)
/fontstyle= ("ARIAL", 40, true, false, false, false, 5, 0)
/ select = replace
</text>

<text sourcelike>
/items = kollegen
/ select = list.sourceitemslike.nextvalue
/ position= (25,50)
/ size = (30%, 30%)
</text>

<text sourcedislike>
/items = kollegen
/ select = list.sourceitemsdislike.nextvalue
/ position= (25,50)
/ size = (30%, 30%)
</text>

<text targetlike>
/items = kollegen
/ select = list.targetitemslike.nextvalue
/ position= (75,50)
/ size = (30%, 30%)
</text>

<text targetdislike>
/items = kollegen
/ select = list.targetitemsdislike.nextvalue
/ position= (75,50)
/ size = (30%, 30%)
</text>

<item kollegen>
/1 = "2.jpg"
/2 = "3.jpg"
/3 = "4.jpg"
/4 = "5.bmp"
/5 = "6.jpg"
/6 = "7.jpg"
/7 = "8.jpg"
/8 = "9.bmp"
/9 = "10.jpg"
/10 = "11.bmp"
</item>

<list allitems>
/ poolsize = 10
/ selectionrate = always
</list>

<list sourceitemslike>
</list>

<list targetitemslike>
/ selectionmode = list.sourceitemslike.currentindex
</list>


<list sourceitemsdislike>
</list>

<list targetitemsdislike>
/ selectionmode = list.sourceitemsdislike.currentindex
</list>


EDITED TO FIX MISTAKE IN ABOVE SCRIPT.
By Christina F - 4/14/2015

Hello,

the corrected script seems to work on a mac computer, version 4.0.7. Thanks a lot!
But on my Windows computer, version 4.0.8. there are still some complications.
When you are just looking on the data, everything seems fine and correct.
But for several times in the presentation, one stimulus was presented as source and target at the same time,
without being recorded in the data. Instead, other items were recorded, which were not shown in the trial.

Could the problem be a Windows bug?
Do you have any idea to solve the problem?

Thank you,
Christina

By Dave - 4/14/2015

I would say that a Windows / Inquisit bug is unlikely. It's more likely that a mistake is still lurking somewhere in your script.

Another -- albeit remote -- possibility is a botched graphics card driver on your Windows box. Update it to the latest version available from the vendor.
By Rene - 4/15/2015

Dave,

we've run Christina's script several times with varying amounts of trials on my Macbook and couldn't replicate the error she's describing here. Pictures from the generated sources were exclusively shown where the were supposed to be and we never once had the same picture shown twice. Wouldn't that rule out a script error? Or are the situations where the same script is interpreted differently depending on the OS?

Thanks,
Rene
By Dave - 4/15/2015

Rene,

No, scripts should of course *not* be interpreted differently depending on OS. But note that you're not using the same Inquisit version under Mac and Windows (4.0.7.0 on the Mac; 4.0.8.0 under Windows). Whether that plays a role here, I don't know.

FWIW, the example code I've provided throughout this thread has been tested under Windows / Inquisit 4.0.8.0 and definitely works as expected for me.

Also, errors can be probabilistic in nature, especially if random sampling is involved. I.e., the error may be there, lurking in the background, but you might not hit the specific conditions under which it reveals itself.

As mentioned previously, there is a possibility that a buggy graphics card driver causes the weird behavior. Try updating the driver on the Windows box.

If none of that helps, attach the entire code to this thread and provide whatever additional info you can illustrating the error (data files, screenshots, etc.).
By Christina F - 4/16/2015

Hello Dave,
thanks a lot! The update did help and it seems to work right now.

A different question:
For another trial I need to present each source once for a rating of their likability:

<likert likability>
/stimulusframes = [1=question; 2= noreplace(sourcelike2, sourcedislike2)]
/anchors = [1 = "sehr unsympathisch", 2="", 3="", 4="", 5="", 6="", 7="", 8="", 9= "sehr sympathisch"]
/numpoints = 9
/anchorwidth = 100
/position = (50,70)
</likert>

<picture sourcelike2>
/items = kollegen
/ select = list.sourceitemslike.nextvalue
/ position= (50,30)
/ size = (40%, 40%)
</picture>

<picture sourcedislike2>
/items = kollegen
/ select = list.sourceitemsdislike.nextvalue
/ position= (50,30)
/ size = (40%, 40%)
</picture>

<block likability>
/preinstructions = (likability)
/trials = [1 - 4=likability]
</block>

Right now, one photo is presented twice, because the list contains it two times.
How can I pick it once?

Thanks,
Christina
By Dave - 4/16/2015

> Right now, one photo is presented twice, because the list contains it two times.
> How can I pick it once?

Set up <list>s that only contain the item once (you already know how to do that as that's what's been discussed throughout the thread), use those lists for sampling in your rating-block.
By Christina F - 4/16/2015

Hello Dave,

maybe I didn't explain it very clearly.

I need to show the same sources again and don't want to create a new list.
First the sources are shown with the targets and the relation (that's what we've already written about and is working right now)
but afterwards I want to show the same sources again. Each source should be presented once in a likability rating.
Like that, I want to pick each source once out of the lists, which were created for the relation-block.

I am referring to your edited version of the script and want to add the likability rating.
I am attaching both.

Hopefully, this was a bit more comprehensible.

Thanks a lot,
Christina

-------------------EDITED SCRIPT------------------------
<block relation>
/ onblockbegin = [list.sourceitemslike.appenditem(list.allitems.nextindex); list.sourceitemslike.appenditem(list.allitems.currentindex);
    list.sourceitemslike.appenditem(list.allitems.nextindex); list.sourceitemslike.appenditem(list.allitems.currentindex);
  
    list.sourceitemsdislike.appenditem(list.allitems.nextindex); list.sourceitemsdislike.appenditem(list.allitems.currentindex);
    list.sourceitemsdislike.appenditem(list.allitems.nextindex); list.sourceitemsdislike.appenditem(list.allitems.currentindex);

    list.targetitemslike.appenditem(list.allitems.nextindex); list.targetitemslike.appenditem(list.allitems.nextindex);
    list.targetitemslike.appenditem(list.targetitemslike.item(1)); list.targetitemslike.appenditem(list.targetitemslike.item(2));

    list.targetitemsdislike.appenditem(list.targetitemslike.item(1)); list.targetitemsdislike.appenditem(list.targetitemslike.item(2));
    list.targetitemsdislike.appenditem(list.targetitemslike.item(1)); list.targetitemsdislike.appenditem(list.targetitemslike.item(2));]
/ trials = [1-8 = noreplace(relationlike, relationdislike)]
</block>

<trial relationlike>
/ stimulusframes = [1=sourcelike; 2=targetlike; 3=like]
/timeout = 5000
/pretrialpause= 1000
</trial>

<trial relationdislike>
/ stimulusframes = [1=sourcedislike; 2=targetdislike; 3=dislike]
/timeout = 5000
/pretrialpause= 1000
</trial>

<text like>
/items = ("mag")
/position= (50,50)
/fontstyle= ("ARIAL", 40, true, false, false, false, 5, 0)
/ select = replace
</text>

<text dislike>
/items = ("mag nicht")
/position= (50,50)
/fontstyle= ("ARIAL", 40, true, false, false, false, 5, 0)
/ select = replace
</text>

<text sourcelike>
/items = kollegen
/ select = list.sourceitemslike.nextvalue
/ position= (25,50)
/ size = (30%, 30%)
</text>

<text sourcedislike>
/items = kollegen
/ select = list.sourceitemsdislike.nextvalue
/ position= (25,50)
/ size = (30%, 30%)
</text>

<text targetlike>
/items = kollegen
/ select = list.targetitemslike.nextvalue
/ position= (75,50)
/ size = (30%, 30%)
</text>

<text targetdislike>
/items = kollegen
/ select = list.targetitemsdislike.nextvalue
/ position= (75,50)
/ size = (30%, 30%)
</text>

<item kollegen>
/1 = "2.jpg"
/2 = "3.jpg"
/3 = "4.jpg"
/4 = "5.bmp"
/5 = "6.jpg"
/6 = "7.jpg"
/7 = "8.jpg"
/8 = "9.bmp"
/9 = "10.jpg"
/10 = "11.bmp"
</item>

<list allitems>
/ poolsize = 10
/ selectionrate = always
</list>

<list sourceitemslike>
</list>

<list targetitemslike>
/ selectionmode = list.sourceitemslike.currentindex
</list>


<list sourceitemsdislike>
</list>

<list targetitemsdislike>
/ selectionmode = list.sourceitemsdislike.currentindex
</list>


--------------------NEW PART OF THE SCRIPT---------------------------------
<likert likability>
/stimulusframes = [1=question; 2= noreplace(sourcelike2, sourcedislike2)]
/anchors = [1 = "sehr unsympathisch", 2="", 3="", 4="", 5="", 6="", 7="", 8="", 9= "sehr sympathisch"]
/numpoints = 9
/anchorwidth = 100
/position = (50,70)
</likert>

<picture sourcelike2>
/items = kollegen
/ select = list.sourceitemslike.nextvalue
/ position= (50,30)
/ size = (40%, 40%)
</picture>

<picture sourcedislike2>
/items = kollegen
/ select = list.sourceitemsdislike.nextvalue
/ position= (50,30)
/ size = (40%, 40%)
</picture>

<block likability>
/preinstructions = (likability)
/trials = [1 - 4=likability]
</block>


By Dave - 4/16/2015

> I need to show the same sources again and don't want to create a new list.

I understood that. You may not want to create a new list, but that is what you have to do. The only alternative is to remove the 2nd instance of each item from the existing <list>s (see the documentation for the list element's removeitem() function). Note that this will *destroy* the lists' existing structure, i.e., if you want to again show the source-target pairs later on, that won't be possible without you re-creating the lists' original structure.
By Christina F - 4/21/2015

Hello Dave,

thanks a lot! I did get your point and it is working right now! Great!

Unfortunately, there is a new problem.
Sometimes, not every time, there is an error that appears during theexperiment.
The experiment starts and the first pages are shown, but right before the<block relation> or after the first few presentations it is terminatedand there is this message:
'Unable to initialize <picture targetlike> item number 29. Verify theitem exists and is correctly defined.'
Most of the time it concerns item numer 0 or the last items of the liststargetlike or targetdislike.This error appears in each of my three conditions,which have separate lists.

I tested every picture and there was no problem in presenting them on thescreen, so that doesn't seem to be the error.
I am afraid there is a mistake in the definiton of the lists.

Do you have any idea?
I attached my script and the stimuli as a zip-folder. I couldn't attach the chinese characters for the AMP (block test, pic1 - pic200)
Maybe you could transpose them to text elements, as you did before.

Thanks again,
Christina

By Dave - 4/21/2015

> 'Unable to initialize <picture targetlike> item number 29. Verify theitem exists and is correctly defined.'
> Most of the time it concerns item numer 0 or the last items of the liststargetlike or targetdislike.This error appears
> in each of my three conditions,which have separate lists.


Means that you are referring to an item number *at runtime* which does not exist in the respective <list>. If you are displaying images, there can be no item 0. If the error pertains to any other item number, that item does not exist. For example, there is no item number 29 in <picture targetlike>:

<picture targetdislike>
/items = kollegen
/select = list.targetitemsdislike.nextindex
/ position= (70,50)
/ size = (30%, 30%)
</picture>



<item kollegen>
/1 = "1.bmp"
/2 = "2.jpg"
/3 = "3.bmp"
/4 = "4.jpg"
/5 = "5.bmp"
/6 = "6.jpg"
/7 = "7.jpg"
/8 = "8.jpg"
/9 = "9.bmp"
/10 = "10.jpg"
/11 = "11.bmp"
/12 = "12.bmp"
/13 = "13.bmp"
/14 = "14.bmp"
/15 = "15.jpg"
/16 = "16.jpg"
/17 = "17.jpg"
/18 = "18.bmp"
/19 = "19.jpg"
/20 = "20.bmp"
/21 = "21.jpg"
/22 = "22.bmp"
/23 = "23.jpg"
/24 = "24.jpg"
/25 = "25.bmp"
/26 = "26.png"
/27 = "27.png"
/28 = "28.jpg"
</item>

There are 28 items, not 29.

The problem likely is that you are selecting according to the list's item *index*.

/select = list.targetitemsdislike.nextindex

You *should* be selecting according to the list's item *value*.

/select = list.targetitemsdislike.nextvalue


Your lists contain the same item numbers multiple times, i.e., there are many more entries in the list than there are items.

For example, consider

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

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

<picture mypicture>
/ items = ("A.bmp", "B.bmp")
/ select = list.mylist.nextindex
</picture>

<list mylist>
/ items = (1,1,2,2)
</list>

which will *fail*, versus the correct

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

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

<picture mypicture>
/ items = ("A.bmp", "B.bmp")
/ select = list.mylist.nextvalue
</picture>

<list mylist>
/ items = (1,1,2,2)
</list>