using /not and /select=replacenot() to choose items conditionally to items of other counters


using /not and /select=replacenot() to choose items conditionally to...
Author
Message
luis
luis
Expert (1.1K reputation)Expert (1.1K reputation)Expert (1.1K reputation)Expert (1.1K reputation)Expert (1.1K reputation)Expert (1.1K reputation)Expert (1.1K reputation)Expert (1.1K reputation)Expert (1.1K reputation)
Group: Forum Members
Posts: 7, Visits: 38
Hi,
I would appreciate your help. I'm trying something apparently quite simple: to program a series of Stroop trials without feature repetitions (and without extensive preparation of the sequences beforehand). That program should be easy to achieve with the aid of the /not() and /select= replacenot() atributes from the counter element. However, I'm afraid that I'm not being able to make it work. As an example, if I use the following code to program the incongruent trials, thus forcing the selection of the word-item to be different from that used for the inkcolor, sometimes I found that the selected word coincides with the selected inkcolor. What am I doing wrong?
Thanks
Luis.

<counter inkcolor>
/ select = replacenorepeat
/ items = ("rojo","verde","azul","negro")
/ selectionrate = trial
</counter>

<text wordINC>
/select = replacenot(inkcolor)
/ items = ("rojo","verde","azul","negro")
/ txcolor =(expressions.codR;expressions.codv;expressions.coda)
/ fontstyle = ("Arial", 44pt, true)
</text>

Dave
Dave
Supreme Being (855K reputation)Supreme Being (855K reputation)Supreme Being (855K reputation)Supreme Being (855K reputation)Supreme Being (855K reputation)Supreme Being (855K reputation)Supreme Being (855K reputation)Supreme Being (855K reputation)Supreme Being (855K reputation)
Group: Administrators
Posts: 10K, Visits: 59K
That code excerpt is too incomplete to say anything meaningful. For example, it is entirely unclear what

<text wordINC>
/select = replacenot(inkcolor)
/ items = ("rojo","verde","azul","negro")
/ txcolor =(expressions.codR;expressions.codv;expressions.coda)
/ fontstyle = ("Arial", 44pt, true)
</text>

what those expressions do (they are not included), and the syntax in the /txcolor attribute may actually be invalid. Moreover, the code snippet does not make clear at all *when* any selection for <counter inkcolor> actually happens -- if any happens at all. The latter -- that selection happens not when you think it does -- may very well be the cause for the color (mis-)matches. To be clear: For this to work, in any given trial the selection of an item from the <counter> element *must* precede the selection of an item from the <text> element. If this is not the case, i.e., if selection from the <counter> happens *after* selection from the <text> element in the trial, this setup will necessarily fail at times.

Please provide a more complete example, i.e., something that can actually be run.

Edited 4 Years Ago by Dave
luis
luis
Expert (1.1K reputation)Expert (1.1K reputation)Expert (1.1K reputation)Expert (1.1K reputation)Expert (1.1K reputation)Expert (1.1K reputation)Expert (1.1K reputation)Expert (1.1K reputation)Expert (1.1K reputation)
Group: Forum Members
Posts: 7, Visits: 38
Hi Dave,

a sample of the code follows...
So you say that the problem has to do with the moment at which the inkcolor happens within a trial...
I'm using counter.inkcolor to select the color RGB codes. I don't know if this happens before the text is selected....

Thanks
Luis
-------------------------

<values>
/codRCON=0
/codVCON=0
/codACON=0
</values>

<expressions>
/codR= if ( counter.inkcolor.selectedvalue=="rojo") 255 else 0
/codV= if ( counter.inkcolor.selectedvalue=="verde") 255 else 0
/codA= if ( counter.inkcolor.selectedvalue=="azul") 255 else 0
</expressions>

<counter inkcolor>
/ select = replacenorepeat
/ items = ("rojo","verde","azul","negro")
/ selectionrate = trial
</counter> 

<counter respuesta>
/ items= (44,45,49,50)
/select = current(inkcolor)
/ selectionrate = trial
</counter> 

<text wordINC>
/ txcolor =(expressions.codR;expressions.codv;expressions.coda)
/select = replacenot(inkcolor)
/ items = ("rojo","verde","azul","negro")
/ fontstyle = ("Arial", 44pt, true)
</text>

<trial trialINC>
/ ontrialbegin = [expressions.codr;expressions.codv;expressions.coda]
/ stimulusframes = [1=wordINC]
/ validresponse =(44,45,49,50)
/ iscorrectresponse = [trial.trialINC.response==counter.respuesta.selectedvalue]
</trial> 

<block myblock>
/ trials=[1-30=replace(trialINC)]
</block>

<expt>
/ blocks=[1=myblock]
</expt> 

<data>/ columns=[subject, blockcode, trialcode, trialnum, latency, response, correct, stimulusitem, counter.inkcolor]</data>

