Randomizing presentation of stimuli


Author
Message
Hannah_Razak
Hannah_Razak
Expert (1K reputation)Expert (1K reputation)Expert (1K reputation)Expert (1K reputation)Expert (1K reputation)Expert (1K reputation)Expert (1K reputation)Expert (1K reputation)Expert (1K reputation)
Group: Forum Members
Posts: 6, Visits: 53
Hi everyone!

I'm pretty new to Inquisit and was hoping I could get some help with an experiment I'm trying to put together.

It's a standard gaze cue & spatial task in which the sequence of stimuli would be as follows:

(1) Fixation cross with left and right placeholders (remains on the screen for 500ms)
(2) Image of Face 1 - direct gaze appears (with left and right placeholders remaining on screen)(remains on the screen for 600ms)
(3) Image of Face 1 - averted gaze appears (with left and right placeholders remaining on screen)
(4) One of two targets appears in either the left or right placeholders
(5) Participants to respond by identifying targets presented

In summary, I currently have to randomise the presentation of : 2 face stimuli (face 1, face 2), 2 gaze directions (left, right), 2 targets (A, B) and 2 SOAs (300ms, 700ms)



So far, I've coded each stimuli combination individually and have all the trials randomise themselves :
For example, for the combination - Face 1 - gaze right - target A - target to appear on the right - SOA 700ms - I've coded it as such (with added conditions for the response and what data gets logged):

<trial face1_rightgaze_rightx>
/trialcode = "face1_rightgaze_rightx"

/stimulustimes = [1=fixation, target_placeholder_left, target_placeholder_right; 500=direct_face_1, target_placeholder_left, target_placeholder_right; 1100=rightgaze_face_1, target_placeholder_left, target_placeholder_right; 1800=rightgaze_face_1, target_placeholder_left, x_target_right]
/beginresponsetime = 1800 
/inputdevice=keyboard

/isvalidresponse=[trial.face1_rightgaze_rightx.response == values.responsekey1 || trial.face1_rightgaze_rightx.response == values.responsekey2]
/monkeyresponse=(30,38)
/iscorrectresponse=[trial.face1_rightgaze_rightx.beginresponsetime < values.trialduration && trial.face1_rightgaze_rightx.response == values.responsekey1]

/ontrialend = [if (trial.face1_rightgaze_rightx.correct) {values.face1rightgazerightx_countcorr += 1; values.sumrt_face1rightgazerightx += trial.face1_rightgaze_rightx.latency}
else {values.face1rightgazerightx_counterr += 1}]    

/recorddata = true
</trial>

<block block1>
/trials = [1-10=noreplace(face1_rightgaze_rightx, face1_rightgaze_leftx)]
/onblockend = [values.face1rightgazerightx_countcorr = 0; values.face1rightgazerightx_counterr = 0; values.face1rightgazeleftx_countcorr = 0; values.face1rightgazeleftx_counterr = 0]
</block>


I was wondering if there are simpler ways to randomise a set of stimuli like this while... 

(a) ...making sure that each stimuli (or in this case, direct gaze face) is linked to a subsequent stimuli (averted gaze face) for each trial
(b) ...that certain elements (i.e. the placeholders) remain on the screen as others change

I've also tried using the setstimulustimes function in this manner but got stuck when it came to linking the faces together.

Any help would be greatly appreciated! 

Thanks in advance! 



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
> In summary, I currently have to randomise the presentation of : 2 face stimuli (face 1, face 2), 2 gaze directions (left, right), 2 targets (A, B) > and 2 SOAs (300ms, 700ms)

You can encode all the combinations you need of the above factors using <list> elements. You have a total of 32 combinations:

2(face1,face2) * 2(gazeleft, gazeright) * 2(targeta, targetb) * 2(targetpositionleft, targetpositionright) * 2(targetsoa300, targetsoa700) = 32

You can then sample the applicable combination from those lists /ontrialbegin and select items, etc. accordingly.

1 = face 1; 2 = face 2;
<list facetype>
/ items = (1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2)
/ selectionmode = random
</list>

1 = face 1 left gaze; 2 = face 1 right gaze; 3 = face 2 left gaze; 4 = face 2 right gaze;
<list gazedirection>
/ items = (1,1,1,1,1,1,1,1, 2,2,2,2,2,2,2,2, 3,3,3,3,3,3,3,3, 4,4,4,4,4,4,4,4)
/ selectionmode = list.facetype.currentindex
</list>

1 = target A; 2 = target B;
<list targettype>
/ items = (1,1,1,1,2,2,2,2, 1,1,1,1,2,2,2,2, 1,1,1,1,2,2,2,2, 1,1,1,1,2,2,2,2)
/ selectionmode = list.facetype.currentindex
</list>

25% = left target position; 75% = right target position;
<list targetposition>
/ items = (25%,25%,75%,75%,25%,25%,75%,75%, 25%,25%,75%,75%,25%,25%,75%,75%, 25%,25%,75%,75%,25%,25%,75%,75%, 25%,25%,75%,75%,25%,25%,75%,75%)
/ selectionmode = list.facetype.currentindex
</list>

300 = short target soa; 700 = long target soa;
<list targetsoa>
/ items = (300,700,300,700,300,700,300,700, 300,700,300,700,300,700,300,700, 300,700,300,700,300,700,300,700, 300,700,300,700,300,700,300,700)
/ selectionmode = list.facetype.currentindex
</list>

<values>
/ facetype = 1
/ gazedirection = 1
/ targettype = 1
/ targetposition = 0%
/ targetsoa = 0
</values>

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

