Millisecond Forums

AAT (make blocks)

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

By Sato - 6/11/2015

Now I am making an Approach-Avoidance Task's script.

I want to record response time for each separate 10 blocks.
One block is consisted with 20 trials. I want to run the trials within each blocks randomly.

I made following script. 

<block AAT>
/ onblockbegin = [values.index = 0]
/ trials = [1-20 = AAT_start; 21-40 = AAT_start; 41-60 = AAT_start; 61-80 = AAT_start; 81-100 = AAT_start; 101-120 = AAT_start; 121-140 = AAT_start; 141-161 = AAT_start; 161-180 = AAT_start; 181-200 = AAT_start]
</block>

<expt >
...
/ blocks = [1 = SequenceGenerator; 2 = practice_AAT; 3 = AAT; 4 = AAT; 5 = AAT; 6 = AAT; 7 = AAT; 8 = AAT; 9 = AAT; 10 = AAT; 11 = AAT; 12 = AAT]
...
</expt>

I could run the script, and marked block numbers. 
However,  stimulus presentation was maybe not random, when I watched the raw data.

What code should I correct?
By Dave - 6/11/2015

The stimulus presentation sequence / randomization is determined in <block SequenceGenerator> / <trial selectnumber> and associated elements according to the selection constraints detailed in the comments.

The resulting sequence is stored in values.sequence. The AAT "start" trials read out a single value from based on values.index, i.e, take with values.index at 0, take the 1st digit in values.sequence, then increase values.index by one. The next time <trial AAT_start> runs, it will take the 2nd digit in values.sequence (because values.index equals 1 at this point) and so forth:

<trial AAT_start>
/ ontrialbegin = [values.nextstimulus = substring(values.sequence, values.index, 1);
            values.index += 1]
...
</trial>

Since you reset values.index back to 0 at the start of

<block AAT>
/ onblockbegin = [values.index = 0]
...
</block>

every time you run that block via your <expt> the selection will restart from 0 / will be the same.
By Sato - 6/11/2015

Dear Dave

Thank you for your reply.
I was understand that my script makes same order.

I want to know how to run the random order trials.
What should I do now? 
By Dave - 6/11/2015

If you don't want to restart from index 0 with every instance of <block AAT> (you run it several times via your <expt>), don't reset values.index to 0 at the start of <block AAT>:

<block AAT>
/ onblockbegin = [values.index = 0]
...
</block>

The current instance of <block AAT> will then pick up where previous instance left off.
By Dave - 6/11/2015

Also, you run a *huge* number of trials. A single instance of <block AAT> runs 200 trials

<block AAT>
/ onblockbegin = [values.index = 0]
/ trials = [1-20 = AAT_start; 21-40 = AAT_start; 41-60 = AAT_start; 61-80 = AAT_start; 81-100 = AAT_start; 101-120 = AAT_start; 121-140 = AAT_start; 141-161 = AAT_start; 161-180 = AAT_start; 181-200 = AAT_start]
</block>

(the chunking into 20 trial-sections does not serve any purpose, btw)

and you run 10 instances of the block

<expt >
...
/ blocks = [1 = SequenceGenerator; 2 = practice_AAT; 3 = AAT; 4 = AAT; 5 = AAT; 6 = AAT; 7 = AAT; 8 = AAT; 9 = AAT; 10 = AAT; 11 = AAT; 12 = AAT]
...
</expt>

i.e. 2000 (!) trials total.

Now, if you look at the sequence generation code (please work through that again), you will find that you only generate a sequence of length 20. The relevant value here is values.totaltrialcount

<values>
...
/totaltrialcount = 20
</values>


*****************************************************************************
List Stimcats: contains all 80 possible stimuli
*****************************************************************************
Note: the number of item elements should be = values.totaltrialcount (editable value)

<list stimcats>
/ items = (
1,1,1,1,1,1,1,1,1,1,
2,2,2,2,2,2,2,2,2,2,
3,3,3,3,3,3,3,3,3,3,
4,4,4,4,4,4,4,4,4,4,
5,5,5,5,5,5,5,5,5,5,
6,6,6,6,6,6,6,6,6,6)
/ replace = false
</list>

*****************************************************************************
Trial Selectnumber: selects the newnumber and checks whether
all constraints are met
- if all constraints are met: adds new number to sequence
- constraints are not met: checks whether an alternative number is available that could meet constraint
                => if yes: returns current number to list and tries again
                => if no: starts the sequence over
*****************************************************************************
...

I.e., you need to generate a *much* longer sequence if you actually want to run 2000 trials.

My gut feeling is that you actually want to do something like

<block AAT>
/ trials = [1-20 = AAT_start]
</block>

i.e. run *20* trials per block / run the block 10 times (200 trials total). You either need to generate a sequence of length 200 for that *or* generate a new sequence before each aat-block by re-running the sequence generation block before every aat-block.

Whatever the case, you absolutely *must* adjust the sequence generation according to the parameters applicable to your task (number of item categories, etc.).
By Sato - 6/11/2015

thank you for your advice.
However my script couldn't run whe delete "/ onblockbegin = [values.index = 0]".

I tried to fully random trial.

<block AAT>
/ trials = [1-20 = noreplace(AAT_1, AAT_2, AAT_3, AAT_4, AAT_5, AAT_6)]
</block>

It made the consequent data random.

How do you think this method?
By Dave - 6/11/2015

Yes, if you don't need constrained randomization, you can absolutely do that.
By Sato - 6/12/2015

thank you for your comment.

When I delete "/ onblockbegin = [values.index = 0]", I couldn't run AAT experimental trials. (practice was OK)

<block AAT>
/ onblockbegin = [values.index = 0]
/ trials = [1-20 = AAT_start]
</block>

What code I have to write?
By Dave - 6/14/2015

You need to make sure that values.index is equal to 0 when the test block(s) begin. If you look at the sequence generation code, you'll notice that <trial selectnumber> works with / increases values.index, i.e., once the pseudorandom sequence generation is done, values.index will *not* be equal to 0. You can set it to 0 at the end of the practice block:

<block practice_AAT>
/ onblockend = [values.index=0]
/ trials = [1-2 = instructions; 3-12 = noreplace(practicetrial_A, practicetrial_B); 13 = instructions; ]
</block>
By Sato - 6/14/2015

Wow! I could run the script!

Thank you very much!!!
By Sato - 6/15/2015

Now I use the following script.

<block AAT>
/ trials = [1-6 = AAT_start]
</block> 

<except>
/ blocks = [1 = SequenceGenerator; 2 = practice_AAT; 3 = AAT; 4 = AAT; 5 = AAT; 6 = break; 7 = AAT; 8 = AAT; 9 = AAT]
</except>

<values>
/count1 = 1
/count2 = 1
/count3 = 1
/count4 = 1
/count5 = 1
/count6 = 1
/count7 = 0
/count8 = 0
/runcount_1 = 0
/runcount_2 = 0
/runcount_3 = 0
/runcount_4 = 0
/runcount_A = 0
/runcount_B = 0
/newnumber = 0
/count_comparecat = 0
/count_compareformat = 0
/sequence = ""
/index = 0
</values>

 I want to display the same number of times about <trial AAT_[hoge]> each blocks.
However the number was different in a <traial AAT_[hoge]>.

What I have to do?