Millisecond Forums

Showing stimuli an exact amount of time in an random order

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

By kimsobania - 11/19/2017

Hello,

I adapted Verbruggen's Stop-Signal-Task in order to create an alcohol-specific version.

We have 40 alcohol and nonalcohol related pictures which are either framed blue or yellow, which makes 80 pictures in total. Depending on the color of the frame the participant has to either press the left key or the right key.
Now we want to present 4 blocks with 80 trials each. Every picture is supposed to be presented 4 times during the whole experiment, once with a stop signal, three times without. My problem is that I can't figure out what to do in order to present every picutre exactly 4 times. Right now it presents those pictures randomly, showing some 3, 4 or 5 times.

Here the concerning parts of my script (list ss_stims contains every picture once; list ns_stims contains every picutre three times):

<expt StopSignalTask1>
/ subjects = (1 of 2)
/ groupassignment = groupnumber
/ onexptbegin = [values.expcondition = 1]
/ onexptbegin = [values.format1 = "gelb"; values.format2 = "blau"]
/ preinstructions = (intro,intro2)
/ postinstructions = (end)
/ blocks = [1=pracblock; 2-5=testblock]
/onexptend = [values.completed = 1]
</expt>


<expt StopSignalTask2>
/ subjects = (2 of 2)
/ groupassignment = groupnumber
/ onexptbegin = [values.expcondition = 2]
/ onexptbegin = [values.format1 = "blau"; values.format2 = "gelb"]
/ preinstructions = (intro,intro2)
/ postinstructions = (end)
/ blocks = [1=pracblock; 2-5=testblock]
/onexptend = [values.completed = 1]
</expt>


<block testblock>
/ onblockbegin = [values.trialnumber=0; values.blocknumber+=1; values.countdown=values.waitbetweenblocks;
values.ns_nnoresp=0; values.ns_rtsum=0; values.ns_nresp=0]
/ trials = [1=start; 2-81=noreplace(nstrial,nstrial,nstrial,sstrial); 82=blocksummary]
/ recorddata = true
</block>


<trial nstrial>
/ ontrialbegin = [values.stimulus=list.ns_stims.nextvalue; values.signal=0; values.trialnumber+=1; values.ssd=0]
/ ontrialend = [if(trial.nstrial.correct==1)values.correct=2 else values.correct=0]
/ ontrialend = [if(trial.nstrial.response==0)values.rt=0 else values.rt=trial.nstrial.latency]
/ ontrialend = [if(trial.nstrial.response!=0){
values.ns_rtsum=values.ns_rtsum+values.rt; values.ns_nresp+=1}]
/ ontrialend = [if(trial.nstrial.response==0)values.ns_nnoresp+=1]
/ ontrialend = [if(expressions.trialnumber!=0)values.raw_rtsum=values.raw_rtsum+values.rt]
/ ontrialend = [if(expressions.trialnumber!=0)values.ns_ntotal+=1]
/ ontrialend = [if(expressions.trialnumber!=0 && trial.nstrial.response==0)values.ns_nmiss+=1]
/ ontrialend = [if(values.correct==2 && expressions.trialnumber!=0){
values.ns_ncorr+=1; values.ns_rtcorrsum=values.ns_rtcorrsum+values.rt}]
/ ontrialend = [if(trial.nstrial.response==values.leftkey)values.response=1]
/ ontrialend = [if(trial.nstrial.response==values.rightkey)values.response=2]
/ ontrialend = [if(trial.nstrial.response==0)values.response=0]
/ stimulustimes = [0=fixation; 250=stim; 1500=erasestim]
/ responsetime = 250
/ pretrialpause = values.pretrialpause
/ posttrialpause = values.posttrialpause
/ trialduration = values.trialduration
/ responseinterrupt = frames
/ isvalidresponse = [trial.nstrial.response==0||trial.nstrial.response==values.leftkey||trial.nstrial.response==values.rightkey]
/ iscorrectresponse = [(values.expcondition == 1 && if(values.stimulus<=40)trial.nstrial.response==values.leftkey else trial.nstrial.response==values.rightkey) ||
(values.expcondition == 2 && if(values.stimulus>40)trial.nstrial.response==values.leftkey else trial.nstrial.response==values.rightkey)]
/ monkeyresponse = (values.leftkey, values.rightkey)
</trial>


