Randomizing groups of blocks?


Author
Message
am2922
am2922
Partner Member (966 reputation)Partner Member (966 reputation)Partner Member (966 reputation)Partner Member (966 reputation)Partner Member (966 reputation)Partner Member (966 reputation)Partner Member (966 reputation)Partner Member (966 reputation)Partner Member (966 reputation)
Group: Forum Members
Posts: 9, Visits: 44
Hi,

I am trying to create an experiment in which we have 4 blocks with randomized trials: Block A_positive, Block A_negative, Block B_positive, and Block B_negative. I'm wondering if there's a way to randomize the order that the blocks are shown, but still keep the two Block As together and Block Bs together. In other words, I'm trying to achieve two levels of randomization. I'd like to randomize whether block A or block B is shown first, and then randomize whether positive or negative is shown first within those blocks. It seems like group assignment would be the best way to go about this, but I'm not sure how to write the code. Any help with this would be much appreciated!

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
am2922 - Wednesday, February 21, 2018
Hi,

I am trying to create an experiment in which we have 4 blocks with randomized trials: Block A_positive, Block A_negative, Block B_positive, and Block B_negative. I'm wondering if there's a way to randomize the order that the blocks are shown, but still keep the two Block As together and Block Bs together. In other words, I'm trying to achieve two levels of randomization. I'd like to randomize whether block A or block B is shown first, and then randomize whether positive or negative is shown first within those blocks. It seems like group assignment would be the best way to go about this, but I'm not sure how to write the code. Any help with this would be much appreciated!

You can achieve this by setting up two "dummy" blocks A and B and then /branch'ing from there to the actual <block>s sampled from a <list>. Like so:

<expt>
/ blocks = [1-2=noreplace(a,b)]
</expt>

<block a>
/ branch = [list.a_blocklist.nextvalue]
</block>

<block b>
/ branch = [list.b_blocklist.nextvalue]
</block>

<list a_blocklist>
/ items = (block.a_positive, block.a_negative)
</list>

<list b_blocklist>
/ items = (block.b_positive, block.b_negative)
</list>

<block a_positive>
/ trials = [1=mytrial]
/ branch = [if (list.a_blocklist.unselectedcount > 0) list.a_blocklist.nextvalue]
</block>

<block a_negative>
/ trials = [1=mytrial]
/ branch = [if (list.a_blocklist.unselectedcount > 0) list.a_blocklist.nextvalue]
</block>

<block b_positive>
/ trials = [1=mytrial]
/ branch = [if (list.b_blocklist.unselectedcount > 0) list.b_blocklist.nextvalue]
</block>

<block b_negative>
/ trials = [1=mytrial]
/ branch = [if (list.b_blocklist.unselectedcount > 0) list.b_blocklist.nextvalue]
</block>

<trial mytrial>
/ stimulusframes = [1=mytext]
/ validresponse = (57)
</trial>

<text mytext>
/ items = ("This is block <%script.currentblock%>.")
</text>


am2922
am2922
Partner Member (966 reputation)Partner Member (966 reputation)Partner Member (966 reputation)Partner Member (966 reputation)Partner Member (966 reputation)Partner Member (966 reputation)Partner Member (966 reputation)Partner Member (966 reputation)Partner Member (966 reputation)
Group: Forum Members
Posts: 9, Visits: 44
Dave - Wednesday, February 21, 2018
am2922 - Wednesday, February 21, 2018
Hi,

I am trying to create an experiment in which we have 4 blocks with randomized trials: Block A_positive, Block A_negative, Block B_positive, and Block B_negative. I'm wondering if there's a way to randomize the order that the blocks are shown, but still keep the two Block As together and Block Bs together. In other words, I'm trying to achieve two levels of randomization. I'd like to randomize whether block A or block B is shown first, and then randomize whether positive or negative is shown first within those blocks. It seems like group assignment would be the best way to go about this, but I'm not sure how to write the code. Any help with this would be much appreciated!

You can achieve this by setting up two "dummy" blocks A and B and then /branch'ing from there to the actual <block>s sampled from a <list>. Like so:

<expt>
/ blocks = [1-2=noreplace(a,b)]
</expt>

<block a>
/ branch = [list.a_blocklist.nextvalue]
</block>

<block b>
/ branch = [list.b_blocklist.nextvalue]
</block>

<list a_blocklist>
/ items = (block.a_positive, block.a_negative)
</list>

<list b_blocklist>
/ items = (block.b_positive, block.b_negative)
</list>

<block a_positive>
/ trials = [1=mytrial]
/ branch = [if (list.a_blocklist.unselectedcount > 0) list.a_blocklist.nextvalue]
</block>

<block a_negative>
/ trials = [1=mytrial]
/ branch = [if (list.a_blocklist.unselectedcount > 0) list.a_blocklist.nextvalue]
</block>

<block b_positive>
/ trials = [1=mytrial]
/ branch = [if (list.b_blocklist.unselectedcount > 0) list.b_blocklist.nextvalue]
</block>

