Statistical functions with E-Basic?

Alex Francis francisa at purdue.edu
Wed Mar 16 18:26:04 UTC 2005


I've had a couple requests for the eprime code I use to calculate d' - here
is the important part. Please note, the Excel equation I posted recently
did not contain the whole story - I forgot that there are two steps to the
equation.  The following eprime code is taken directly from an inline
object, and does what it says (calculates d'as z(H)-z(FA))

This code appears in an inline object at the top level of the script, after
all the trials have been run.  Just before the "goodbye" screen (that also
displays the results of these calculations).

-----------------------

'This code was written by Courtney Driscoll and Alex Francis, Purdue University
'based on equations in Macmillan and Creelman (1991)

'Note - global variables avhr and avfa track average hit rate and false
alarm rate
'across multiple blocks of trials

dim tmp as double
dim zhr as double
dim zfa as double
dim dprime as double

'set up a dummy variable so we don't have to keep repeating this
tmp = Sqr(-2*Log(avhr))

'calculate z of Hit Rate using dummy variable
zhr = -1 * tmp + ((((0.0000453642210148 * tmp + 0.0204231210245) * tmp +
0.342242088547) * tmp + 1) * tmp + 0.322232431088) / ((((0.0038560700634 * tmp
+ 0.10353775285) * tmp + 0.531103462366) * tmp + 0.588581570495) * tmp +
0.099348462606)

'store the z transformation value of HR for later display
c.SetAttrib "ZofHR", Format(zhr, "0.000000")

'reset temporary variable
tmp = 0

'Now repeat for FA rate
'set up dummy variable again
tmp = Sqr(-2*Log(avfa))

'same ugly equation, one more time
zfa = -1 * tmp + ((((0.0000453642210148 * tmp + 0.0204231210245) * tmp +
0.342242088547) * tmp + 1) * tmp + 0.322232431088) / ((((0.0038560700634 * tmp
+ 0.10353775285) * tmp + 0.531103462366) * tmp + 0.588581570495) * tmp +
0.099348462606)

'store z transformation of FA for later display
c.SetAttrib "ZofFA", Format(zfa, "0.000000")

'now calculate dprime
dprime = zhr - zfa

'store dprime value for later display
c.SetAttrib "DPrime", Format(dprime, "0.000000")

'display everything in debug window
debug.print "--------------------------------"
Debug.print "zhr= " & zhr
Debug.print "zfa= " & zfa
Debug.print "dprime= " & dprime

-------------------------


   Alexander L. Francis        http://web.ics.purdue.edu/~francisa
   Assistant Professor                          francisA at purdue.edu
   Speech, Language & Hearing Sciences       ofc. +1 (765) 494-3815
   Purdue University                         lab. +1 (765) 494-7553
   500 Oval Drive                            fax. +1 (765) 494-0771
   West Lafayette IN 47907-2038
   USA
------------my employer requires the following addendum------------
CONFIDENTIALITY NOTICE: This email and the documents accompanying
this email may contain legally privileged confidential information.
The information is intended only for the use of the individual or
entity named as recipient. If you are not the intended recipient,
you are hereby notified that any disclosure, reproduction or
distribution of this email or its attachments, or the taking of any
action in reliance on the contents of this email or its attachments,
is strictly prohibited. If you have received this email in error,
please notify the sender by return email.



More information about the Eprime mailing list