| Title: | Estimating Stop Signal Reaction Times and Stop Signal Delay |
|---|---|
| Description: | Helper functions for estimating the SSRT (stop signal reaction time) in a Stop-Signal Task based on Verbruggen et al. (2019) <doi:10.7554/eLife.46323> and a mid-run estimates method for computing the mean SSD (stop signal delay) based on Levitt (1971) <doi:10.1121/1.1912375>. |
| Authors: | Samuel Sonntag [cre, aut] (ORCID: <https://orcid.org/0009-0006-7270-7242>), Carolin Dudschig [aut] (ORCID: <https://orcid.org/0000-0002-7041-7798>), Ian G Mackenzie [aut] (ORCID: <https://orcid.org/0000-0001-8950-9601>) |
| Maintainer: | Samuel Sonntag <[email protected]> |
| License: | MIT + file LICENSE |
| Version: | 1.0.0 |
| Built: | 2026-11-14 12:07:41 UTC |
| Source: | https://github.com/sonntasa/sstfun |
utilises the RT distribution of go trials in a Stop-Signal task to estimate the Stop-Signal Reaction Time using the distribution of go-trials (with replacement of go-omissions) and the probability of giving a response when a signal is present for each participant (see Verbruggen et al., 2019).
intSSRT( dat, participant = id, trial_type = trial_type, corr = corr, ssd = ssd, rt = rt, replace_slow = TRUE, RTmax = 600, mid_run = TRUE )intSSRT( dat, participant = id, trial_type = trial_type, corr = corr, ssd = ssd, rt = rt, replace_slow = TRUE, RTmax = 600, mid_run = TRUE )
dat |
a dataframe containing id number, rt, accuracy, the conditions and stop-signal delays |
participant |
Name of the column containing the personal identifier. |
trial_type |
the column that reflects the current trial type (stop vs. go) |
corr |
boolean that reflects whether the current trial is Correct |
ssd |
Name of the column containing the current stop signal delay |
rt |
Reaction times |
replace_slow |
boolean that indicates whether slow values should be replaced with the slowest correct RT, to correct distribution (see Verbruggen et al., 2019) |
RTmax |
maximum RT boundary to determine slow responses |
mid_run |
boolean whether the mid-run average should be used to compute the SSD |
a dataframe containing the id, an estimate of the SSRT, nth reaction time, used to compute the SSRT, the mean Stop Signal delay, the p(response | signal), the mid-run estimate of the SSD, the number of runs that went into the estimation of the SSD and the estimated SSRT.
set.seed(1) dat <- data.frame( id = 1, trial_type = rep(c("go", "stop"), c(60, 20)), corr = c(rep(TRUE, 60), rep(c(TRUE, FALSE), 10)), ssd = c(rep(NA, 60), rep(c(100, 150, 200, 150), 5)), rt = c(round(rnorm(60, 500, 80)), rep(NA, 20)) ) intSSRT(dat, participant = id, trial_type = trial_type, corr = corr, ssd = ssd, rt = rt, mid_run = FALSE )set.seed(1) dat <- data.frame( id = 1, trial_type = rep(c("go", "stop"), c(60, 20)), corr = c(rep(TRUE, 60), rep(c(TRUE, FALSE), 10)), ssd = c(rep(NA, 60), rep(c(100, 150, 200, 150), 5)), rt = c(round(rnorm(60, 500, 80)), rep(NA, 20)) ) intSSRT(dat, participant = id, trial_type = trial_type, corr = corr, ssd = ssd, rt = rt, mid_run = FALSE )
Estimates the SSRT with the mean method: mean go RT minus the mean SSD. This assumes that p(response | signal) = 0.5.
meanSSRT( dat, participant = id, trial_type = trial_type, corr = corr, ssd = ssd, rt = rt, RTexc = FALSE, RTrep = FALSE, ErrExc = FALSE, RTmin = 100, RTmax = 600, mid_run = TRUE )meanSSRT( dat, participant = id, trial_type = trial_type, corr = corr, ssd = ssd, rt = rt, RTexc = FALSE, RTrep = FALSE, ErrExc = FALSE, RTmin = 100, RTmax = 600, mid_run = TRUE )
dat |
a dataframe with one row per trial. |
participant |
column containing the participant identifier. |
trial_type |
column containing the trial type ("go" vs. "stop"). |
corr |
logical column, |
ssd |
column containing the stop-signal delay. |
rt |
column containing the reaction times. |
RTexc |
logical; if |
RTrep |
logical; if |
ErrExc |
logical; if |
RTmin, RTmax
|
bounds of the RT window used when |
mid_run |
logical; if |
a dataframe with one row per participant: meanRT, meanSSD,
mid_run_estimate, n_runs and SSRT.
set.seed(1) dat <- data.frame( id = 1, trial_type = rep(c("go", "stop"), c(60, 20)), corr = c(rep(TRUE, 60), rep(c(TRUE, FALSE), 10)), ssd = c(rep(NA, 60), rep(c(100, 150, 200, 150), 5)), rt = c(round(rnorm(60, 500, 80)), rep(NA, 20)) ) meanSSRT(dat, participant = id, trial_type = trial_type, corr = corr, ssd = ssd, rt = rt )set.seed(1) dat <- data.frame( id = 1, trial_type = rep(c("go", "stop"), c(60, 20)), corr = c(rep(TRUE, 60), rep(c(TRUE, FALSE), 10)), ssd = c(rep(NA, 60), rep(c(100, 150, 200, 150), 5)), rt = c(round(rnorm(60, 500, 80)), rep(NA, 20)) ) meanSSRT(dat, participant = id, trial_type = trial_type, corr = corr, ssd = ssd, rt = rt )
Estimates the SSD with the mid-run estimates method (Levitt, 1971; Wetherill & Levitt, 1965). To this end, the average mid-point of every second run is used (per participant) to compute the average SSD.
mid_run_avg( dat, participant = id, trial_type = trial_type, ssd = ssd, stop_value = "stop", every_second = TRUE )mid_run_avg( dat, participant = id, trial_type = trial_type, ssd = ssd, stop_value = "stop", every_second = TRUE )
dat |
a dataframe containing id, ssd, trial_type |
participant |
Name of the column containing the participant identifier. |
trial_type |
the column that reflects the current trial type (stop vs. go) |
ssd |
Name of the column containing the current stop signal delay |
stop_value |
prevents silent failing, coding of stop trials |
every_second |
boolean use every second run or use all (full) runs |
a dataframe containing an estimate of the SSD and the number of runs used to calculate the SSD
dat <- data.frame( id = 1, trial_type = "stop", ssd = rep(c(100, 150, 200, 150, 100), 10) ) mid_run_avg(dat, participant = id, trial_type = trial_type, ssd = ssd) mid_run_avg(dat, participant = id, trial_type = trial_type, ssd = ssd, every_second = FALSE)dat <- data.frame( id = 1, trial_type = "stop", ssd = rep(c(100, 150, 200, 150, 100), 10) ) mid_run_avg(dat, participant = id, trial_type = trial_type, ssd = ssd) mid_run_avg(dat, participant = id, trial_type = trial_type, ssd = ssd, every_second = FALSE)