<block b_negative>
/ trials = [1=mytrial]
/ branch = [if (list.b_blocklist.unselectedcount > 0) list.b_blocklist.nextvalue]
</block>

<trial mytrial>
/ stimulusframes = [1=mytext]
/ validresponse = (57)
</trial>

<text mytext>
/ items = ("This is block <%script.currentblock%>.")
</text>


Worked like a charm! However, I have a follow up question that makes things a bit more complicated. After each block, participants take a survey (its the same survey each time). Originally, I used branch in each block element to branch to the survey after the block is completed. If I'm using branch to randomize the blocks, how would I go about inserting the survey between each block? I really appreciate your 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
am2922 - Wednesday, February 21, 2018
Dave - Wednesday, February 21, 2018
am2922 - Wednesday, February 21, 2018
Hi,

I am trying to create an experiment in which we have 4 blocks with randomized trials: Block A_positive, Block A_negative, Block B_positive, and Block B_negative. I'm wondering if there's a way to randomize the order that the blocks are shown, but still keep the two Block As together and Block Bs together. In other words, I'm trying to achieve two levels of randomization. I'd like to randomize whether block A or block B is shown first, and then randomize whether positive or negative is shown first within those blocks. It seems like group assignment would be the best way to go about this, but I'm not sure how to write the code. Any help with this would be much appreciated!

You can achieve this by setting up two "dummy" blocks A and B and then /branch'ing from there to the actual <block>s sampled from a <list>. Like so:

<expt>
/ blocks = [1-2=noreplace(a,b)]
</expt>

<block a>
/ branch = [list.a_blocklist.nextvalue]
</block>

<block b>
/ branch = [list.b_blocklist.nextvalue]
</block>

<list a_blocklist>
/ items = (block.a_positive, block.a_negative)
</list>

<list b_blocklist>
/ items = (block.b_positive, block.b_negative)
</list>

<block a_positive>
/ trials = [1=mytrial]
/ branch = [if (list.a_blocklist.unselectedcount > 0) list.a_blocklist.nextvalue]
</block>

<block a_negative>
/ trials = [1=mytrial]
/ branch = [if (list.a_blocklist.unselectedcount > 0) list.a_blocklist.nextvalue]
</block>

<block b_positive>
/ trials = [1=mytrial]
/ branch = [if (list.b_blocklist.unselectedcount > 0) list.b_blocklist.nextvalue]
</block>

<block b_negative>
/ trials = [1=mytrial]
/ branch = [if (list.b_blocklist.unselectedcount > 0) list.b_blocklist.nextvalue]
</block>

<trial mytrial>
/ stimulusframes = [1=mytext]
/ validresponse = (57)
</trial>

<text mytext>
/ items = ("This is block <%script.currentblock%>.")
</text>


Worked like a charm! However, I have a follow up question that makes things a bit more complicated. After each block, participants take a survey (its the same survey each time). Originally, I used branch in each block element to branch to the survey after the block is completed. If I'm using branch to randomize the blocks, how would I go about inserting the survey between each block? I really appreciate your help!

You would still /branch to the survey from each _positive and _negative block, and simply move the /branch to the next _positive or _negative block to the survey. Like so:

<expt>
/ blocks = [1-2=noreplace(a,b)]
</expt>

<values>
/ blocktype = ""
</values>


<block a>
/ onblockbegin = [
    values.blocktype = "A"
]
/ branch = [list.a_blocklist.nextvalue]
</block>

<block b>
/ onblockbegin = [
    values.blocktype = "B"
]
/ branch = [list.b_blocklist.nextvalue]
</block>

<list a_blocklist>
/ items = (block.a_positive, block.a_negative)
</list>

<list b_blocklist>
/ items = (block.b_positive, block.b_negative)
</list>

<block a_positive>
/ trials = [1=mytrial]
/ branch = [
    block.postblocksurvey
]
</block>

<block a_negative>
/ trials = [1=mytrial]
/ branch = [
    block.postblocksurvey
]
</block>

<block b_positive>
/ trials = [1=mytrial]
/ branch = [
    block.postblocksurvey
]
</block>

<block b_negative>
/ trials = [1=mytrial]
/ branch = [
    block.postblocksurvey
]
</block>

<trial mytrial>
/ stimulusframes = [1=mytext]
/ validresponse = (57)
</trial>

<text mytext>
/ items = ("This is block <%script.currentblock%>.")
</text>

<block postblocksurvey>
/ trials = [1=mypage]
/ branch = [if (values.blocktype == "A" && list.a_blocklist.unselectedcount > 0) list.a_blocklist.nextvalue]
/ branch = [if (values.blocktype == "B" && list.b_blocklist.unselectedcount > 0) list.b_blocklist.nextvalue]
</block>

<surveypage mypage>
/ caption = "This is the post-block survey"
</surveypage>

