Millisecond Forums

Proportion congruent vs. incongruent trials

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

By Zooahh - 10/17/2014

Hi,

I am not an expert at all in programming and I am trying to set up a number stroop task where I want a 50/50 % repartition of congruent vs.incongruent trials. There are 72 trials in total.
Here is part of the script I set up:

<counter congruentstimtype>
/ items = (1,1,1,1,1,1,1,1,1,1,1,1,5,5,5,5,5,5,5,5,5,5,5,5,9,9,9,9,9,9,9,9,9,9,9,9)
/ select = noreplace
/ selectionrate = trial
</counter>

<counter congruentcresp>
/ items = (48,48,48,48,48,48,48,48,48,48,48,48,49,49,49,49,49,49,49,49,49,49,49,49,50,50,50,50,50,50,50,50,50,50,50,50)
/ select = current(congruentstimtype)
</counter>

<counter incongruentstimtype>
/ items = (2,2,2,2,2,2,3,3,3,3,3,3,4,4,4,4,4,4,6,6,6,6,6,6,7,7,7,7,7,7,8,8,8,8,8,8)
/ select = noreplace
/ selectionrate = trial
</counter>

<counter incongruentcresp>
/ items = (48,49,50)
/ select = current(incongruentstimtype)
</counter>

With this I keep getting a 1/3 congruent trials vs. 2/3 congruent trials and I can't figure out why...
Could someone help me please? thanks!
By Dave - 10/17/2014

#1: What does your <block>'s /trials attribute look like? The <counter> elements aren't necessarily relevant (they concern stimulus selection, not trial selection).

Note that

/ trials = [1-72=noreplace(a,b)]

would give you 36 a-trials and 36 b-trials in random order. However,

/ trials = [1-72=noreplace(a,a,b)]

would give you 48 a-trials and 24 b-trials in random order.

#2: Separate issue, but

<counter incongruentstimtype>
/ items = (2,2,2,2,2,2,3,3,3,3,3,3,4,4,4,4,4,4,6,6,6,6,6,6,7,7,7,7,7,7,8,8,8,8,8,8)
/ select = noreplace
/ selectionrate = trial
</counter>

<counter incongruentcresp>
/ items = (48,49,50)
/ select = current(incongruentstimtype)
</counter>

is misspecified with only 3 items. It needs to contain as many as <counter incongruentstimtype>.
By Zooahh - 10/19/2014

Thank you very much!
I still can't figure out what the problem is, so here is the rest of the script:

<block practiceblock>
/ trials = [1-8=noreplace(congruenttrial,incongruenttrial)]
/ errormessage = (errormessage, 400)
/ correctmessage = (correctmessage, 400)
</block>

<block testblock>
/ preinstructions = (test)
/ trials = [1-72=noreplace(congruenttrial,incongruenttrial)]
</block>

<trial congruenttrial>
/ ontrialbegin = [if(script.currentblock=="practiceblock")
{
values.stimtype=counter.pcongruentstimtype.selectedvalue;
values.cresp=counter.pcongruentcresp.selectedvalue;
}
else
{
values.stimtype=counter.congruentstimtype.selectedvalue;
values.cresp=counter.congruentcresp.selectedvalue;
}]
/ posttrialpause = 500
/ stimulustimes = [0=fixation; 800=blank; 1050=stimi]
/ trialduration = 2600
/ validresponse = (48,49,50)
/ iscorrectresponse = [trial.congruenttrial.response==values.cresp]
</trial>

<trial incongruenttrial>
/ ontrialbegin = [if(script.currentblock=="practiceblock")
{
values.stimtype=counter.pincongruentstimtype.selectedvalue;
values.cresp=counter.pincongruentcresp.selectedvalue;
}
else
{
values.stimtype=counter.incongruentstimtype.selectedvalue;
values.cresp=counter.incongruentcresp.selectedvalue;
}]
/ posttrialpause = 500
/ stimulustimes = [0=fixation; 800=blank; 1050=stimi]
/ trialduration = 2600
/ validresponse = (48,49,50)
/ iscorrectresponse = [trial.incongruenttrial.response==values.cresp]
</trial>






By Dave - 10/19/2014

/ trials = [1-72=noreplace(congruenttrial,incongruenttrial)]

will given 36 x congruenttrial and 36 x incongruenttrial in the test block. I'm sure, if you examine the data file, that's exactly what you will find.
By jgranadossamayoa - 8/14/2015

I am trying to run the voice-recognition version of the Stroop task with a 50/50 split of congruent and incongruent stimuli. I made changes to reflect what I need, but when I run it now I get the following message:

Speech Error 80045049: Speech Error.
Line 219, File .\SpeechEngine.cpp

I read another post on this forum suggesting this issue may have something to do with unpronounceable characters, etc., but as far as I know, I did not change any of the input to the voice-recognition system.

I will copy what I consider to be relevant parts of the code below:

<response voice>
/mode=free
/timeoutduration = 2000
</response>

<expt>
/preinstructions=(stroop_ins_practice)
/blocks = [1=stroop_practice; 2=start_instructions; 3=stroop; 4=break; 5=stroop]
/postinstructions = (end)
</expt>

<block stroop>
/trials=[1=ready; 2-51=noreplace(red_congruent,yellow_congruent,green_congruent,blue_congruent,black_congruent,red_incongruent,yellow_incongruent,green_incongruent,blue_incongruent,black_incongruent)]
</block>

<block stroop_practice>
/trials=[1=ready; 2-11=noreplace(red_congruent,yellow_congruent,green_congruent,blue_congruent,black_congruent,red_incongruent,yellow_incongruent,green_incongruent,blue_incongruent,black_incongruent)]
</block>

<block break>
/ trials = [1=break]
</block>

<block start_instructions>
/trials=[1=start_instructions]
</block>

