Single randomized list with breaks using part and testpart

59 views
Skip to first unread message

Andy

unread,
Mar 6, 2013, 9:00:47 PM3/6/13
to scrip...@googlegroups.com
Hello,
I am attempting to program an experiment with 100 stimuli and would like to have a "break" for the participant after they complete 50 trial. But I need all 100 stimuli to be randomized together, therefore I think it should all be within the same "testpart", before and after the break (i.e. I don't want to make two separate lists). In DMDX this is possible using the "$" character around the breakpoint. The script rt manual says <part> can be used a similar way but I have been unsuccessful at using it. Here is the relevant code I have used with the extras removed.

<Test part.... scramble = "1">
<item id="item1"...>
<frame 1... >
</end frame>
</end item>
etc etc
<item id = "item50">
<frame id = "frame50">

<!--This is where the break should be

-->
<part id = "break">
<Frame ...text = "Take a break>
</end part>
<item 51...>
etc
</end testpart>

The problem with this set up is that the "break" event gets randomized within the 100 trial list (i.e. it could occur anywhere not necessarily after 50 items).
Does anyone have suggestions about how to code this properly?
Thank you

Thomas Schubert

unread,
Mar 7, 2013, 3:38:22 AM3/7/13
to scrip...@googlegroups.com
Hi Andy,

I am afraid what you want is not that easily doable. The testpart
concept works more like the DMDX backslash \ that the DMDX $.

As a workaround, you could try the following:

- split the 100 trials into two 50 trial blocks in a way that makes
sense. For instance, if you present the same trial always twice, with
different primes or so, put one instance in the one half, the other in
the other half, counterbalancing conditions. the two halfs become
testparts.

- then use the branching syntax to branch randomly to the two halfs. It
will involve some programming of actionscript though.

or, if you want to avoid the programming, set up two versions of the
experiment, and randomize assignments to them externally, e.g. in qualtrics.

best,
thomas
> --
> You received this message because you are subscribed to the Google
> Groups "scriptingrt" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to scriptingrt...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>

--
thomas schubert
department of psychology, university of oslo
schu...@igroup.org
http://www.igroup.org/schubert/

Andy

unread,
Mar 7, 2013, 10:09:57 AM3/7/13
to scrip...@googlegroups.com
Thanks very much. I was able to program a workaround using the methods you suggest.

Elizabeth Collins

unread,
Mar 7, 2013, 10:14:08 AM3/7/13
to scrip...@googlegroups.com
Hi Andy,

What option did you end up using? I may have this same problem in a
little while myself.

Thanks,

Elizabeth

Andy

unread,
Mar 7, 2013, 12:23:44 PM3/7/13
to scrip...@googlegroups.com
I broke my list of stimuli into two blocks (and thus two <testpart>s) and used branching to randomly assign which block goes first. 


On Wednesday, March 6, 2013 8:00:47 PM UTC-6, Andy wrote:

Elizabeth Collins

unread,
Mar 7, 2013, 1:02:57 PM3/7/13
to scrip...@googlegroups.com
Great. Thanks for the info. Good luck with the study.

Andy

unread,
Mar 10, 2013, 6:23:53 PM3/10/13
to scrip...@googlegroups.com
In case anyone would find it useful, below is the basic code I used to "solve" this problem. It is not very elegant and will probably get quickly out of hand if you want to have more than two or three "breaks" but it is a start at least. If anyone has a more efficient solution, please let me know.


<!-- This is the script that will set up the randomization of the blocks-->

<fx:Script>
<![CDATA[
var randomNUmber : Number;
[Bindable] public var go1 : Boolean;
[Bindable] public var go2 : Boolean;
public function setBranches():void{
randomNumber = Math.random();
if (randomNumber < .5) {
go1 = true;
go2 = false;
}
else {
go1 = false;
go2 = true;
}
}
public function branch1(items:Object) : Boolean{
return go1
}
public function branch2(items:Object) : Boolean{
return go2
}
]]>
</fx:Script>
<!-- this part selects which branch to follow based on the random number-->
<TestPart id ="random" positive = "keyboard.space.press">
<branches>
<Branch next ="testpartA" operation ="branch1"/>
<Branch next ="testpartB" operation ="branch2"/>
</branches>
</TestPart>

<!--Now just have two separate testparts (A and B) that counter balance your
blocks of trials. So testpart A will have trials 1-50, a break, then trials 51-100.
TestpartB will have trials 51-100, a break, then trials 1-50. -->
<!--you will want auto to be set to "false" below-->

<Testpart id = "testpartA" positive = "..." negative = ... auto = "false" scramble = "1">
<TestPart id = "A1"...>
<item id = "item1" ...
<Frame id = "frame1"...>
</Frame>
</item>
...
...
...
<item id = "item50"...>
<Frame id = "frame50"...>
</Frame>
</item>
</TestPart>

<Part id = "break"...
<item id = "Break"...>
</item>
</Part>

<Testpart id = "A2"...>
<item id = "item50"...>
...
...
...
<item id = "item100"...>
</Testpart>
</Testpart>

<Testpart id = "testpartB"...>
<!--now set up testpart B the same as testpartA except reverse the blocks of trials-->
<!--If you want more than two blocks of trials you will simply have to add more branchs 
in the function at the very top-->


On Wednesday, March 6, 2013 8:00:47 PM UTC-6, Andy wrote:

Thomas Schubert

unread,
Mar 11, 2013, 7:05:18 AM3/11/13
to scrip...@googlegroups.com
Andy,
looks good, except: why do you put another <Testpart id="A1"> into the <Testpart id = "testpartA">? the latter should be sufficient (i.e. the one you name in the branch next = "...")

thomas
--
You received this message because you are subscribed to the Google Groups "scriptingrt" group.
To unsubscribe from this group and stop receiving emails from it, send an email to scriptingrt...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Andy

unread,
Mar 12, 2013, 10:48:21 AM3/12/13
to scrip...@googlegroups.com
I thought it was necessary to get the "break" to occur after 50 trials. Otherwise, without the sub testpart (e.g. "testpartA1") the break <part> would still get randomly displayed within the overall block of 100 trials. Perhaps we have different ideas of what I am trying to do. I wanted the participants to see all 100 trials so my thinking was

1. Have two blocks of trials (1-50 and 51-100)
2. Testpart A or B = which block goes first
3. subtestpart (A1 or B1) randomizes the items within the given block that was selected above
4. part = break. This break will always occur after the 50th item
5. repeat step 3 with the other block 


On Wednesday, March 6, 2013 8:00:47 PM UTC-6, Andy wrote:

Thomas Schubert

unread,
Mar 22, 2013, 10:34:18 AM3/22/13
to scrip...@googlegroups.com
Hi there,

In response to Andy's mails on randomization and counterbalancing: sorry
that this took a while. I tried to come up with an implementation of my
initial idea, and found a bug in the branching code.

The bug: When a testpart contains a branches statement, only the first
item of that testpart is executed, and then the script immediately jumps
to the branch. just as a demo, I attach files that show this behavior.

this makes my idea, which as supposed to be simpler and with less
repetition, impossible. And it is a pretty bad bug. It was not there
when we introduced the branching code; I checked the old examples. We
probably broke something when we moved the type attribute from frames to
items.

I will see what I can do about the bug, but I will probably not be able
to fix it myself. Frank is not available for programming at the moment,
so probably somebody more capable than me has to fix this. I will see
what I can do.

Andy, can you please nevertheless send me your complete mxml so I can
understand what your double testpart construction does? I am still
puzzled by this, and why it works at all.

best,
thomas
branching.swf
branching.mxml

Thomas Schubert

unread,
Mar 22, 2013, 11:54:13 AM3/22/13
to scrip...@googlegroups.com
hi all,
please ignore my email from today. I realized the bug is not in scriptingRT, but in my understanding of how the branching function works. I will call it a day now and have a fresh look at this next week.
t.

Thomas Schubert

unread,
Mar 26, 2013, 5:56:01 AM3/26/13
to scrip...@googlegroups.com
hi Andy and everybody else, 

after thinking this over I have a new, simpler solution. 


the advantage is that this version has only one copy of each testhalf. The branching between them is randomized with a script that sets the targets of the branching (the next attributes).

What I realized last week is that the function referenced in a branch is executed after EACH item of the testpart. In this way, the testpart can be aborted if necessary (e.g., a long practice testpart can be exited when performance is sufficient). Because of this, we have to test whether the testpart was done completely. To make this easier, I added a new property accessible in the branching function, items.total. see the mxml code for how it works, and what other attributes can be accessed.

In order to test this, you have to download the swc of the latest version, scriptingrt0352.swc.

hope this helps,
thomas

Andy

unread,
Apr 10, 2013, 3:19:39 PM4/10/13
to scrip...@googlegroups.com
Thomas,
Sorry for the delay, I was gone for several days and this project somewhat slipped my mind. Thanks for the post. Please let me know if you still need my code, I am happy to share it. 

Also, perhaps another issue of confusion about what I was trying to get this to do. I have a list of 100 stimuli that I need everybody to see / respond to, with the break in the middle. But I also have different "conditions", that I wanted to randomize participants into. That is, some people will see the 100 stimuli under condition A (and thats it). and other people will see those same 100 stim under conditions B. But no one will see both conditions A and B. Since I am recruiting participants via Amazon Mturk, I was hoping to be able to do all this randomization within the experiment itself. Hopefully this clears things up and sorry for my confusion.

Andy

Thomas Schubert

unread,
Apr 11, 2013, 3:47:56 AM4/11/13
to scrip...@googlegroups.com
Hi Andy,

>
> But I also have different "conditions", that I wanted to randomize
> participants into. That is, some people will see the 100 stimuli under
> condition A (and thats it). and other people will see those same 100
> stim under conditions B. But no one will see both conditions A and B.

ah, I see.
In principle, the solution that I sketched in my last code can be used
for that. However, if the condition involves some kind of manipulation
before the actual RT trials, and the trials are always the same, I would
usually recommend doing that in the HTML environment, e.g. with the
convenient randomization of qualtrics.

I think I will show what I mean by this when I find some time in the
next days with a qualtrics example...

t
Reply all
Reply to author
Forward
0 new messages