am2922
am2922
Partner Member (966 reputation)Partner Member (966 reputation)Partner Member (966 reputation)Partner Member (966 reputation)Partner Member (966 reputation)Partner Member (966 reputation)Partner Member (966 reputation)Partner Member (966 reputation)Partner Member (966 reputation)
Group: Forum Members
Posts: 9, Visits: 44
Dave - Wednesday, February 21, 2018
am2922 - Wednesday, February 21, 2018
Dave - Wednesday, February 21, 2018
am2922 - Wednesday, February 21, 2018
Hi,

I am trying to create an experiment in which we have 4 blocks with randomized trials: Block A_positive, Block A_negative, Block B_positive, and Block B_negative. I'm wondering if there's a way to randomize the order that the blocks are shown, but still keep the two Block As together and Block Bs together. In other words, I'm trying to achieve two levels of randomization. I'd like to randomize whether block A or block B is shown first, and then randomize whether positive or negative is shown first within those blocks. It seems like group assignment would be the best way to go about this, but I'm not sure how to write the code. Any help with this would be much appreciated!

You can achieve this by setting up two "dummy" blocks A and B and then /branch'ing from there to the actual <block>s sampled from a <list>. Like so:

<expt>
/ blocks = [1-2=noreplace(a,b)]
</expt>

<block a>
/ branch = [list.a_blocklist.nextvalue]
</block>

<block b>
/ branch = [list.b_blocklist.nextvalue]
</block>

<list a_blocklist>
/ items = (block.a_positive, block.a_negative)
</list>

<list b_blocklist>
/ items = (block.b_positive, block.b_negative)
</list>

<block a_positive>
/ trials = [1=mytrial]
/ branch = [if (list.a_blocklist.unselectedcount > 0) list.a_blocklist.nextvalue]
</block>

<block a_negative>
/ trials = [1=mytrial]
/ branch = [if (list.a_blocklist.unselectedcount > 0) list.a_blocklist.nextvalue]
</block>

<block b_positive>
/ trials = [1=mytrial]
/ branch = [if (list.b_blocklist.unselectedcount > 0) list.b_blocklist.nextvalue]
</block>

<block b_negative>
/ trials = [1=mytrial]
/ branch = [if (list.b_blocklist.unselectedcount > 0) list.b_blocklist.nextvalue]
</block>

<trial mytrial>
/ stimulusframes = [1=mytext]
/ validresponse = (57)
</trial>

<text mytext>
/ items = ("This is block <%script.currentblock%>.")
</text>


Worked like a charm! However, I have a follow up question that makes things a bit more complicated. After each block, participants take a survey (its the same survey each time). Originally, I used branch in each block element to branch to the survey after the block is completed. If I'm using branch to randomize the blocks, how would I go about inserting the survey between each block? I really appreciate your help!

You would still /branch to the survey from each _positive and _negative block, and simply move the /branch to the next _positive or _negative block to the survey. Like so:

<expt>
/ blocks = [1-2=noreplace(a,b)]
</expt>

<values>
/ blocktype = ""
</values>


<block a>
/ onblockbegin = [
    values.blocktype = "A"
]
/ branch = [list.a_blocklist.nextvalue]
</block>

<block b>
/ onblockbegin = [
    values.blocktype = "B"
]
/ branch = [list.b_blocklist.nextvalue]
</block>

<list a_blocklist>
/ items = (block.a_positive, block.a_negative)
</list>

<list b_blocklist>
/ items = (block.b_positive, block.b_negative)
</list>

<block a_positive>
/ trials = [1=mytrial]
/ branch = [
    block.postblocksurvey
]
</block>

<block a_negative>
/ trials = [1=mytrial]
/ branch = [
    block.postblocksurvey
]
</block>

<block b_positive>
/ trials = [1=mytrial]
/ branch = [
    block.postblocksurvey
]
</block>

<block b_negative>
/ trials = [1=mytrial]
/ branch = [
    block.postblocksurvey
]
</block>

<trial mytrial>
/ stimulusframes = [1=mytext]
/ validresponse = (57)
</trial>

<text mytext>
/ items = ("This is block <%script.currentblock%>.")
</text>

<block postblocksurvey>
/ trials = [1=mypage]
/ branch = [if (values.blocktype == "A" && list.a_blocklist.unselectedcount > 0) list.a_blocklist.nextvalue]
/ branch = [if (values.blocktype == "B" && list.b_blocklist.unselectedcount > 0) list.b_blocklist.nextvalue]
</block>

<surveypage mypage>
/ caption = "This is the post-block survey"
</surveypage>

Hi!

Reaching out again to see if there is a way to add a tone to the start of the experiment? I tried to look through the how-to page, but from what I can tell it looks like the way to do it would be to add a block, and I don't know if I can do that with the randomization occurring in my experiment. I was hoping to attach the sound to the Spacebar so that when participants press the spacebar after reading the instructions page, a sound would play signaling the beginning of the first video trial. Is there any way to do this?

Thanks!
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
am2922 - Friday, April 6, 2018
Dave - Wednesday, February 21, 2018
am2922 - Wednesday, February 21, 2018
Dave - Wednesday, February 21, 2018
am2922 - Wednesday, February 21, 2018
Hi,

