expyfun.analyze.dprime#

expyfun.analyze.dprime(hmfc, zero_correction=True, return_bias=False, two_interval=False)[source]#

Estimate d′ and bias.

Parameters:
hmfcarray-like

Hits, misses, false-alarms, and correct-rejections, in that order, as array-like data with last dimension having size 4.

zero_correctionbool

Whether to add a correction factor of 0.5 to each category to prevent division-by-zero leading to infinite d-prime values.

return_biasbool

If True, also return the bias.

two_intervalbool

If True, apply a correction factor for two-interval two-alternative forced choice paradigms (see Notes).

Returns:
dparray-like

Array of dprimes with shape hmfc.shape[:-1].

biasarray-like

Array of bias values with shape hmfc.shape[:-1]. Only returned if return_bias=True.

Notes

The traditional d′ is given by:

Z(hit_rate) - Z(false_alarm_rate)

And the bias:

-(Z(hit_rate) + Z(false_alarm_rate)) / 2.

where Z is the inverse of the cumulative distribution function for a standard normal distribution (AKA the percent point function). For two- interval two-alternative forced-choice tasks, Macmillan & Creelman [1] recommend modifying the d′ calculation to account for the presentation of two stimuli per trial (one in each interval) by dividing by sqrt(2):

(Z(hit_rate) - Z(false_alarm_rate)) / sqrt(2)

References

[1]

Macmillan & Creelman (2005). Detection theory: a user’s guide (2nd ed.). Mahwah, NJ: Lawrence Erlbaum Associates, pp. 166-170.

Examples using expyfun.analyze.dprime#

Analysis demo

Analysis demo