Counterbalancing 3 stimuli between blocks and participants


Author
Message
Athanasia
Athanasia
Associate Member (223 reputation)Associate Member (223 reputation)Associate Member (223 reputation)Associate Member (223 reputation)Associate Member (223 reputation)Associate Member (223 reputation)Associate Member (223 reputation)Associate Member (223 reputation)Associate Member (223 reputation)
Group: Forum Members
Posts: 19, Visits: 58
I have three odors that will be presented at the beginning of each of the three blocks of my experiment (one in the beginning of each block). They are marked as serial ports (port.fearodor, port.disgustodor and port.neutralodor) and I need them not to be erased till the end of the block.
I also need to counterbalance the presentation of these three odors between the blocks in all different combinations, so 6 different sequences between the participants.
I thought to assign different group ID (1 to 6) to each participant in the beginning of the experiment and then create 6 different lists with each one of these sequences of the presented odors.
However, I have trouble to make it work properly and I’m not sure this is the right way. This is what I have done so far:

<port fearodor>
/ items = ("00000001")
</ port >

<port disgustodor>
/ items = ("00000010")
</ port >

<port neutralodor>
/ items = ("00000100")
</ port >
….
<list odortports1>
/ items = (port.fearodor, port.disgustodor, port.neutralodor)
/ selectionrate = always
</list>

<list odortports 2>
/ items = (port.disgustodor, port.neutralodor, port.fearodor)
/ selectionrate = always
</list>

<list odortports 3>
/ items = (port.neutralodor, port.fearodor, port.disgustodor)
/ selectionrate = always
</list>

<list odortports 4>
/ items = (port.fearodor, port.neutralodor, port.disgustodor)
/ selectionrate = always
</list>

<list odortports5>
/ items = (port.disgustodor, port.fearodor, port.neutralodor)
/ selectionrate = always
</list>

<list odortports6>
/ items = (port.neutralodor,port.disgustodor,port.fearodor)
/ selectionrate = always
</list>

<trial odor>
/ ontrialbegin = [
    if (mod(script.groupid, 6)==1) trial.odor.insertstimulustime(list.odorports1.nextvalue, 0)
    else if (mod(script.groupid, 6)==2) trial.odor.insertstimulustime(list. odorports2.nextvalue, 0)
    else if (mod(script.groupid, 6)==3) trial.odor.insertstimulustime(list. odorports3.nextvalue, 0)
    else if (mod(script.groupid, 6)==4) trial.odor.insertstimulustime(list. odorports4.nextvalue, 0)
    else if (mod(script.groupid, 6)==5) trial.odor.insertstimulustime(list. odorports5.nextvalue, 0)
    else if (mod(script.groupid, 6)==6) trial.odor.insertstimulustime(list. odorports6.nextvalue, 0)
]
/ stimulustimes = [0=empty]
/ trialduration = 10 ## the minimum
</trial>

<block MorphTask>
/ trials = [1= odor; 2=…]
</block>

<expt complete>
/blocks = […; 3-5 = MorphTask; 6 =…]

</expt>

Could you please help?

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
Athanasia - 11/30/2021
I have three odors that will be presented at the beginning of each of the three blocks of my experiment (one in the beginning of each block). They are marked as serial ports (port.fearodor, port.disgustodor and port.neutralodor) and I need them not to be erased till the end of the block.
I also need to counterbalance the presentation of these three odors between the blocks in all different combinations, so 6 different sequences between the participants.
I thought to assign different group ID (1 to 6) to each participant in the beginning of the experiment and then create 6 different lists with each one of these sequences of the presented odors.
However, I have trouble to make it work properly and I’m not sure this is the right way. This is what I have done so far:

<port fearodor>
/ items = ("00000001")
</ port >

<port disgustodor>
/ items = ("00000010")
</ port >

<port neutralodor>
/ items = ("00000100")
</ port >
….
<list odortports1>
/ items = (port.fearodor, port.disgustodor, port.neutralodor)
/ selectionrate = always
</list>

<list odortports 2>
/ items = (port.disgustodor, port.neutralodor, port.fearodor)
/ selectionrate = always
</list>

<list odortports 3>
/ items = (port.neutralodor, port.fearodor, port.disgustodor)
/ selectionrate = always
</list>

<list odortports 4>
/ items = (port.fearodor, port.neutralodor, port.disgustodor)
/ selectionrate = always
</list>

<list odortports5>
/ items = (port.disgustodor, port.fearodor, port.neutralodor)
/ selectionrate = always
</list>

<list odortports6>
/ items = (port.neutralodor,port.disgustodor,port.fearodor)
/ selectionrate = always
</list>

