Counterbalancing trials


Author
Message
mchu01
mchu01
Respected Member (491 reputation)Respected Member (491 reputation)Respected Member (491 reputation)Respected Member (491 reputation)Respected Member (491 reputation)Respected Member (491 reputation)Respected Member (491 reputation)Respected Member (491 reputation)Respected Member (491 reputation)
Group: Forum Members
Posts: 4, Visits: 97
Hi,
I am having trouble figuring out how to counterbalance the probe and stimulus appearance. The experiment is a dot probe task. I want the high & low images appear on each side of the screen for each condition (HL_H,HL_L, HH_H, and LL_L) for an equal amount of time. For this experiment, there are 40 trials for each condition, 20 conditions each for horizontal and vertical presentations. Hence, high images should appear on the left for 10 trials, etc. I also want the probe to appear behind the high images and the low images for the same number of times for each condition (e.g. 5 times behind the high image when it is on the left, and 5 times behind the high image when it is on the right). 


Here's a snippet of the relevant code:

<text probe>
/items = ("<%values.probe1%>", "<%values.probe2%>")
/select = values.probetype
/hposition = values.probe_x
/vposition = values.probe_y
/txcolor = white
/ fontstyle = ("Arial", values.probe_height, false, false, false, false, 5, 1)
</text>

<list probetype>
/items = (1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2)
/replace = false
</list>

<trial fixation_HLH>
/ontrialbegin = [values.congruence = 1]
/stimulusframes = [1 = eraser, fixation, outline_x1, outline_x2, outline_y1, outline_y2]
/timeout = values.fixationduration
/branch = [trial.targets_HLH]
/posttrialpause = values.fixation_posttrialpause
/recorddata = false
</trial>

<trial targets_HLH>
/ontrialbegin = [values.selecteditem = list.HLH_items.nextvalue]
/ontrialbegin = [if (values.selecteditem == "1A") {values.itemnumber = 1; values.highposition = 1; values.high_x = values.target_right_x; values.low_x = values.target_left_x}]
/ontrialbegin = [if (values.selecteditem == "1B") {values.itemnumber = 1; values.highposition = 2; values.high_x = values.target_left_x; values.low_x = values.target_right_x}]
/ontrialbegin = [if (values.selecteditem == "2A") {values.itemnumber = 2; values.highposition = 1; values.high_x = values.target_right_x; values.low_x = values.target_left_x}]
/ontrialbegin = [if (values.selecteditem == "2B") {values.itemnumber = 2; values.highposition = 2; values.high_x = values.target_left_x; values.low_x = values.target_right_x}]

*****this part of the code goes onto 24A, 24B

/ontrialend = [values.highimage = picture.highimage.currentitem; values.lowimage = picture.lowimage.currentitem]
/timeout = expressions.targetduration
/posttrialpause = values.target_posttrialpause
/branch = [trial.probe_HLH]
/recorddata = false
</trial>

<trial fixation_HLH_y>
/ontrialbegin = [values.congruence = 1]
/stimulusframes = [1 = eraser, fixation, outline_x1, outline_x2, outline_y1, outline_y2]
/timeout = values.fixationduration
/branch = [trial.targets_HLH_y]
/posttrialpause = values.fixation_posttrialpause
/recorddata = false
</trial>

<trial targets_HLH_y>
/ontrialbegin = [values.selecteditem = list.HLH_items.nextvalue]
/ontrialbegin = [if (values.selecteditem == "1A") {values.itemnumber = 1; values.highposition = 1; values.high_y = values.target_top_y; values.low_y = values.target_bottom_y}]
/ontrialbegin = [if (values.selecteditem == "1B") {values.itemnumber = 1; values.highposition = 2; values.high_y = values.target_bottom_y; values.low_y = values.target_top_y}]
/stimulusframes = [1 = highimage_y, lowimage_y]

/ontrialend = [values.highimage_y = picture.highimage_y.currentitem; values.lowimage_y = picture.lowimage_y.currentitem]
/timeout = expressions.targetduration
/posttrialpause = values.target_posttrialpause
/branch = [trial.probe_HLH_y]
/recorddata = false
</trial>