I am trying to create an experiment in which we have 4 blocks with randomized trials: Block A_positive, Block A_negative, Block B_positive, and Block B_negative. I'm wondering if there's a way to randomize the order that the blocks are shown, but still keep the two Block As together and Block Bs together. In other words, I'm trying to achieve two levels of randomization. I'd like to randomize whether block A or block B is shown first, and then randomize whether positive or negative is shown first within those blocks. It seems like group assignment would be the best way to go about this, but I'm not sure how to write the code. Any help with this would be much appreciated!

You can achieve this by setting up two "dummy" blocks A and B and then /branch'ing from there to the actual <block>s sampled from a <list>. Like so:

<expt>
/ blocks = [1-2=noreplace(a,b)]
</expt>

<block a>
/ branch = [list.a_blocklist.nextvalue]
</block>

<block b>
/ branch = [list.b_blocklist.nextvalue]
</block>

<list a_blocklist>
/ items = (block.a_positive, block.a_negative)
</list>

<list b_blocklist>
/ items = (block.b_positive, block.b_negative)
</list>

<block a_positive>
/ trials = [1=mytrial]
/ branch = [if (list.a_blocklist.unselectedcount > 0) list.a_blocklist.nextvalue]
</block>

<block a_negative>
/ trials = [1=mytrial]
/ branch = [if (list.a_blocklist.unselectedcount > 0) list.a_blocklist.nextvalue]
</block>

<block b_positive>
/ trials = [1=mytrial]
/ branch = [if (list.b_blocklist.unselectedcount > 0) list.b_blocklist.nextvalue]
</block>

<block b_negative>
/ trials = [1=mytrial]
/ branch = [if (list.b_blocklist.unselectedcount > 0) list.b_blocklist.nextvalue]
</block>

<trial mytrial>
/ stimulusframes = [1=mytext]
/ validresponse = (57)
</trial>

<text mytext>
/ items = ("This is block <%script.currentblock%>.")
</text>


Worked like a charm! However, I have a follow up question that makes things a bit more complicated. After each block, participants take a survey (its the same survey each time). Originally, I used branch in each block element to branch to the survey after the block is completed. If I'm using branch to randomize the blocks, how would I go about inserting the survey between each block? I really appreciate your help!

You would still /branch to the survey from each _positive and _negative block, and simply move the /branch to the next _positive or _negative block to the survey. Like so:

<expt>
/ blocks = [1-2=noreplace(a,b)]
</expt>

<values>
/ blocktype = ""
</values>


<block a>
/ onblockbegin = [
    values.blocktype = "A"
]
/ branch = [list.a_blocklist.nextvalue]
</block>

<block b>
/ onblockbegin = [
    values.blocktype = "B"
]
/ branch = [list.b_blocklist.nextvalue]
</block>

<list a_blocklist>
/ items = (block.a_positive, block.a_negative)
</list>

<list b_blocklist>
/ items = (block.b_positive, block.b_negative)
</list>

<block a_positive>
/ trials = [1=mytrial]
/ branch = [
    block.postblocksurvey
]
</block>

<block a_negative>
/ trials = [1=mytrial]
/ branch = [
    block.postblocksurvey
]
</block>

<block b_positive>
/ trials = [1=mytrial]
/ branch = [
    block.postblocksurvey
]
</block>

<block b_negative>
/ trials = [1=mytrial]
/ branch = [
    block.postblocksurvey
]
</block>

<trial mytrial>
/ stimulusframes = [1=mytext]
/ validresponse = (57)
</trial>

<text mytext>
/ items = ("This is block <%script.currentblock%>.")
</text>

<block postblocksurvey>
/ trials = [1=mypage]
/ branch = [if (values.blocktype == "A" && list.a_blocklist.unselectedcount > 0) list.a_blocklist.nextvalue]
/ branch = [if (values.blocktype == "B" && list.b_blocklist.unselectedcount > 0) list.b_blocklist.nextvalue]
</block>

<surveypage mypage>
/ caption = "This is the post-block survey"
</surveypage>

Hi!

Reaching out again to see if there is a way to add a tone to the start of the experiment? I tried to look through the how-to page, but from what I can tell it looks like the way to do it would be to add a block, and I don't know if I can do that with the randomization occurring in my experiment. I was hoping to attach the sound to the Spacebar so that when participants press the spacebar after reading the instructions page, a sound would play signaling the beginning of the first video trial. Is there any way to do this?

Thanks!

I'm not sure why an additional block would interfere with the randomization of any other blocks, so I'd recommend you do just that.

am2922
am2922
Partner Member (966 reputation)Partner Member (966 reputation)Partner Member (966 reputation)Partner Member (966 reputation)Partner Member (966 reputation)Partner Member (966 reputation)Partner Member (966 reputation)Partner Member (966 reputation)Partner Member (966 reputation)
Group: Forum Members
Posts: 9, Visits: 44
Dave - Friday, April 6, 2018
am2922 - Friday, April 6, 2018
Dave - Wednesday, February 21, 2018
am2922 - Wednesday, February 21, 2018
Dave - Wednesday, February 21, 2018
am2922 - Wednesday, February 21, 2018
Hi,

