<div dir="ltr"><span><span><span id="ctl03_ctlTopic"><span id="ctl03_ctlTopic_ctlPanelBar"><span id="ctl03_ctlTopic_ctlPanelBar_ctlTopicsRepeater_ctl04_lblFullMessage">As
E-Prime (to my knowledge as of posting) doesn't currently have a median
summation ability, like it does for min,max,mean,etc. I had to come up
with code to get E-Prime to return median reaction times for doing an
FRN experiment. The paradigm was to use the median of the subject RTs
for the first block of a task rest of the task to use as criteria for
showing RT error feedback. I thought I would share the code I came up
with to assist those (like in these E-Prime forum threads:<a href="http://www.pstnet.com/forum/Topic3559-5-1.aspx?Highlight=median" target="_"blank"" class="SmlLinks">http://www.pstnet.com/forum/Topic3559-5-1.aspx?Highlight=median </a> and <a href="http://www.pstnet.com/forum/Topic3559-5-1.aspx?Highlight=median" target="_"blank"" class="SmlLinks"> http://www.pstnet.com/forum/Topic3559-5-1.aspx?Highlight=median</a>) who want E-Prime to return medians in real-time in a general fashion that can be otherwise adapted or referenced.<br>
<br>
First for the user script global variables:<br>
<br>
'placed in user script tab<br>
dim mediancount as integer<br>
public medianrt() as integer<br>
dim median as integer<br>
<br>
"mediancount" is just the counter for populating the array of
medianrt(). Though the task I did had 40 trials, I'll keep the
dimensions undefined in case there are non-responses (so it doesn't skew
the median, since E-Prime records non-responses as 0), and use the
redim command to keep the array flexible with the following algorithm:<br>
<br>
'placed in inline object after stimulus object which recorded response<br>
IF Stimulus.RT <> 0 then<br>
mediancount = mediancount + 1<br>
redim preserve medianrt (mediancount)<br>
medianrt(mediancount) = Stimulus.RT<br>
END IF <br>
<br>
Obviously you can change the criteria after IF to anything you want to
be included in the array, which gets redefined after each addition. Then
I had another inline placed after the block but before the rest of the
blocks for the rest of the trial which actually gets us the median, like
so:<br>
<br>
'placed in inline object after block of trials that would have the median RT<br>
ArraySort medianrt<br>
IF mediancount mod 2 = 0 then<br>
median = (medianrt(mediancount/2) + medianrt((mediancount/2) + 1))/2<br>
ELSE<br>
median = medianrt((mediancount/2) + .5)<br>
END IF <br>
<br>
'if you want to confirm the median, testing it against the EDAT file if
you find the median by yourself in an Excel spreadsheet or something to
double check it<br>
debug.print median<br>
<br>
This puts the whole array (which has the stimulus RTs) into numerical
order with the command ArraySort (which turns gray, by the way), then I
use the mod (which turns blue) operation algorithim to determine the median. The mod,
short for modulation, is the remainder after division, so if there's
all 40 trials, an even number, 40/2 goes into 10 with 0 left over, so
E-Prime will take the mean between the 20th and 21st members to return
the median, which here is the integer "median". If there's odd, that's
easy, we know that since integers can only be even numbers there will be
.5 left over, and the algorithm will just make E-Prime find the middle
number and return that value labeled in the array to be our median,
which we can then reference and manipulate all we want, so to complete
the goal I had for the experimental paradigm, using the median RT to
lower stimulus duration I could just do:<br>
<br>
'placed in an inline object before the rest of the task hierarchy procedure<br>
c.SetAttrib "StimulusDur", .9*median<br>
<br>
and then I could just use [StimulusDur] in the duration field for the
next stimulus slides, or use it in the recording responses field. This
attribute and all the variables can of course be changed to anything
that makes sense to you and works within your experiment. For mine I
actually had "practrialcount" and "stimdur" instead of "mediancount" and
"median", but it should work all the same.<br>
<br>
Hope this
helps anyone out who needs the median like I did. I haven't done a
time-audit to see how intensive this is on the computer, since for my
task construction that wasn't really necessary, but I anticipate that
this would be pretty negligible on most hardware. Let me know if I
should post my task so it makes more sense in context. <br>
</span></span></span></span></span></div>
<p></p>
-- <br />
You received this message because you are subscribed to the Google Groups "E-Prime" group.<br />
To unsubscribe from this group and stop receiving emails from it, send an email to e-prime+unsubscribe@googlegroups.com.<br />
To post to this group, send email to e-prime@googlegroups.com.<br />
To view this discussion on the web visit <a href="https://groups.google.com/d/msgid/e-prime/3713ee0b-b9df-4005-8075-176a6eb41b4d%40googlegroups.com">https://groups.google.com/d/msgid/e-prime/3713ee0b-b9df-4005-8075-176a6eb41b4d%40googlegroups.com</a>.<br />
For more options, visit <a href="https://groups.google.com/groups/opt_out">https://groups.google.com/groups/opt_out</a>.<br />