<trial yellow_congruent>
/stimulustimes = [0=yellow_congruent]
/pretrialpause = 250
/validresponse = ("yellow" "green" "blue" "black" "red")
/correctresponse = ("yellow")
/ errormessage = (errormessage, 300)
/branch = [if (latency > 1000) trial.RT_feedback]
</trial>

<trial yellow_incongruent>
/stimulustimes = [0=random(yellow_incongruent_red,yellow_incongruent_blue,yellow_incongruent_green,yellow_incongruent_black)]
/pretrialpause = 250
/validresponse = ("yellow" "green" "blue" "black" "red")
/correctresponse = ("yellow")
/ errormessage = (errormessage, 300)
/branch = [if (latency > 1000) trial.RT_feedback]
</trial>

<trial red_congruent>
/stimulustimes = [0=red_congruent]
/pretrialpause = 250
/validresponse = ("red" "green" "blue" "black" "red")
/correctresponse = ("red")
/ errormessage = (errormessage, 300)
/branch = [if (latency > 1000) trial.RT_feedback]
</trial>

<trial red_incongruent>
/stimulustimes = [0=random(red_incongruent_blue,red_incongruent_green,red_incongruent_black,red_incongruent_yellow)]
/pretrialpause = 250
/validresponse = ("red" "green" "blue" "black" "red")
/correctresponse = ("red")
/ errormessage = (errormessage, 300)
/branch = [if (latency > 1000) trial.RT_feedback]
</trial>

<trial blue_congruent>
/stimulustimes = [0=blue_congruent]
/pretrialpause = 250
/validresponse = ("yellow" "green" "blue" "black" "red")
/correctresponse = ("blue")
/ errormessage = (errormessage, 300)
/branch = [if (latency > 1000) trial.RT_feedback]
</trial>

<trial blue_incongruent>
/stimulustimes = [0=random(blue_incongruent_yellow,blue_incongruent_green,blue_incongruent_red,blue_incongruent_black)]
/pretrialpause = 250
/validresponse = ("yellow" "green" "blue" "black" "red")
/correctresponse = ("blue")
/ errormessage = (errormessage, 300)
/branch = [if (latency > 1000) trial.RT_feedback]
</trial>

<trial black_congruent>
/stimulustimes = [0=black_congruent]
/pretrialpause = 250
/validresponse = ("yellow" "green" "blue" "black" "red")
/correctresponse = ("black")
/ errormessage = (errormessage, 300)
/branch = [if (latency > 1000) trial.RT_feedback]
</trial>

<trial black_incongruent>
/stimulustimes = [0=random(black_incongruent_red,black_incongruent_blue,black_incongruent_yellow,black_incongruent_green)]
/pretrialpause = 250
/validresponse = ("yellow" "green" "blue" "black" "red")
/correctresponse = ("black")
/ errormessage = (errormessage, 300)
/branch = [if (latency > 1000) trial.RT_feedback]
</trial>

<trial green_congruent>
/stimulustimes = [0=green_congruent]
/pretrialpause = 250
/validresponse = ("yellow" "green" "blue" "black" "red")
/correctresponse = ("green")
/ errormessage = (errormessage, 300)
/branch = [if (latency > 1000) trial.RT_feedback]
</trial>

<trial green_incongruent>
/stimulustimes = [0=random(green_incongruent_red,green_incongruent_blue,green_incongruent_yellow,green_incongruent_black)]
/pretrialpause = 250
/validresponse = ("yellow" "green" "blue" "black" "red")
/correctresponse = ("green")
/ errormessage = (errormessage, 300)
/branch = [if (latency > 1000) trial.RT_feedback]
</trial>

<trial ready>
/stimulustimes = [0=ready]
/correctresponse = (" ")
/inputdevice = keyboard
</trial>

<trial RT_feedback>
/ stimulusframes = [1 = faster]
/ timeout = 1000
</trial>

<trial break>
/stimulusframes=[1=break_instructions]
/timeout = 30000
</trial>

<trial start_instructions>
/stimulusframes=[1=start_instructions]
/validresponse = (" ")
</trial>


*******************
 Thanks.
By jgranadossamayoa - 8/14/2015

I forgot to mention that I'm using Inquisit 3, but I thought this thread was most relevant.
By Dave - 8/14/2015

The code is incomplete and there are number of issues with it (various syntax mistakes, etc.) -- they are perhaps unrelated to the SAPI issue, perhaps not.

Please don't paste large portions of code into the message body. Instead provide the actual script by *attaching* the file to your post. You do so by clicking +Insert -> Add File in the message editor.

Also, before you do that, please check whether the *original / unmodified* Stroop script you based this one works on your system or not. Include the result in your message. Thanks.
By jgranadossamayoa - 8/14/2015

I checked and the original file runs fine. Script is attached.
By Dave - 8/14/2015

Thanks for attaching the script. Here's the problem:

You define 'voice' as default /inputdevice for <trial>s in your <defaults> element:

<defaults>
/font = ("Courier New", -43, 700, 0, 49)
/inputdevice=voice
/screencolor=(255, 255, 255)
</defaults>

I.e., any <trial> element that does *not* have a different /inputdevice defined *explicitly* will assume /inputdevice=voice. Now, for example

<trial start_instructions>
/stimulusframes=[1=start_instructions]
/validresponse = (" ")
</trial>

has a space defined as /validresponse, but *no* suitable /inputdevice. It will assume you want /inputdevice=voice as per the <defaults>. However, " " is not pronounceable and thus you get the error message. Set

<trial start_instructions>
/stimulusframes=[1=start_instructions]
/validresponse = (" ")
/inputdevice=keyboard
</trial>

and it'll go away.
By jgranadossamayoa - 8/14/2015

Excellent. Thank you.