I am trying to create an experiment in which we have 4 blocks with randomized trials: Block A_positive, Block A_negative, Block B_positive, and Block B_negative. I'm wondering if there's a way to randomize the order that the blocks are shown, but still keep the two Block As together and Block Bs together. In other words, I'm trying to achieve two levels of randomization. I'd like to randomize whether block A or block B is shown first, and then randomize whether positive or negative is shown first within those blocks. It seems like group assignment would be the best way to go about this, but I'm not sure how to write the code. Any help with this would be much appreciated!

You can achieve this by setting up two "dummy" blocks A and B and then /branch'ing from there to the actual <block>s sampled from a <list>. Like so:

<expt>
/ blocks = [1-2=noreplace(a,b)]
</expt>

<block a>
/ branch = [list.a_blocklist.nextvalue]
</block>

<block b>
/ branch = [list.b_blocklist.nextvalue]
</block>

<list a_blocklist>
/ items = (block.a_positive, block.a_negative)
</list>

<list b_blocklist>
/ items = (block.b_positive, block.b_negative)
</list>

<block a_positive>
/ trials = [1=mytrial]
/ branch = [if (list.a_blocklist.unselectedcount > 0) list.a_blocklist.nextvalue]
</block>

<block a_negative>
/ trials = [1=mytrial]
/ branch = [if (list.a_blocklist.unselectedcount > 0) list.a_blocklist.nextvalue]
</block>

<block b_positive>
/ trials = [1=mytrial]
/ branch = [if (list.b_blocklist.unselectedcount > 0) list.b_blocklist.nextvalue]
</block>

<block b_negative>
/ trials = [1=mytrial]
/ branch = [if (list.b_blocklist.unselectedcount > 0) list.b_blocklist.nextvalue]
</block>

<trial mytrial>
/ stimulusframes = [1=mytext]
/ validresponse = (57)
</trial>

<text mytext>
/ items = ("This is block <%script.currentblock%>.")
</text>


Worked like a charm! However, I have a follow up question that makes things a bit more complicated. After each block, participants take a survey (its the same survey each time). Originally, I used branch in each block element to branch to the survey after the block is completed. If I'm using branch to randomize the blocks, how would I go about inserting the survey between each block? I really appreciate your help!

You would still /branch to the survey from each _positive and _negative block, and simply move the /branch to the next _positive or _negative block to the survey. Like so:

<expt>
/ blocks = [1-2=noreplace(a,b)]
</expt>

<values>
/ blocktype = ""
</values>


<block a>
/ onblockbegin = [
    values.blocktype = "A"
]
/ branch = [list.a_blocklist.nextvalue]
</block>

<block b>
/ onblockbegin = [
    values.blocktype = "B"
]
/ branch = [list.b_blocklist.nextvalue]
</block>

<list a_blocklist>
/ items = (block.a_positive, block.a_negative)
</list>

<list b_blocklist>
/ items = (block.b_positive, block.b_negative)
</list>

<block a_positive>
/ trials = [1=mytrial]
/ branch = [
    block.postblocksurvey
]
</block>

<block a_negative>
/ trials = [1=mytrial]
/ branch = [
    block.postblocksurvey
]
</block>

<block b_positive>
/ trials = [1=mytrial]
/ branch = [
    block.postblocksurvey
]
</block>

<block b_negative>
/ trials = [1=mytrial]
/ branch = [
    block.postblocksurvey
]
</block>

<trial mytrial>
/ stimulusframes = [1=mytext]
/ validresponse = (57)
</trial>

<text mytext>
/ items = ("This is block <%script.currentblock%>.")
</text>

<block postblocksurvey>
/ trials = [1=mypage]
/ branch = [if (values.blocktype == "A" && list.a_blocklist.unselectedcount > 0) list.a_blocklist.nextvalue]
/ branch = [if (values.blocktype == "B" && list.b_blocklist.unselectedcount > 0) list.b_blocklist.nextvalue]
</block>

<surveypage mypage>
/ caption = "This is the post-block survey"
</surveypage>

Hi!

Reaching out again to see if there is a way to add a tone to the start of the experiment? I tried to look through the how-to page, but from what I can tell it looks like the way to do it would be to add a block, and I don't know if I can do that with the randomization occurring in my experiment. I was hoping to attach the sound to the Spacebar so that when participants press the spacebar after reading the instructions page, a sound would play signaling the beginning of the first video trial. Is there any way to do this?

Thanks!

I'm not sure why an additional block would interfere with the randomization of any other blocks, so I'd recommend you do just that.

I guess my question if I use a block is how do I make sure the sound block is played first, before the randomized video blocks. Right now I have:

<expt >
/ preinstructions = (Intro)
/ postinstructions = (End)
/ blocks = [1-2 =noreplacenorepeat(human, dog)]
</expt>