<trial odor>
/ ontrialbegin = [
    if (mod(script.groupid, 6)==1) trial.odor.insertstimulustime(list.odorports1.nextvalue, 0)
    else if (mod(script.groupid, 6)==2) trial.odor.insertstimulustime(list. odorports2.nextvalue, 0)
    else if (mod(script.groupid, 6)==3) trial.odor.insertstimulustime(list. odorports3.nextvalue, 0)
    else if (mod(script.groupid, 6)==4) trial.odor.insertstimulustime(list. odorports4.nextvalue, 0)
    else if (mod(script.groupid, 6)==5) trial.odor.insertstimulustime(list. odorports5.nextvalue, 0)
    else if (mod(script.groupid, 6)==6) trial.odor.insertstimulustime(list. odorports6.nextvalue, 0)
]
/ stimulustimes = [0=empty]
/ trialduration = 10 ## the minimum
</trial>

<block MorphTask>
/ trials = [1= odor; 2=…]
</block>

<expt complete>
/blocks = […; 3-5 = MorphTask; 6 =…]

</expt>

Could you please help?

What, specifically, are you having trouble making work? That's not clear at all from your description

Athanasia
Athanasia
Associate Member (223 reputation)Associate Member (223 reputation)Associate Member (223 reputation)Associate Member (223 reputation)Associate Member (223 reputation)Associate Member (223 reputation)Associate Member (223 reputation)Associate Member (223 reputation)Associate Member (223 reputation)
Group: Forum Members
Posts: 19, Visits: 58

Sorry for being unclear. The odors are not appearing in the right order, according to the desired lists and depending on the group ID, but it seems that they appear randomly. Always different between blocks, so never the same, but not in the right sequence. 
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
Athanasia - 11/30/2021

Sorry for being unclear. The odors are not appearing in the right order, according to the desired lists and depending on the group ID, but it seems that they appear randomly. Always different between blocks, so never the same, but not in the right sequence. 

Yeah, that's because lists sample randomly without replacement by default, i.e. unless you specify otherwise. If you want sequential selection, you need to say so per

<list odortports1>
/ items = (port.fearodor, port.disgustodor, port.neutralodor)
/ selectionrate = always
/ selectionmode = sequence
</list>

etc.

https://www.millisecond.com/support/docs/v6/html/language/attributes/selectionmode.htm
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
Dave - 11/30/2021
Athanasia - 11/30/2021

Sorry for being unclear. The odors are not appearing in the right order, according to the desired lists and depending on the group ID, but it seems that they appear randomly. Always different between blocks, so never the same, but not in the right sequence. 

Yeah, that's because lists sample randomly without replacement by default, i.e. unless you specify otherwise. If you want sequential selection, you need to say so per

<list odortports1>
/ items = (port.fearodor, port.disgustodor, port.neutralodor)
/ selectionrate = always
/ selectionmode = sequence
</list>

etc.

https://www.millisecond.com/support/docs/v6/html/language/attributes/selectionmode.htm

Also,

else if (mod(script.groupid, 6)==6) trial.odor.insertstimulustime(list. odorports6.nextvalue, 0)

is wrong. It's

else if (mod(script.groupid, 6)==0) trial.odor.insertstimulustime(list. odorports6.nextvalue, 0)

Athanasia
Athanasia
Associate Member (223 reputation)Associate Member (223 reputation)Associate Member (223 reputation)Associate Member (223 reputation)Associate Member (223 reputation)Associate Member (223 reputation)Associate Member (223 reputation)Associate Member (223 reputation)Associate Member (223 reputation)
Group: Forum Members
Posts: 19, Visits: 58

thank you so much, I was trying to figure out why groupid 6 did not work, while the rest did.
It works perfectly now!! Many thanks again for everything.

One last thing: I want the ports to stay open after the end of the trial, till the end of the block, but now it seems like they stay open for the whole experiment. The erase attribute refers to the trial, I think. Is there something similar for the block?
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
Athanasia - 11/30/2021

thank you so much, I was trying to figure out why groupid 6 did not work, while the rest did.
It works perfectly now!! Many thanks again for everything.

One last thing: I want the ports to stay open after the end of the trial, till the end of the block, but now it seems like they stay open for the whole experiment. The erase attribute refers to the trial, I think. Is there something similar for the block?

First, you'll need to reset trial.odor's stimulusframes before you add a port to it, otherwise you just keep adding ports to the trial (i.e., the trial will "diisplay" the first port selected in the first block, the first AND the second port selected in the second block, the first, second AND third port selected in the 3rd block).
https://www.millisecond.com/support/docs/v6/html/language/functions/resetstimulusframes.htm

Second, to "turn off" the odor at the end of a block, It's probably easiest if you run a trial at the end of each block that does that.

<trial odor_off>
/ stimulusframes = [1=odor_off]
...
</trial>

<port odor_off>
/ items = ("0000000")
...
</port>

<block MorphTask>
/ trials = [1= odor; 2=…;  ??=odor_off]
</block>

Athanasia
Athanasia
Associate Member (223 reputation)Associate Member (223 reputation)Associate Member (223 reputation)Associate Member (223 reputation)Associate Member (223 reputation)Associate Member (223 reputation)Associate Member (223 reputation)Associate Member (223 reputation)Associate Member (223 reputation)
Group: Forum Members
Posts: 19, Visits: 58

again thank you for your help! Everything works as desired now!
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Reading This Topic

Explore
Messages
Mentions
Search