<trial probe_HLH_y>
/ontrialbegin = [values.probetype = list.probetype.nextvalue]
/ontrialbegin = [values.probe_x= values.target_x]
/ontrialbegin = [values.probe_y = values.high_y]
/stimulusframes = [1 = probe]
/isvalidresponse = [trial.probe_HLH_y.response == values.responsekey_left || trial.probe_HLH_y.response == values.responsekey_right]
/monkeyresponse = (30, 35)
/iscorrectresponse = [(values.probetype == 1 && trial.probe_HLH_y.response == values.responsekey_left) ||
               (values.probetype == 2 && trial.probe_HLH_y.response == values.responsekey_right) ]
 
/ontrialend = [if (trial.probe_HLH_y.correct && trial.probe_HLH_y.latency >= values.minimum_latency) {
            values.sum_correct += 1;
            values.sum_correct_probeinhighposition_simple += 1;
            values.sumrt_probeinhighposition_simple += trial.probe_HLH_y.latency;
            values.meanrt_probeinhighposition_simple = values.sumrt_probeinhighposition_simple/values.sum_correct_probeinhighposition_simple}]

/timeout = (values.probeduration)
/branch = [if (values.task == 1 && trial.probe_HLH_y.error) trial.feedback else trial.intertrialinterval]
</trial>


<block highDotProbeTask>
/onblockbegin = [values.task = 2]
/onblockbegin = [values.sum_correct = 0;
   values.sum_correct_probeinhighposition_simple = 0;
   values.sum_correct_probeinlowposition_simple= 0;

   values.sumrt_probeinhighposition_simple = 0;
   values.sumrt_probeinlowposition_simple = 0;

   values.meanrt_probeinhighposition_simple = 0;
   values.meanrt_probeinlowposition_simple = 0]

/trials = [2-41, 43-82, 84-123, 125-164 = noreplace(fixation_HLH, fixation_HLL, fixation_filler_HHH, fixation_filler_LLL, fixation_HLH_y, fixation_HLL_y, fixation_filler_HHH_y, fixation_filler_LLL_y); 42, 83, 124 = rest; 1 = rest2]
</block>

I will be happy to provide more code or clarification if I wasn't clear enough.
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
The code is too incomplete to allow for a specific response. In a nutshell, though, what you need to do, is encode the position, timing etc combinations you want somewhere (e.g. in paired <list> elements; see the "How to Present Stimulus Pairs" topic in the documentation) and then have your <trial>s sample from those combinations as desired.

To give you a simple illustration, suppose you have 3 stimuli (A, B, C), 2 positions (left, right), and 2 timeouts (short, long). You want every stimulus to be presented in each position with each timeout, i.e., there are 3 x 2 x 2 = 12 unique stimulus-position-timeout combinations. An implementation could look like this, then:

3 stims x 2 positions x 2 timeouts = 12 combinations
<list stimlist>
/ items = (1,1,1,1,
    2,2,2,2,
    3,3,3,3)
/ selectionmode = random
</list>

<list positionlist>
/ items = (25%,25%,75%,75%,
    25%,25%,75%,75%,
    25%,25%,75%,75%)
/ selectionmode = list.stimlist.currentindex
</list>

<list timeoutlist>
/ items = (500,1000,500,1000,
    500,1000,500,1000,
    500,1000,500,1000)
/ selectionmode = list.stimlist.currentindex
</list>

<values>
/ stim = 1
/ position = 1
/ timeout = 1
</values>

<trial mytrial>
/ ontrialbegin = [values.stim=list.stimlist.nextvalue;
    values.position=list.positionlist.nextvalue;
    values.timeout=list.timeoutlist.nextvalue;]
/ stimulusframes = [1=stimtext]
/ validresponse = (57)
/ timeout = values.timeout
</trial>

<text stimtext>
/ items = ("A", "B", "C")
/ select = values.stim
/ hposition = values.position
</text>

<block myblock>
/ trials = [1-12=mytrial]
</block>

This should hopefully give you some ideas on how to proceed.


Edited 10 Years Ago by Dave
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Reading This Topic

Explore
Messages
Mentions
Search