<block panas>
/ trials = [1=surveypage.panas_page1]
/ branch = [if (values.blocktype == "Human" && list.human_blocklist.unselectedcount > 0) list.human_blocklist.nextvalue]
/ branch = [if (values.blocktype == "Dog" && list.dog_blocklist.unselectedcount > 0) list.dog_blocklist.nextvalue]
</block>

<block human>
/ onblockbegin = [values.blocktype = "Human"]
/ branch = [list.human_blocklist.nextvalue]
</block>

<block dog>
/ onblockbegin = [values.blocktype = "Dog"]
/ branch = [list.dog_blocklist.nextvalue]
</block>

<list human_blocklist>
/ items = (block.human_positive, block.human_negative)
</list>

<list dog_blocklist>
/ items = (block.dog_positive, block.dog_negative)
</list>

<block human_positive>
/ trials = [1-10=Positive_human]
/ branch = [block.panas]
</block>

<block human_negative>
/ trials = [1-10=Negative_human]
/ branch = [block.panas]
</block>

<block dog_positive>
/ trials = [1-10=Positive_dog]
/ branch = [block.panas]
</block>

<block dog_negative>
/ trials = [1-10=Negative_dog]
/ branch = [block.panas]
</block>

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
am2922 - Friday, April 6, 2018
Dave - Friday, April 6, 2018
am2922 - Friday, April 6, 2018
Dave - Wednesday, February 21, 2018
am2922 - Wednesday, February 21, 2018
Dave - Wednesday, February 21, 2018
am2922 - Wednesday, February 21, 2018
Hi,

I am trying to create an experiment in which we have 4 blocks with randomized trials: Block A_positive, Block A_negative, Block B_positive, and Block B_negative. I'm wondering if there's a way to randomize the order that the blocks are shown, but still keep the two Block As together and Block Bs together. In other words, I'm trying to achieve two levels of randomization. I'd like to randomize whether block A or block B is shown first, and then randomize whether positive or negative is shown first within those blocks. It seems like group assignment would be the best way to go about this, but I'm not sure how to write the code. Any help with this would be much appreciated!

You can achieve this by setting up two "dummy" blocks A and B and then /branch'ing from there to the actual <block>s sampled from a <list>. Like so:

<expt>
/ blocks = [1-2=noreplace(a,b)]
</expt>

<block a>
/ branch = [list.a_blocklist.nextvalue]
</block>

<block b>
/ branch = [list.b_blocklist.nextvalue]
</block>

<list a_blocklist>
/ items = (block.a_positive, block.a_negative)
</list>

<list b_blocklist>
/ items = (block.b_positive, block.b_negative)
</list>

<block a_positive>
/ trials = [1=mytrial]
/ branch = [if (list.a_blocklist.unselectedcount > 0) list.a_blocklist.nextvalue]
</block>

<block a_negative>
/ trials = [1=mytrial]
/ branch = [if (list.a_blocklist.unselectedcount > 0) list.a_blocklist.nextvalue]
</block>

<block b_positive>
/ trials = [1=mytrial]
/ branch = [if (list.b_blocklist.unselectedcount > 0) list.b_blocklist.nextvalue]
</block>

<block b_negative>
/ trials = [1=mytrial]
/ branch = [if (list.b_blocklist.unselectedcount > 0) list.b_blocklist.nextvalue]
</block>

<trial mytrial>
/ stimulusframes = [1=mytext]
/ validresponse = (57)
</trial>

<text mytext>
/ items = ("This is block <%script.currentblock%>.")
</text>


Worked like a charm! However, I have a follow up question that makes things a bit more complicated. After each block, participants take a survey (its the same survey each time). Originally, I used branch in each block element to branch to the survey after the block is completed. If I'm using branch to randomize the blocks, how would I go about inserting the survey between each block? I really appreciate your help!

You would still /branch to the survey from each _positive and _negative block, and simply move the /branch to the next _positive or _negative block to the survey. Like so:

<expt>
/ blocks = [1-2=noreplace(a,b)]
</expt>

<values>
/ blocktype = ""
</values>


<block a>
/ onblockbegin = [
    values.blocktype = "A"
]
/ branch = [list.a_blocklist.nextvalue]
</block>

<block b>
/ onblockbegin = [
    values.blocktype = "B"
]
/ branch = [list.b_blocklist.nextvalue]
</block>

<list a_blocklist>
/ items = (block.a_positive, block.a_negative)
</list>

<list b_blocklist>
/ items = (block.b_positive, block.b_negative)
</list>

<block a_positive>
/ trials = [1=mytrial]
/ branch = [
    block.postblocksurvey
]
</block>

<block a_negative>
/ trials = [1=mytrial]
/ branch = [
    block.postblocksurvey
]
</block>

<block b_positive>
/ trials = [1=mytrial]
/ branch = [
    block.postblocksurvey
]
</block>

<block b_negative>
/ trials = [1=mytrial]
/ branch = [
    block.postblocksurvey
]
</block>

