# Help: d-prime?

**URL:** <https://psychtoolbox.discourse.group/t/help-d-prime/1141>\
**Category:** Uncategorized\
**Created:** [April 24, 2002, 3:57pm UTC](https://psychtoolbox.discourse.group/t/help-d-prime/1141 "2002-04-24T15:57:41Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Allen\_Ingling](https://avatars.discourse-cdn.com/v4/letter/a/a183cd/32.png) [@Allen\_Ingling](https://psychtoolbox.discourse.group/u/Allen_Ingling)\
**Post date:** [April 24, 2002, 3:57pm UTC](https://psychtoolbox.discourse.group/t/help-d-prime/1141/1 "2002-04-24T15:57:41Z")

</div>

Hi. Can someone tell me whether the Psych Toolbox contains any functions   
for computing d-prime (the sensitivity measure)? Thanks.  
  
-- Dave  
  
  
  
\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
David Fass [dfass@...](mailto:dfass@...)  
Visual Cognition Laboratory  
Rutgers Center for Cognitive Science  
[http://ruccs.rutgers.edu/~dfass/](http://ruccs.rutgers.edu/~dfass/)  
\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*

---

<div class="post-metadata">

**Author:** ![Allen\_Ingling](https://avatars.discourse-cdn.com/v4/letter/a/a183cd/32.png) [@Allen\_Ingling](https://psychtoolbox.discourse.group/u/Allen_Ingling)\
**Post date:** [April 24, 2002, 7:09pm UTC](https://psychtoolbox.discourse.group/t/help-d-prime/1141/2 "2002-04-24T19:09:07Z")

</div>

Hi Dave,  
  
I've created a function for this, and the code is below.  
  
I hope you find it helpful.  
  
:-)  
  
Nestor   
  
  
  
\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
Nestor Matthews, Ph.D.  
Assistant Professor  
Department of Psychology  
Denison University  
100 South Road  
Knapp Hall, Room 505A  
Granville, OH 43023 USA  
Phone: (740) 587-5782  
Fax: (740) 587-5675  
E-mail: [matthewsn@...](mailto:matthewsn@...)  
[http://www.denison.edu/psych/profbios/matthews.shtml](http://www.denison.edu/psych/profbios/matthews.shtml)  
And  
[http://www.denison.edu/~matthewsn/index.html](http://www.denison.edu/~matthewsn/index.html)  
\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
  
Here is the function's code  
  
  
function d=dPrimeCalculation(proportionOfHits, proportionOfFAs)  
%DPPRIMECALCULATION takes in the proportion of hits, and the  
%proportion of False alarms, then returns the d' value.  
%We assume that the mean is zero, and the S.D. is .5  
%However, in the variables below, these parameters can be changed.  
%Normalcy and Equal Variance are assumed here.  
%Also, we return a -99 if any of the input values are 0 or 1.  
  
%Reference: Equation 3.1 on page 68 of George A. Geshider's  
%Psychophysics Method and Theory, 1976. Lawrence Earlbaum Associates,  
Publishers.  
%Distrbuted by the Halsted Press Division of John Wiley and Sons.  
  
if proportionOfHits~=0 & proportionOfHits~=1 & proportionOfFAs~=0 &  
proportionOfFAs~=1  
  
  
 %The d' calculation can be made since all values are between 0 and 1,  
exclusive.  
 mean = 0; %Mean of the gaussian distribution on which the calc is  
made.  
 stDev = .5; %StDeviation of the gaussian distribution on which the  
calc is made.  
  
 zHits = norminv(proportionOfHits, mean, stDev);  
 zFalseAlarms = norminv(proportionOfFAs, mean, stDev);  
 d = zHits - zFalseAlarms;  
  
else  
  
 d=-99; %The d' calculation cannot be made since at least one value  
is a 0 or a 1.  
 %This is dummy value is returned just to avoid a divide=by-zero  
error.  
end  
  
  
  

> On 4/24/02 8:57 AM, "David Fass" \<[dfass@...](mailto:dfass@...)\> wrote:  
>    
> \>   
> \> Hi. Can someone tell me whether the Psych Toolbox contains any functions  
> \> for computing d-prime (the sensitivity measure)? Thanks.  
> \>   
> \> -- Dave  
> \>   
> \>   
> \>   
> \> \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
> \> David Fass [dfass@...](mailto:dfass@...)  
> \> Visual Cognition Laboratory  
> \> Rutgers Center for Cognitive Science  
> \> [http://ruccs.rutgers.edu/~dfass/](http://ruccs.rutgers.edu/~dfass/)  
> \> \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
> \>   
> \>   
> \>   
> \> [http://psychtoolbox.org](http://psychtoolbox.org)  
> \> POST a message to: [psychtoolbox@yahoogroups.com](mailto:psychtoolbox@yahoogroups.com)  
> \> UNSUBSCRIBE by sending a blank message to:  
> \> [psychtoolbox-unsubscribe@yahoogroups.com](mailto:psychtoolbox-unsubscribe@yahoogroups.com)  
> \>   
> \> Your use of Yahoo! Groups is subject to [http://docs.yahoo.com/info/terms/](http://docs.yahoo.com/info/terms/)  
> \>   
> \>

---

<div class="post-metadata">

**Author:** ![charlesacollin](https://avatars.discourse-cdn.com/v4/letter/c/5daacb/32.png) [@charlesacollin](https://psychtoolbox.discourse.group/u/charlesacollin)\
**Post date:** [April 24, 2002, 5:13pm UTC](https://psychtoolbox.discourse.group/t/help-d-prime/1141/3 "2002-04-24T17:13:27Z")

</div>

> \> Hi Dave,  
> \>   
> \> I've created a function for this, and the code is below.  
> \>   
> \> function d=dPrimeCalculation(proportionOfHits, proportionOfFAs)  
> \> %DPPRIMECALCULATION takes in the proportion of hits, and the  
> \> %proportion of False alarms, then returns the d' value.

Hi Nestor,  
  
My (limited) understanding of d' is that one must change how one  
calculates the value depending on the methodology one used in gathering  
the data (McMillan & Creelman, 1991). What methodology are you assuming  
with your function?   
  
Charles.