<trial sstrial>
/ ontrialbegin = [values.ssd=values.ssd_next]
/ ontrialbegin = [trial.sstrial.insertstimulustime(sound.stopsignal,values.ssd+250)]
/ ontrialbegin = [values.stimulus=list.ss_stims.nextvalue; values.signal=1; values.trialnumber+=1]
/ ontrialend = [if(trial.sstrial.correct==1)values.correct=2 else values.correct=0]
/ ontrialend = [if(trial.sstrial.response==0)values.rt=0 else values.rt=trial.sstrial.latency]
/ ontrialend = [if(values.correct==0 && values.ssd_next>values.minssd)values.ssd_next=values.ssd_next-values.adjustment]
/ ontrialend = [if(values.correct==2 && values.ssd_next<values.maxssd)values.ssd_next=values.ssd_next+values.adjustment]
/ ontrialend = [if(expressions.trialnumber!=0)values.ss_ntotal+=1]
/ ontrialend = [if(values.correct==2 && expressions.trialnumber!=0)values.ss_ncorr+=1]
/ ontrialend = [if(values.correct==0 && expressions.trialnumber!=0)
{values.sr_rtsum=values.sr_rtsum+values.rt; values.sr_ntotal+=1}]
/ ontrialend = [if(expressions.trialnumber!=0)values.ssd_sum=values.ssd_sum+values.ssd]
/ ontrialend = [if(trial.sstrial.response==values.leftkey)values.response=1]
/ ontrialend = [if(trial.sstrial.response==values.rightkey)values.response=2]
/ ontrialend = [if(trial.sstrial.response==0)values.response=0]
/ ontrialend = [trial.sstrial.resetstimulusframes()]
/ stimulustimes = [0=fixation; 250=stim; 1500=erasestim]
/ responsetime = 250
/ pretrialpause = values.pretrialpause
/ posttrialpause = values.posttrialpause
/ trialduration = values.trialduration
/ responseinterrupt = frames
/ isvalidresponse = [trial.sstrial.response==0||trial.sstrial.response==values.leftkey||trial.sstrial.response==values.rightkey]
/ iscorrectresponse = [trial.sstrial.response==0]
/ monkeyresponse = (values.leftkey, values.rightkey)
</trial>


<picture stim>
/ items = stims
/ select = values.stimulus
/ position = (50%,50%)
/ size = (30%,30%)
/ erase = false
</picture>




Thank you for your help!



By Dave - 11/20/2017

kimsobania - Sunday, November 19, 2017
Hello,

I adapted Verbruggen's Stop-Signal-Task in order to create an alcohol-specific version.

We have 40 alcohol and nonalcohol related pictures which are either framed blue or yellow, which makes 80 pictures in total. Depending on the color of the frame the participant has to either press the left key or the right key.
Now we want to present 4 blocks with 80 trials each. Every picture is supposed to be presented 4 times during the whole experiment, once with a stop signal, three times without. My problem is that I can't figure out what to do in order to present every picutre exactly 4 times. Right now it presents those pictures randomly, showing some 3, 4 or 5 times.

Here the concerning parts of my script (list ss_stims contains every picture once; list ns_stims contains every picutre three times):

<expt StopSignalTask1>
/ subjects = (1 of 2)
/ groupassignment = groupnumber
/ onexptbegin = [values.expcondition = 1]
/ onexptbegin = [values.format1 = "gelb"; values.format2 = "blau"]
/ preinstructions = (intro,intro2)
/ postinstructions = (end)
/ blocks = [1=pracblock; 2-5=testblock]
/onexptend = [values.completed = 1]
</expt>


<expt StopSignalTask2>
/ subjects = (2 of 2)
/ groupassignment = groupnumber
/ onexptbegin = [values.expcondition = 2]
/ onexptbegin = [values.format1 = "blau"; values.format2 = "gelb"]
/ preinstructions = (intro,intro2)
/ postinstructions = (end)
/ blocks = [1=pracblock; 2-5=testblock]
/onexptend = [values.completed = 1]
</expt>