<trial mytrial>
/ stimulusframes = [1=mytext]
/ validresponse = (57)
</trial>

<text mytext>
/ items = ("This is block <%script.currentblock%>.")
</text>

<block postblocksurvey>
/ trials = [1=mypage]
/ branch = [if (values.blocktype == "A" && list.a_blocklist.unselectedcount > 0) list.a_blocklist.nextvalue]
/ branch = [if (values.blocktype == "B" && list.b_blocklist.unselectedcount > 0) list.b_blocklist.nextvalue]
</block>

<surveypage mypage>
/ caption = "This is the post-block survey"
</surveypage>

Hi!

Reaching out again to see if there is a way to add a tone to the start of the experiment? I tried to look through the how-to page, but from what I can tell it looks like the way to do it would be to add a block, and I don't know if I can do that with the randomization occurring in my experiment. I was hoping to attach the sound to the Spacebar so that when participants press the spacebar after reading the instructions page, a sound would play signaling the beginning of the first video trial. Is there any way to do this?

Thanks!

I'm not sure why an additional block would interfere with the randomization of any other blocks, so I'd recommend you do just that.

I guess my question if I use a block is how do I make sure the sound block is played first, before the randomized video blocks. Right now I have:

<expt >
/ preinstructions = (Intro)
/ postinstructions = (End)
/ blocks = [1-2 =noreplacenorepeat(human, dog)]
</expt>

<block panas>
/ trials = [1=surveypage.panas_page1]
/ branch = [if (values.blocktype == "Human" && list.human_blocklist.unselectedcount > 0) list.human_blocklist.nextvalue]
/ branch = [if (values.blocktype == "Dog" && list.dog_blocklist.unselectedcount > 0) list.dog_blocklist.nextvalue]
</block>

<block human>
/ onblockbegin = [values.blocktype = "Human"]
/ branch = [list.human_blocklist.nextvalue]
</block>

<block dog>
/ onblockbegin = [values.blocktype = "Dog"]
/ branch = [list.dog_blocklist.nextvalue]
</block>

<list human_blocklist>
/ items = (block.human_positive, block.human_negative)
</list>

<list dog_blocklist>
/ items = (block.dog_positive, block.dog_negative)
</list>

<block human_positive>
/ trials = [1-10=Positive_human]
/ branch = [block.panas]
</block>

<block human_negative>
/ trials = [1-10=Negative_human]
/ branch = [block.panas]
</block>

<block dog_positive>
/ trials = [1-10=Positive_dog]
/ branch = [block.panas]
</block>

<block dog_negative>
/ trials = [1-10=Negative_dog]
/ branch = [block.panas]
</block>

Thank you!

You simply do

<expt >
/ preinstructions = (Intro)
/ postinstructions = (End)
/ blocks = [1 = soundblock; 2-3 =noreplacenorepeat(human, dog)]
</expt>
am2922
am2922
Partner Member (966 reputation)Partner Member (966 reputation)Partner Member (966 reputation)Partner Member (966 reputation)Partner Member (966 reputation)Partner Member (966 reputation)Partner Member (966 reputation)Partner Member (966 reputation)Partner Member (966 reputation)
Group: Forum Members
Posts: 9, Visits: 44
Dave - Friday, April 6, 2018
am2922 - Friday, April 6, 2018
Dave - Friday, April 6, 2018
am2922 - Friday, April 6, 2018
Dave - Wednesday, February 21, 2018
am2922 - Wednesday, February 21, 2018
Dave - Wednesday, February 21, 2018
am2922 - Wednesday, February 21, 2018
Hi,

I am trying to create an experiment in which we have 4 blocks with randomized trials: Block A_positive, Block A_negative, Block B_positive, and Block B_negative. I'm wondering if there's a way to randomize the order that the blocks are shown, but still keep the two Block As together and Block Bs together. In other words, I'm trying to achieve two levels of randomization. I'd like to randomize whether block A or block B is shown first, and then randomize whether positive or negative is shown first within those blocks. It seems like group assignment would be the best way to go about this, but I'm not sure how to write the code. Any help with this would be much appreciated!

You can achieve this by setting up two "dummy" blocks A and B and then /branch'ing from there to the actual <block>s sampled from a <list>. Like so:

<expt>
/ blocks = [1-2=noreplace(a,b)]
</expt>

<block a>
/ branch = [list.a_blocklist.nextvalue]
</block>

<block b>
/ branch = [list.b_blocklist.nextvalue]
</block>

<list a_blocklist>
/ items = (block.a_positive, block.a_negative)
</list>

<list b_blocklist>
/ items = (block.b_positive, block.b_negative)
</list>

<block a_positive>
/ trials = [1=mytrial]
/ branch = [if (list.a_blocklist.unselectedcount > 0) list.a_blocklist.nextvalue]
</block>

<block a_negative>
/ trials = [1=mytrial]
/ branch = [if (list.a_blocklist.unselectedcount > 0) list.a_blocklist.nextvalue]
</block>

