sdt-metrics logo

Download

Current version: v 0.1.1.1

Get sdt_metrics from the Python Package Index, or install it with:

easy_install -U sdt_metrics

Browse the source code here

Follow on ohloh.net

Questions? Suggestions?

Send me an email at rogerlew@gmail.com

Alternatively you can also open an issue at the tracker.

Next topic

Installation Instructions

This Page

Welcome to the documentation for sdt_metrics!

Overview

Signal Detection Theory (SDT) has come to be an invaluable tool to psychology and other disciplines. The underlying theory suggests that a discriminator (albeit a human, machine classifier, or diagnostic test) detects the presence of a signal buried in noise. The performance of the discriminator is assessed in terms of sensitivity and response bias. Sensitivity describes how well the signal + noise distribution is segregated from the noise distribution. Response bias or decision bias describes systematic over-or-underestimates the probability of a true event.

This package provides a collection of metrics for assessing signal detection performance.

  • All the measures can be calculated from hit, miss, correct rejection, and false alarm counts
  • Many can be calculated from probabilities. Some would require knowing prevalence rate, which isn’t obtainable from just the hit and false alarm rates.
  • Unlike many online calculators the implementations here will provide a valid result across the entirety of ROC space

Installation

View the Installation Instructions

Usage Examples

Let’s cut to the chase

>>> from __future__ import division
>>> from sdt_metrics import dprime
>>> hi,mi,cr,fa = 121,42,56,34
>>> dprime(hi,mi,cr,fa)
0.9618717480344676

If given two arguments it’ll treat them as probabilities

>>> phi = hi/(hi+mi)
>>> pfa = fa/(cr+fa)
>>> dprime(phi, pfa)
0.9618717480344676

Functions also take list-like data

>>> dprime([.5, .6, .7],
           [.5, .5, .5])
[0.0, 0.2533471028599986, 0.5244005132792952]

sdt_metrics.SDT is a collections.Counter-like object for storing data

>>> from sdt_metrics import HI,MI,CR,FA, SDT
>>> sdt_obj = SDT(HI=73,FA=32)
>>> print(sdt_obj)
SDT(HI=73, MI=0, CR=0, FA=32)
>>>
>>> sdt_obj(MI) # add a miss
>>> print(sdt_obj)
SDT(HI=73, MI=1, CR=0, FA=32)
>>>
>>> sdt_obj[CR]+=5 # add 5 correct rejections
>>> print(sdt_obj)
SDT(HI=73, MI=1, CR=5, FA=32)
>>>
>>> sdt_obj.aprime() # metrics are methods of SDT
0.7558219178082192

Available Metrics

Parametric Metrics of Sensitivity

   
dprime d’
loglinear_dprime loglinear d’

Parametric Metrics of Response Bias

   
beta beta
c c
loglinear_beta loglinear beta
loglinear_c loglinear c

Nonparametric Metrics of Sensitivity

   
accuracy (1 + p(HI) - p(FA)) / 2
aprime A’: Pollack, I., Norman, D. A. (1964)
amzs Amzs: Zhang, J., and Mueller, S. T. (2005)

Nonparametric Metrics of Response Bias

   
b bar-napkin measure of bias: 0.5*p(HI) + 0.5p(FA)
bpp B’‘: Grier, J. B. (1971)
bph B’H: Hodos, W. (1970)
bppd B’‘D: Donaldson, W. (1992)
bmz Bmz: Zhang, J., and Mueller, S. T. (2005)
loglinear_bppd loglinear B’‘D

SDT Object

   
SDT Data structure for holding signal detection data

Plotting

   
poc_plot Probability of Occurence Curves (POC) Plot
roc_plot Receiver Operating Characteristics (ROC) Plot
mult_roc_plot Multiple ROC Curves Plot
metric_validation_plot pcolor plot of the metric over ROC space

Analyses

   
Sensitivity Scatter Matrix Scatter Matrix comparing dprime, aprime, amzs, accuracy
Probability Scatter Matrix Scatter Matrix comparing mcc, f1, mutual_info, accuracy
Bias Scatter Matrix Scatter Matrix comparing log(beta), c, bppd, loglinear_bppd, log(bmz)
Analysis of loglinear_bppd Addresses boundary sensitivity problems of bppd

Indices and tables