Chapter 7 Appendix

7.1 Wagenmakers SDT script

Use the script below to process the data file so that the dataset structure is the same as shown in our SDT example. A zipped folder containing the dataset from Wagenmakers et al. (2008) can be found at this link. As shown in our script below, the data is stored in the "PropData.txt" file.

#~~~~~~~~~~~~~~~~~~~~ Wagenmakers 2008 Lexical decision task ~~~~~~~~~~~~~~~~~~~~~~~~~~~#

# 1) subject = participant number
# 2) block = block number
# 3) practice = 1 if practice block, otherwise 0
# 4) cond = condition either "2" for 75% words or "1" for 75% nonwords)
# 5) stimulus = unique identifier of stimulus, stimuli are nested in frequency conditions
# 6) freq = Code "1" means "high frequency word", code "2" means "low frequency word",
#    and code "3" means "very low frequency word". Codes 4, 5, and 6 = "nonword".
# 7) resp =  0 is nonword, 1 is word, -1 is not interpretable response (i.e., pushed a button,
#         but not the right one and also not the one next to the right button)
# 8) rt = response time in seconds
# 9) censor = 1 if value is eliminated from further analysis;
#       practice block, uninterpretable response, too fast response (<180 ms), too slow response (>3 sec)

rm(list=ls())
require(tidyverse)

wagenmakers2008 <- read.delim("PropData.txt",
                              header = FALSE)

names(wagenmakers2008) <- c("subject","block","practice",
                            "cond","stimulus","freq","resp","rt",
                            "censor")

wagenmakers2008 <- wagenmakers2008[wagenmakers2008$censor!=1,-c(3,9)]

wagenmakers2008$subject <- factor(wagenmakers2008$subject)

wagenmakers2008$cond <- factor(wagenmakers2008$cond,
                     labels = c("nw","w"))

wagenmakers2008$stimulus <- wagenmakers2008$freq < 4

wagenmakers2008$stimulus <- factor(wagenmakers2008$stimulus,
                     labels = c("nw", "w"))

wagenmakers2008$resp <- factor(wagenmakers2008$resp,
                     labels = c("NW","W"))

wagenmakers2008$freq <- ((wagenmakers2008$freq-1) %% 3)+1

wagenmakers2008$freq <- factor(wagenmakers2008$freq,
                  labels = c("hf","lf","vlf"))

wagenmakers2008$correct <- toupper(wagenmakers2008$stimulus) == 
  toupper(wagenmakers2008$resp)

wagenmakers2008$W <- as.character(wagenmakers2008$freq)

wagenmakers2008$W[wagenmakers2008$stimulus == "nw"] <- "nw"

wagenmakers2008$W <- factor(wagenmakers2008$W,
                  c("hf","lf","vlf","nw"))

wagenmakers2008 <- select(.data = wagenmakers2008,
                          subject,
                          cond,
                          W,
                          resp,
                          rt,
                          correct) %>%
  rename(stimulus = W)

wagenmakers2008$correct <- if_else(wagenmakers2008$correct,
                                   true = "2",
                                   false = "1")
save(wagenmakers2008,
     file = "wagenmakers2008.RData")

References

Wagenmakers, Eric-Jan, Roger Ratcliff, Pablo Gomez, and Gail McKoon. 2008. “A Diffusion Model Account of Criterion Shifts in the Lexical Decision Task.” Journal of Memory and Language 58 (1): 140–59.