<block b_positive>
/ trials = [1=mytrial]
/ branch = [if (list.b_blocklist.unselectedcount > 0) list.b_blocklist.nextvalue]
</block>

<block b_negative>
/ trials = [1=mytrial]
/ branch = [if (list.b_blocklist.unselectedcount > 0) list.b_blocklist.nextvalue]
</block>

<trial mytrial>
/ stimulusframes = [1=mytext]
/ validresponse = (57)
</trial>

<text mytext>
/ items = ("This is block <%script.currentblock%>.")
</text>


Worked like a charm! However, I have a follow up question that makes things a bit more complicated. After each block, participants take a survey (its the same survey each time). Originally, I used branch in each block element to branch to the survey after the block is completed. If I'm using branch to randomize the blocks, how would I go about inserting the survey between each block? I really appreciate your help!

You would still /branch to the survey from each _positive and _negative block, and simply move the /branch to the next _positive or _negative block to the survey. Like so:

<expt>
/ blocks = [1-2=noreplace(a,b)]
</expt>

<values>
/ blocktype = ""
</values>


<block a>
/ onblockbegin = [
    values.blocktype = "A"
]
/ branch = [list.a_blocklist.nextvalue]
</block>

<block b>
/ onblockbegin = [
    values.blocktype = "B"
]
/ branch = [list.b_blocklist.nextvalue]
</block>

<list a_blocklist>
/ items = (block.a_positive, block.a_negative)
</list>

<list b_blocklist>
/ items = (block.b_positive, block.b_negative)
</list>

<block a_positive>
/ trials = [1=mytrial]
/ branch = [
    block.postblocksurvey
]
</block>

<block a_negative>
/ trials = [1=mytrial]
/ branch = [
    block.postblocksurvey
]
</block>

<block b_positive>
/ trials = [1=mytrial]
/ branch = [
    block.postblocksurvey
]
</block>

<block b_negative>
/ trials = [1=mytrial]
/ branch = [
    block.postblocksurvey
]
</block>

<trial mytrial>
/ stimulusframes = [1=mytext]
/ validresponse = (57)
</trial>

<text mytext>
/ items = ("This is block <%script.currentblock%>.")
</text>

<block postblocksurvey>
/ trials = [1=mypage]
/ branch = [if (values.blocktype == "A" && list.a_blocklist.unselectedcount > 0) list.a_blocklist.nextvalue]
/ branch = [if (values.blocktype == "B" && list.b_blocklist.unselectedcount > 0) list.b_blocklist.nextvalue]
</block>

<surveypage mypage>
/ caption = "This is the post-block survey"
</surveypage>

Hi!

Reaching out again to see if there is a way to add a tone to the start of the experiment? I tried to look through the how-to page, but from what I can tell it looks like the way to do it would be to add a block, and I don't know if I can do that with the randomization occurring in my experiment. I was hoping to attach the sound to the Spacebar so that when participants press the spacebar after reading the instructions page, a sound would play signaling the beginning of the first video trial. Is there any way to do this?

Thanks!

I'm not sure why an additional block would interfere with the randomization of any other blocks, so I'd recommend you do just that.

I guess my question if I use a block is how do I make sure the sound block is played first, before the randomized video blocks. Right now I have:

<expt >
/ preinstructions = (Intro)
/ postinstructions = (End)
/ blocks = [1-2 =noreplacenorepeat(human, dog)]
</expt>

<block panas>
/ trials = [1=surveypage.panas_page1]
/ branch = [if (values.blocktype == "Human" && list.human_blocklist.unselectedcount > 0) list.human_blocklist.nextvalue]
/ branch = [if (values.blocktype == "Dog" && list.dog_blocklist.unselectedcount > 0) list.dog_blocklist.nextvalue]
</block>

<block human>
/ onblockbegin = [values.blocktype = "Human"]
/ branch = [list.human_blocklist.nextvalue]
</block>

<block dog>
/ onblockbegin = [values.blocktype = "Dog"]
/ branch = [list.dog_blocklist.nextvalue]
</block>

<list human_blocklist>
/ items = (block.human_positive, block.human_negative)
</list>

<list dog_blocklist>
/ items = (block.dog_positive, block.dog_negative)
</list>

<block human_positive>
/ trials = [1-10=Positive_human]
/ branch = [block.panas]
</block>

<block human_negative>
/ trials = [1-10=Negative_human]
/ branch = [block.panas]
</block>

<block dog_positive>
/ trials = [1-10=Positive_dog]
/ branch = [block.panas]
</block>

<block dog_negative>
/ trials = [1-10=Negative_dog]
/ branch = [block.panas]
</block>

Thank you!

You simply do

<expt >
/ preinstructions = (Intro)
/ postinstructions = (End)
/ blocks = [1 = soundblock; 2-3 =noreplacenorepeat(human, dog)]
</expt>

Wow, I didn't realize you could do that. Amazing, thanks!
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Reading This Topic

Explore
Messages
Mentions
Search