Dave
Dave
Supreme Being (855K reputation)Supreme Being (855K reputation)Supreme Being (855K reputation)Supreme Being (855K reputation)Supreme Being (855K reputation)Supreme Being (855K reputation)Supreme Being (855K reputation)Supreme Being (855K reputation)Supreme Being (855K reputation)
Group: Administrators
Posts: 10K, Visits: 59K
Thanks for the script, that's very helpful. Selection happens at the right point in time, so that's not the problem. The issue, I think, comes down to there not being a clear separation between an item and item's index for <counter> elements. Working with item numbers directly and using an additional <counter> for item selection in the <text> element should avoid any such problems:

<values>
/codRCON=0
/codVCON=0
/codACON=0
/ inkcolor = 0
</values>

<expressions>
/codR= if ( counter.inkcolor.selectedvalue == 1) 255 else 0
/codV= if ( counter.inkcolor.selectedvalue  == 2) 255 else 0
/codA= if ( counter.inkcolor.selectedvalue == 3) 255 else 0
</expressions>

<counter inkcolor>
/ items = (1,2,3,4)
/ select = replacenorepeat
/ selectionrate = trial
</counter>

<counter respuesta>
/ items= (44,45,49,50)
/ select = current(inkcolor)
/ selectionrate = trial
</counter>

<counter colorwordINC>
/ items = (1,2,3,4)
/ select = replace
/ not = (inkcolor)
</counter>


<text wordINC>
/ txcolor =(expressions.codr;expressions.codv;expressions.coda)
/ select = colorwordINC
/ items = ("rojo","verde","azul","negro")
/ fontstyle = ("Arial", 44pt, true)
</text>

<trial trialINC>
/ ontrialbegin = [expressions.codr; expressions.codv; expressions.coda]
/ ontrialbegin = [values.inkcolor = getitem(text.wordINC, counter.inkcolor.selectedvalue); ]
/ stimulusframes = [1=wordINC]
/ validresponse =(44,45,49,50)
/ iscorrectresponse = [trial.trialINC.response==counter.respuesta.selectedvalue]
</trial>

<block myblock>
/ trials=[1-30=replace(trialINC)]
</block>

<expt>
/ blocks=[1=myblock]
</expt>

<data>
/ columns=[subject, blockcode, trialcode, trialnum, latency, response, correct, stimulusitem, values.inkcolor, stimulusnumber, counter.inkcolor, expressions.codr, expressions.coda, expressions.codv]
/ separatefiles = true
</data>

luis
luis
Expert (1.1K reputation)Expert (1.1K reputation)Expert (1.1K reputation)Expert (1.1K reputation)Expert (1.1K reputation)Expert (1.1K reputation)Expert (1.1K reputation)Expert (1.1K reputation)Expert (1.1K reputation)
Group: Forum Members
Posts: 7, Visits: 38
Thank you, Dave. Now it works perfect... (Tricky thing these <counter> elements).

Luis
luis
luis
Expert (1.1K reputation)Expert (1.1K reputation)Expert (1.1K reputation)Expert (1.1K reputation)Expert (1.1K reputation)Expert (1.1K reputation)Expert (1.1K reputation)Expert (1.1K reputation)Expert (1.1K reputation)
Group: Forum Members
Posts: 7, Visits: 38
But... (If I may abuse of your time)

The next step in my project is even more tricky, and I think it shows a limit of the joint use of /select and /not:

If you want to avoid repetitions of *any* of the features of the previous trial (i.e., neither the text nor the ink can be repeated), I guess that one way to go is to build a dummy stimulus made up of two counters which instantiate the features of the previous trial. Then, adding the values of these "previous" counters to the /not=() instruction, you should get a selection that does not repeat features. However, it doesn't  work: as soon as you put these conditions, the "replacenorepeat" stops working, and the program gets errors (even though, with four possible elements, there is always a logical alternative)...

Here I am appending the script, hoping again that I am missing some obvious detail:

Thanks again
Luis
.............

<values>
/codRCON=0
/codVCON=0
/codACON=0
/ inkcolor = 0
/ inkprevio = 0
/ colorprevio = 0
</values>

<expressions>
/codR= if ( counter.inkcolor.selectedvalue == 1) 255 else 0
/codV= if ( counter.inkcolor.selectedvalue == 2) 255 else 0
/codA= if ( counter.inkcolor.selectedvalue == 3) 255 else 0

/codRprevio= if ( counter.inkprevio.selectedvalue == 1) 255 else 0
/codVprevio= if ( counter.inkprevio.selectedvalue == 2) 255 else 0
/codAprevio= if ( counter.inkprevio.selectedvalue == 3) 255 else 0
</expressions>

<counter inkcolor>
/ items = (1,2,3,4)
/ select = replacenorepeat
/ selectionrate = trial
/ not = (colorprevio)

</counter>

<counter respuesta>
/ items= (44,45,49,50)
/ select = current(inkcolor)
/ selectionrate = trial
</counter>




<counter colorwordINC>
/ items = (1,2,3,4)
/ select = replacenorepeat
/ not = (inkcolor)
/ not=(inkprevio)
/ not=(colorprevio)
</counter>


<counter colorprevio>
/ items = (1,2,3,4)
/ select = values.colorprevio
</counter>

<counter inkprevio>
/ items = (1,2,3,4)
/ select = values.inkprevio
</counter>

