| Version: | 1.0.0 |
| Date: | 2026-10-28 |
| 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>. |
| Maintainer: | Samuel Sonntag <samuel.sonntag@uni-tuebingen.de> |
| License: | MIT + file LICENSE |
| RoxygenNote: | 7.3.3 |
| Encoding: | UTF-8 |
| Depends: | R (≥ 4.1.0) |
| Imports: | cli, dplyr, utils, rlang |
| URL: | https://github.com/sonntasa/sstFun |
| NeedsCompilation: | no |
| Packaged: | 2026-10-29 11:53:08 UTC; sonntaghimself |
| Author: | Samuel Sonntag |
| Repository: | CRAN |
| Date/Publication: | 2026-11-14 08:00:02 UTC |
Integration Method of computing the SSRT
Description
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).
Usage
intSSRT(
dat,
participant = id,
trial_type = trial_type,
corr = corr,
ssd = ssd,
rt = rt,
replace_slow = TRUE,
RTmax = 600,
mid_run = TRUE
)
Arguments
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 |
Value
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.
Examples
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
)
Mean Estimation of the SSRT
Description
Estimates the SSRT with the mean method: mean go RT minus the mean SSD. This assumes that p(response | signal) = 0.5.
Usage
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
)
Arguments
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 |
Value
a dataframe with one row per participant: meanRT, meanSSD,
mid_run_estimate, n_runs and SSRT.
Examples
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
)
mid-run average estimation of the SSD
Description
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.
Usage
mid_run_avg(
dat,
participant = id,
trial_type = trial_type,
ssd = ssd,
stop_value = "stop",
every_second = TRUE
)
Arguments
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 |
Value
a dataframe containing an estimate of the SSD and the number of runs used to calculate the SSD
Examples
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)