Millisecond Forums

Branching to Likert trial type

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

By danaleighton - 10/24/2018

Hello Inquisit people:

I am trying to branch to one of two likert elements based on the group ID entered when the script is run.

When I read the manual, it says that a branch attribute can be used in a block element, and that it can branch to an "event (i.e., trial, block, etc.)" But -- when I try branching to a likert event (a specialized trial element according to the manual), it does not seem to make the branch. When I run the following code to test it (pasted because it's relatively short), the script simply terminates without presenting the likert event.

Anything I am doing wrong here? I am attaching the full script of what I am trying to do in my experiment for your reference.

<text test1> / items = ("test1") </text>
<text test2> / items = ("test2") </text>
<likert test1> / stimulusframes=[1=text.test1] /position = (50,75) </likert>
<likert test2> / stimulusframes=[1=text.test2] /position = (50,75) </likert>
<block test> / branch = [if (script.groupid == "1") likert.test1] / branch = [if (script.groupid == "2") likert.test2] </block>

By Dave - 10/24/2018

danaleighton - Wednesday, October 24, 2018
Hello Inquisit people:

I am trying to branch to one of two likert elements based on the group ID entered when the script is run.

When I read the manual, it says that a branch attribute can be used in a block element, and that it can branch to an "event (i.e., trial, block, etc.)" But -- when I try branching to a likert event (a specialized trial element according to the manual), it does not seem to make the branch. When I run the following code to test it (pasted because it's relatively short), the script simply terminates without presenting the likert event.

Anything I am doing wrong here? I am attaching the full script of what I am trying to do in my experiment for your reference.

<text test1> / items = ("test1") </text>
<text test2> / items = ("test2") </text>
<likert test1> / stimulusframes=[1=text.test1] /position = (50,75) </likert>
<likert test2> / stimulusframes=[1=text.test2] /position = (50,75) </likert>
<block test> / branch = [if (script.groupid == "1") likert.test1] / branch = [if (script.groupid == "2") likert.test2] </block>


A /branch must remain at the same level. I:e. a <block> can /branch to another <block>, it cannot /branch to a <trial>. A <trial> can /branch to another <trial>, it cannot /branch to a <block>.
By danaleighton - 10/24/2018

Dave - Wednesday, October 24, 2018

A /branch must remain at the same level. I:e. a <block> can /branch to another <block>, it cannot /branch to a <trial>. A <trial> can /branch to another <trial>, it cannot /branch to a <block>.

Ok Hmmm... then here is what I tried:
<text test1> / items = ("test1") </text>
<text test2> / items = ("test2") </text>

<likert test1> / branch = [if (script.groupid == "2") likert.test2] / stimulusframes=[1=text.test1] /position = (50,75) </likert>
<likert test2> / stimulusframes=[1=text.test2] /position = (50,75) </likert>

<block test> / trials = [1=likert.test1] </block>

No matter what group ID I enter when I run the script, I get the test1 likert trial. Is there a better way to do this that I am not seeing?
By danaleighton - 10/24/2018


On further testing, it looks like the way to go is to run both likert trials in the block, and use the /skip attribute to skip the one I do not want. thus:
<likert test1>
/ skip = [script.groupid == "2"]
...
</likert>
<likert test2>
/ skip = [script.groupid == "1"]
...
</likert>

<block test>
/ trials = [1=sequence(likert.test1, likert.test2)]
</block>
By Dave - 10/24/2018

danaleighton - Wednesday, October 24, 2018
Dave - Wednesday, October 24, 2018

A /branch must remain at the same level. I:e. a <block> can /branch to another <block>, it cannot /branch to a <trial>. A <trial> can /branch to another <trial>, it cannot /branch to a <block>.

Ok Hmmm... then here is what I tried:
<text test1> / items = ("test1") </text>
<text test2> / items = ("test2") </text>

<likert test1> / branch = [if (script.groupid == "2") likert.test2] / stimulusframes=[1=text.test1] /position = (50,75) </likert>
<likert test2> / stimulusframes=[1=text.test2] /position = (50,75) </likert>

<block test> / trials = [1=likert.test1] </block>

No matter what group ID I enter when I run the script, I get the test1 likert trial. Is there a better way to do this that I am not seeing?

You always get the likert.test1 trial because you run it in every case per your <block>:


<block test> / trials = [1=likert.test1] </block>

It is only _after_ likert.test1 that you /branch to likert.test2:

<likert test1> / branch = [if (script.groupid == "2") likert.test2] / stimulusframes=[1=text.test1] /position = (50,75) </likert>

There are tons of ways to do this correctly, some involving /branch, others not involving /branch, but rather /skip or just treating the whole thing as a between-subjects condition.

If you want to use /branch, either set up separate <block>s -- one running test1, one running test2 -- and /branch to the appropriate <block> from your existing block. You can also just use a single <block>, have it run a single dummy trial that does nothing but /branch to the appropriate <likert>. Or you can have your <block> run _both_ likerts and use /skip to exclude the one likert that's not supposed to be administered depending on groupid.

#1:

<text test1>
/ items = ("test1")
</text>

<text test2>
/ items = ("test2")
</text>

<likert test1>
/ stimulusframes=[1=text.test1]
/position = (50,75)
</likert>

<likert test2>
/ stimulusframes=[1=text.test2]
/position = (50,75)
</likert>

<block test>
/ branch = [if (script.groupid == "1") block.test1]
/ branch = [if (script.groupid == "2") block.test2]
</block>

<block test1>
/ trials = [1=likert.test1]
</block>

<block test2>
/ trials = [1=likert.test2]
</block>

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

#2:
<text test1>
/ items = ("test1")
</text>

<text test2>
/ items = ("test2")
</text>

<likert test1>
/ stimulusframes=[1=text.test1]
/position = (50,75)
</likert>

<likert test2>
/ stimulusframes=[1=text.test2]
/position = (50,75)
</likert>

<trial test>
/ validresponse = (0)
/ recorddata = false
/ trialduration = 0
/ branch = [if (script.groupid == 1) likert.test1]
/ branch = [if (script.groupid == 2) likert.test2]
</trial>

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

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

#3:
<text test1>
/ items = ("test1")
</text>

<text test2>
/ items = ("test2")
</text>

<likert test1>
/ skip = [script.groupid == 2]
/ stimulusframes=[1=text.test1]
/position = (50,75)
</likert>

<likert test2>
/ skip = [script.groupid == 1]
/ stimulusframes=[1=text.test2]
/position = (50,75)
</likert>

<block test>
/ trials = [1=sequence(test1, test2)]
</block>

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