<text wordINC>
/ txcolor =(expressions.codr;expressions.codv;expressions.coda)
/ select = colorwordINC
/ items = ("rojo","verde","azul","negro")
/ fontstyle = ("Arial", 44pt, true)
</text>

<text dummprevio>
/ txcolor =(expressions.codrprevio;expressions.codvprevio;expressions.codaprevio)
/ hposition = 10
/vposition = 10
/ select = colorprevio
/ items = ("rojo","verde","azul","negro")
/ fontstyle = ("Arial", 44pt, true)
</text>


<trial trialINC>
/ ontrialbegin = [expressions.codr; expressions.codv; expressions.coda;expressions.codrprevio; expressions.codvprevio; expressions.codaprevio]
/ ontrialbegin = [values.inkcolor = getitem(text.wordINC, counter.inkcolor.selectedvalue); ]
/ stimulusframes = [1=wordINC,dummprevio]
/ validresponse =(44,45,49,50)
/ iscorrectresponse = [trial.trialINC.response==counter.respuesta.selectedvalue]
/ ontrialend = [values.inkprevio = counter.inkcolor.currentitemnumber; ]
/ ontrialend = [values.colorprevio = counter.colorwordINC.currentitemnumber; ]

</trial>

<block myblock>
/ trials=[1-30=sequence(trialINC)]
</block>

<expt>
/ blocks=[1=myblock]
</expt>

<data>
/ columns=[subject, blockcode, trialcode, trialnum, latency, response, correct, stimulusitem, values.inkcolor, stimulusnumber, values.inkprevio, values.colorprevio, expressions.codr, expressions.coda, expressions.codv]
/ separatefiles = true
</data>





Dave
Dave
Supreme Being (855K reputation)Supreme Being (855K reputation)Supreme Being (855K reputation)Supreme Being (855K reputation)Supreme Being (855K reputation)Supreme Being (855K reputation)Supreme Being (855K reputation)Supreme Being (855K reputation)Supreme Being (855K reputation)
Group: Administrators
Posts: 10K, Visits: 59K
It should be possible to store the previous wordcolor in a variable (<values> entry) and then have the current trial select a different one in case of an initial match using an expression. Something along the lines of:

<values>
/codRCON=0
/codVCON=0
/codACON=0
/ inkcolor = 0
/ previouswordcolor = ""
/ wordcolor = 0
</values>

<expressions>
/codR= if ( counter.inkcolor.selectedvalue == 1) 255 else 0
/codV= if ( counter.inkcolor.selectedvalue  == 2) 255 else 0
/codA= if ( counter.inkcolor.selectedvalue == 3) 255 else 0
/ selectwordcolor = if (values.wordcolor == values.previouswordcolor) {values.wordcolor = counter.colorwordINC.selectedvalue; expressions.selectwordcolor}
</expressions>

<counter inkcolor>
/ items = (1,2,3,4)
/ select = replacenorepeat
/ selectionrate = trial
</counter>

<counter respuesta>
/ items= (44,45,49,50)
/ select = current(inkcolor)
/ selectionrate = trial
</counter>

<counter colorwordINC>
/ items = (1,2,3,4)
/ select = replace
/ not = (inkcolor)
/ selectionrate = always
</counter>

<text wordINC>
/ txcolor =(expressions.codr;expressions.codv;expressions.coda)
/ select = values.wordcolor
/ items = ("rojo","verde","azul","negro")
/ fontstyle = ("Arial", 44pt, true)
</text>

<trial trialINC>
/ ontrialbegin = [expressions.codr; expressions.codv; expressions.coda]
/ ontrialbegin = [values.inkcolor = getitem(text.wordINC, counter.inkcolor.selectedvalue); ]
/ ontrialbegin = [values.wordcolor = counter.colorwordINC.selectedvalue; expressions.selectwordcolor]
/ ontrialend = [values.previouswordcolor = text.wordINC.currentitemnumber]
/ stimulusframes = [1=wordINC]
/ validresponse =(44,45,49,50)
/ iscorrectresponse = [trial.trialINC.response==counter.respuesta.selectedvalue]
</trial>

<block myblock>
/ trials=[1-30=replace(trialINC)]
</block>

<expt>
/ blocks=[1=myblock]
</expt>

<data>
/ columns=[subject, blockcode, trialcode, trialnum, latency, response, correct, stimulusitem, values.inkcolor, values.previouswordcolor, stimulusnumber, counter.inkcolor, expressions.codr, expressions.coda, expressions.codv]
/ separatefiles = true
</data>

luis
luis
Expert (1.1K reputation)Expert (1.1K reputation)Expert (1.1K reputation)Expert (1.1K reputation)Expert (1.1K reputation)Expert (1.1K reputation)Expert (1.1K reputation)Expert (1.1K reputation)Expert (1.1K reputation)
Group: Forum Members
Posts: 7, Visits: 38
Hi again ,
Yes, that's a lot easier. And it works!
I had to change some parts of the script to make sure that the color codes were updated at the right time in the trial, after the final decision about the ink and the word were taken, but with that fixed, the script now works fine, and it saves me a lot of time.

Thank you,
Luis. 
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Reading This Topic

Explore
Messages
Mentions
Search