Easy way to calculate response bias with Python.


In signal detection theory d-prime index is used as sensitivity index, but the case is different combinations of hit rates and false alarm rates can lead to the same value d-prime index, which means d-prime captures only a part of signal detection space. So additional index known as RESPONSE BIAS is needed showing hit/miss tendecy or yes/no tendency.
In other words response bias determines whether someone tends to respond YES or NO more often. Responce bias is orthogonal or unrelated to d-prime because very different d-primes can be associated with the same bias.

The formula for response bias:
BIAS = – ( z(FA) - z(H) ) / 2

where z(H) is z-score for hits and z(FA) is z-score for false alarms.
hit rate H: proportion of YES trials to which subject responded YES = P("yes" | YES)
false alarm rate F: proportion of NO trials to which subject responded YES = P("yes" | NO)

BIAS=0 is considered as NO BIAS.
BIAS>0 is considered as tendency to say NO.
BIAS<0 is considered as tendency to say YES.



Simple example of d-prime calculation:



import numpy as np
import matplotlib.pyplot as plt
import scipy.stats as stats

# hit rates and false alarm rates
hitP = 22/30
faP  =  3/30

# z-scores
hitZ = stats.norm.ppf(hitP)
faZ  = stats.norm.ppf(faP)

# RESPONSE BIAS
respBias = -(hitZ+faZ)/2

print(respBias)

OUT: 0.32931292116725636




See also related topics: