Fisher discrimation index (d-prime)

Author

Oliver

1 Fisher discrimination index (d-prime, \(d'\))

Fisher discrimination index or d-prime (\(d'\)) is defined (Macmillan and Creelman 1991) for a binary classifier as the difference between hit-rate and the false alarm rate. This can be computed in R using the user-defined dprime_from_conf_mat() function.

The mathematical definition of \(d'\) is

\[ d' = z(\text{hit rate}) -z(\text{False alarm rate}) \tag{1}\]

2 dprime_from_conf_mat() function

The function determines \(d'\) from a given confusion matrix. Essentially, the function computes the d-prime according to Equation 1. See Section 3 for more of how to use this function.

In the function, the case of perfect accuracy (or infinite d-prime) is avoided by making use of adjusting 0 or 1 ( of either hit tate/false alarm rates) to \(\frac{1}{2N}\) and \(1-\frac{1}{2N}\), receptively. This is just one type of adjustment. For other possible adjustments, please refer to page 8 of the book by Macmillan and Creelman (1991).

dprime_from_conf_mat<-function(Cmat){ 

HITS=Cmat[1,1]
FA=Cmat[1,2]
MISS=Cmat[2,1]
CR=Cmat[2,2]

cat('Hits: ', HITS ,'\n')
cat('Miss: ', MISS ,'\n')
cat('False Alarm: ', FA ,'\n')
cat('Correct Rejection: ', CR ,'\n')

HITrate=HITS/(HITS+MISS)
FArate=FA/(FA+CR)

cat('Hit Rate = ', HITrate , '\n')
cat('False Alarm Rate = ', FArate , '\n')

N=HITS+MISS

# Adjust for 0 or 1 values of hit and misses by (1/(2*N)) or 1- (1/(2N)), resp.

if (HITrate==0){
  HITrate=1/(2*N)
} else if (HITrate==1){
  HITrate=1-(1/(2*N))
} 

if (FArate==0){
  FArate=1/(2*N)
} else if (FArate==1){
  FArate= 1-(1/(2*N))
} 

dprime= qnorm(HITrate,0,1)-qnorm(FArate,0,1) 
cat('d-prime =', dprime , '\n')
return(dprime) 
} 

3 Examples

3.1 Example 1:

As an first example, let us consider the confusion matrix from page 8 of (Macmillan and Creelman 1991):

\[ \begin{bmatrix} 25 & 10 \\ 0 & 15 \end{bmatrix} \]

mat<- array(c(25,0,10,15),dim=c(2,2))
dprime_from_conf_mat(mat)
Hits:  25 
Miss:  0 
False Alarm:  10 
Correct Rejection:  15 
Hit Rate =  1 
False Alarm Rate =  0.4 
d-prime = 2.307096 
[1] 2.307096

3.2 Example 2 (perfect classification)

Let us consider the confusion matrix that corresponds to perfect classification

\[ \begin{bmatrix} 100 & 0 \\ 0 & 100 \end{bmatrix} \]

in which case the \(d'\) is

mat<- array(c(100,0,0,100),dim=c(2,2))
dprime_from_conf_mat(mat)
Hits:  100 
Miss:  0 
False Alarm:  0 
Correct Rejection:  100 
Hit Rate =  1 
False Alarm Rate =  0 
d-prime = 5.151659 
[1] 5.151659

References

Macmillan, Neil A., and C. Douglas Creelman. 1991. Detection Theory: A User’s Guide. Cambridge [England] ; New York: Cambridge University Press.