<block testblock>
/ onblockbegin = [values.trialnumber=0; values.blocknumber+=1; values.countdown=values.waitbetweenblocks;
values.ns_nnoresp=0; values.ns_rtsum=0; values.ns_nresp=0]
/ trials = [1=start; 2-81=noreplace(nstrial,nstrial,nstrial,sstrial); 82=blocksummary]
/ recorddata = true
</block>


<trial nstrial>
/ ontrialbegin = [values.stimulus=list.ns_stims.nextvalue; values.signal=0; values.trialnumber+=1; values.ssd=0]
/ ontrialend = [if(trial.nstrial.correct==1)values.correct=2 else values.correct=0]
/ ontrialend = [if(trial.nstrial.response==0)values.rt=0 else values.rt=trial.nstrial.latency]
/ ontrialend = [if(trial.nstrial.response!=0){
values.ns_rtsum=values.ns_rtsum+values.rt; values.ns_nresp+=1}]
/ ontrialend = [if(trial.nstrial.response==0)values.ns_nnoresp+=1]
/ ontrialend = [if(expressions.trialnumber!=0)values.raw_rtsum=values.raw_rtsum+values.rt]
/ ontrialend = [if(expressions.trialnumber!=0)values.ns_ntotal+=1]
/ ontrialend = [if(expressions.trialnumber!=0 && trial.nstrial.response==0)values.ns_nmiss+=1]
/ ontrialend = [if(values.correct==2 && expressions.trialnumber!=0){
values.ns_ncorr+=1; values.ns_rtcorrsum=values.ns_rtcorrsum+values.rt}]
/ ontrialend = [if(trial.nstrial.response==values.leftkey)values.response=1]
/ ontrialend = [if(trial.nstrial.response==values.rightkey)values.response=2]
/ ontrialend = [if(trial.nstrial.response==0)values.response=0]
/ stimulustimes = [0=fixation; 250=stim; 1500=erasestim]
/ responsetime = 250
/ pretrialpause = values.pretrialpause
/ posttrialpause = values.posttrialpause
/ trialduration = values.trialduration
/ responseinterrupt = frames
/ isvalidresponse = [trial.nstrial.response==0||trial.nstrial.response==values.leftkey||trial.nstrial.response==values.rightkey]
/ iscorrectresponse = [(values.expcondition == 1 && if(values.stimulus<=40)trial.nstrial.response==values.leftkey else trial.nstrial.response==values.rightkey) ||
(values.expcondition == 2 && if(values.stimulus>40)trial.nstrial.response==values.leftkey else trial.nstrial.response==values.rightkey)]
/ monkeyresponse = (values.leftkey, values.rightkey)
</trial>


<trial sstrial>
/ ontrialbegin = [values.ssd=values.ssd_next]
/ ontrialbegin = [trial.sstrial.insertstimulustime(sound.stopsignal,values.ssd+250)]
/ ontrialbegin = [values.stimulus=list.ss_stims.nextvalue; values.signal=1; values.trialnumber+=1]
/ ontrialend = [if(trial.sstrial.correct==1)values.correct=2 else values.correct=0]
/ ontrialend = [if(trial.sstrial.response==0)values.rt=0 else values.rt=trial.sstrial.latency]
/ ontrialend = [if(values.correct==0 && values.ssd_next>values.minssd)values.ssd_next=values.ssd_next-values.adjustment]
/ ontrialend = [if(values.correct==2 && values.ssd_next<values.maxssd)values.ssd_next=values.ssd_next+values.adjustment]
/ ontrialend = [if(expressions.trialnumber!=0)values.ss_ntotal+=1]
/ ontrialend = [if(values.correct==2 && expressions.trialnumber!=0)values.ss_ncorr+=1]
/ ontrialend = [if(values.correct==0 && expressions.trialnumber!=0)
{values.sr_rtsum=values.sr_rtsum+values.rt; values.sr_ntotal+=1}]
/ ontrialend = [if(expressions.trialnumber!=0)values.ssd_sum=values.ssd_sum+values.ssd]
/ ontrialend = [if(trial.sstrial.response==values.leftkey)values.response=1]
/ ontrialend = [if(trial.sstrial.response==values.rightkey)values.response=2]
/ ontrialend = [if(trial.sstrial.response==0)values.response=0]
/ ontrialend = [trial.sstrial.resetstimulusframes()]
/ stimulustimes = [0=fixation; 250=stim; 1500=erasestim]
/ responsetime = 250
/ pretrialpause = values.pretrialpause
/ posttrialpause = values.posttrialpause
/ trialduration = values.trialduration
/ responseinterrupt = frames
/ isvalidresponse = [trial.sstrial.response==0||trial.sstrial.response==values.leftkey||trial.sstrial.response==values.rightkey]
/ iscorrectresponse = [trial.sstrial.response==0]
/ monkeyresponse = (values.leftkey, values.rightkey)
</trial>


