Site icon R-bloggers

Compute Signal Detection Theory Indices with R

[This article was first published on Dominique Makowski, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

Signal Detection Theory Indices (dprime, beta…)

Signal detection theory (SDT) is used when psychologists want to measure the way we make decisions under conditions of uncertainty. SDT assumes that the decision maker is not a passive receiver of information, but an active decision-maker who makes difficult perceptual judgments under conditions of uncertainty. To apply signal detection theory to a data set where stimuli were either present or absent, and the observer categorized each trial as having the stimulus present or absent, the trials are sorted into one of four categories: Hit, Miss, Correct Rejection and False Alarm.

Based on the proportions of these types of trials, we can compute indices of sensitivity and response bias:

To compute them with psycho, simply run the following:

library(psycho)

# Let's simulate three participants with different results at a perceptual detection task
df <- data.frame(Participant = c("A", "B", "C"),
                 n_hit = c(1, 2, 5),
                 n_fa = c(1, 3, 5), 
                 n_miss = c(6, 8, 1),
                 n_cr = c(4, 8, 9))

indices <- psycho::dprime(df$n_hit, df$n_fa, df$n_miss, df$n_cr)
df <- cbind(df, indices)
Participant n_hit n_fa n_miss n_cr dprime beta aprime bppd c
A 1 1 6 4 -0.1925836 0.8518485 0.5000000 0.9459459 0.8326077
B 2 3 8 8 -0.1981923 0.8735807 0.4106061 0.8285714 0.6819377
C 5 5 1 9 0.9952151 0.8827453 0.5000000 -0.9230769 -0.1253182

To leave a comment for the author, please follow the link and comment on their blog: Dominique Makowski.

R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.