<trial mytrial>
/ ontrialbegin = [values.facetype = list.facetype.nextvalue; values.gazedirection = list.gazedirection.nextvalue;
    values.targettype = list.targettype.nextvalue; values.targetposition = list.targetposition.nextvalue;
    values.targetsoa = list.targetsoa.nextvalue; ]
/ ontrialbegin = [trial.mytrial.insertstimulustime(text.target, 1100 + values.targetsoa)]
/ ontrialend = [trial.mytrial.resetstimulusframes(); ]
/stimulustimes = [1=fixation, target_placeholder_left, target_placeholder_right; 500=erase_fixation, direct_face; 1100=averted_face]
/ validresponse = (57)
</trial>

<text fixation>
/ items = ("+")
/ size = (10%, 10%)
/ position = (50%, 50%)
/ vjustify = center
</text>

<shape erase_fixation>
/ shape = rectangle
/ color = white
/ size = (10%, 10%)
/ position = (50%, 50%)
</shape>

<shape target_placeholder_left>
/ shape = rectangle
/ color = blue
/ size = (20%, 30%)
/ position = (25%, 50%)
</shape>

<shape target_placeholder_right>
/ shape = rectangle
/ color = blue
/ size = (20%, 30%)
/ position = (75%, 50%)
</shape>

<text direct_face>
/ items = direct_face_items
/ select = values.facetype
/ position = (50%, 25%)
/ size = (25%, 40%)
/ txbgcolor = (grey)
</text>

<item averted_face_items>
/ 1 = "Face1left.jpg"
/ 2 = "Face1right.jpg"
/ 3 = "Face2left.jpg"
/ 4 = "Face2right.jpg"
</item>

<text averted_face>
/ items = averted_face_items
/ select = values.gazedirection
/ position = (50%, 25%)
/ size = (25%, 40%)
/ txbgcolor = (grey)
</text>

<item direct_face_items>
/ 1 = "Face1direct.jpg"
/ 2 = "Face2direct.jpg"
</item>

<text target>
/ items = target_items
/ select = values.targettype
/ hposition = values.targetposition
/ vposition = 50%
</text>

<item target_items>
/ 1 = "A"
/ 2 = "B"
</item>

<data>
/ columns = [date, time, subject, group, blocknum, blockcode, trialnum, trialcode, latency, response, correct,
    values.facetype, values.gazedirection, values.targettype, values.targetposition, values.targetsoa ]
/ separatefiles = true
</data>

Note: The above example uses <text> elements instead of <picture> elements so you can run it without needing any additional files. Everything works the same when using <picture> elements. I've also focused solely on your selection question and have thus left out some other parts of your code for the sake of brevity.

> (a) ...making sure that each stimuli (or in this case, direct gaze face) is linked to a subsequent stimuli (averted gaze face) for each trial

Is already covered in the above. For general information see the "How to present stimulus pairs" topic in the documentation.

> (b) ...that certain elements (i.e. the placeholders) remain on the screen as others change

Once a stimulus is drawn to the screen, it remains on screen until the end of the trial (unless you overwrite it with another stimulus during the course of the trial). You'll also see that in action when running the above example code. For general information see the "How to erase stimuli" topic in the documentation.


Hannah_Razak
Hannah_Razak
Expert (1K reputation)Expert (1K reputation)Expert (1K reputation)Expert (1K reputation)Expert (1K reputation)Expert (1K reputation)Expert (1K reputation)Expert (1K reputation)Expert (1K reputation)
Group: Forum Members
Posts: 6, Visits: 53
Hi Dave,

Thanks so much for your help! :)

The code works perfectly with my own stimuli. I even tried incorporating different ISIs and other features...and I think I've now got a good grasp of randomizing via the <list> function. 

I do have a couple more questions if you don’t mind.

1. Just for my understanding, does the list.listname.currentindex function work as a link between the first direct face presented and the subsequent stimuli?

2. Apart from using the <list> element, could the same setup be done using branching? If it’s possible, would you mind explaining it to me or perhaps let me know where I could read more about it? I’ve looked through the forums and the help documents but have yet to find anything relevant to this sort of experimental paradigm or something that addresses the combination of different functions like this.

Again, thank you!

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
Re. #1: the currentindex property is what links the dependent lists to the "main" list.

<list a>
/ items = ("A1", "A2", "A3")
/ selectionmode = random
</list>

<list b>
/ items = ("B1", "B2", "B3")
/ selectionmode = list.a.currentindex
</list>

means the list should return the item *corresponding* to the item index selected in <list a>. Suppose the 2nd item has been selected in list.a, then the item list.b returns will be "B2".

Re. #2: Branching in and of itself has nothing to do with selecting stimuli. The purpose of /branch is to invoke another <trial> element from a <trial> either unconditionally or only if a certain condition is met. For example, if the response in <trial a> is incorrect, run <trial b>:

<trial a>
...
/ branch = [if (trial.a.error) trial.b]
</trial>

Edited 8 Years Ago by Dave
Hannah_Razak
Hannah_Razak
Expert (1K reputation)Expert (1K reputation)Expert (1K reputation)Expert (1K reputation)Expert (1K reputation)Expert (1K reputation)Expert (1K reputation)Expert (1K reputation)Expert (1K reputation)
Group: Forum Members
Posts: 6, Visits: 53
Got it! Again, thanks so much for your help Dave. :)

(I apologize for the delayed reply)
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Reading This Topic

Explore
Messages
Mentions
Search