<picture stim>
/ items = stims
/ select = values.stimulus
/ position = (50%,50%)
/ size = (30%,30%)
/ erase = false
</picture>




Thank you for your help!




You need to double-check how your picture items are selected, i.e. how

<picture stim>
/ items = stims
/ select = values.stimulus
/ position = (50%,50%)
/ size = (30%,30%)
/ erase = false
</picture>

values.stimulus is determined. Check the respective <list> elements, <list ns_stims>, which determines selection for "no signal" trials

<trial nstrial>
/ ontrialbegin = [values.stimulus=list.ns_stims.nextvalue;
...
<trial>

and <list ss_stims>, which determines stimulus selection in "stop signal trials".

<trial sstrial>
...
/ ontrialbegin = [values.stimulus=list.ss_stims.nextvalue;
...
</trial>

Keep in mind that the blocks do not run an equal amount of "no signal" and "stop signal" trials: In each block, there will be 60 "no signal" trials and only 20 "stop signal" trials.
By kimsobania - 11/20/2017

My stimulus is defined as:
<values>
...
/ stimulus = 0
... 
</values>



my <list> elements simply contain an enumeration of my items:

<list ss_stims> 
/ items = (1,2,3, [...], 80)
</list>

and

<list ns_stims> 
/items = (1, 1, 1, 2, 2, 2, 3, 3, 3, [...], 80, 80, 80)
</list> 

Do I have to add a selectionmode? 



By Dave - 11/21/2017

kimsobania - Tuesday, November 21, 2017
My stimulus is defined as:
<values>
...
/ stimulus = 0
... 
</values>



my <list> elements simply contain an enumeration of my items:

<list ss_stims> 
/ items = (1,2,3, [...], 80)
</list>

and

<list ns_stims> 
/items = (1, 1, 1, 2, 2, 2, 3, 3, 3, [...], 80, 80, 80)
</list> 

Do I have to add a selectionmode? 




That looks correct.

> Do I have to add a selectionmode?

No. A <list>'s default behavior is random selection without replacement.

What you are probably disregarding is the selections performed during the _practice_ <block>. What you'll want to do is reset both <list ss_stims> and <list ns_stims> at the end of <block practice>, i.e.

<block pracblock>
/ onblockbegin = [values.trialnumber=0; values.blocknumber="PRACTICE"; values.countdown=values.waitbetweenblocks]
/ onblockend = [values.blocknumber=0; values.ssd=0; values.ssd_sum=0; values.ns_rtcorrsum=0; values.sr_rtsum=0;
    values.sr_ntotal=0; values.ns_nmiss=0; values.ns_ncorr=0; values.ns_ntotal=0; values.ss_ncorr=0; values.ss_ntotal=0;
    values.raw_rtsum=0; values.ns_nnoresp=0; values.ns_rtsum=0; values.ns_nresp=0]
/ onblockend = [
    list.ss_stims.reset():
    list.ns_stims.reset();
]

/ onblockend = [if(values.resetpracticessd==true)values.ssd_next=values.ssd_start]
/ trials = [1=start; 2-33=noreplace(nstrial,nstrial,nstrial,sstrial); 34=blocksummary]
/ recorddata = false
</block>
By kimsobania - 11/22/2017

If I add this into the pracblock it still doesn't seem to work, the number of times each picture is presented still varies between 3 and 6.

The solution I found is, that I created separate lists for the pracblock and added /replace = false into the testblock lists, so far this works quite well. 

Thank you for your help!