Helper functions for estimating the SSRT (stop signal reaction
time) in a Stop-Signal Task based on Verbruggen et al. (2019)
Estimate the stop-signal reaction time (SSRT) from stop-signal task data, following the recommendations of the consensus guide (Verbruggen et al., 2019).
sstFun provides three SSRT estimators and the mid-run estimate of the
stop-signal delay (SSD) for staircase (tracking) designs. It validates its
input, warns about non-conventional combinations of methods, and ships a
simulated data set with known latent variables for testing and teaching.
# development version (2.0.0, work in progress)
pak::pak("sonntasa/sstFun")
# CRAN release (1.0.0)
install.packages("sstFun")
Upgrading from 1.0.0? Version 2.0.0 renames arguments and output columns and changes some defaults, so estimates can differ from earlier versions. See NEWS.md for a migration guide.
SSRT is estimated as a go RT minus an SSD estimate:
| Function | Go RT | SSD | Notes |
|---|---|---|---|
meanSSRT() |
mean go RT | mean SSD | Only appropriate when p(respond | signal) is close to .5 |
intSSRT() |
nth go RT, where n = p(respond | signal) × number of go RTs | mean SSD | Integration method; recommended by the consensus guide |
medSSRT() |
median go RT | mid-run SSD | |
mid_run_avg() |
– | mid-run SSD estimate | Used by the estimators; can be called directly |
Integration method. intSSRT() estimates the SSRT from the go RT
distribution and the probability of responding on stop trials. At
p(respond | signal) = .5 the nth RT is the median go RT, so the result
agrees with the mean method only if the go RT distribution is symmetric. With
skewed RTs the two differ.
SSD estimation. The SSD can be the mean of all SSDs or, more suited to
staircase paradigms, the mid-run estimate: the average of the midpoints of
every second run between reversals of the staircase (see Levitt, 1971;
Wetherill & Levitt, 1965). mid_run_avg() assumes one continuous staircase per
participant and rows in trial order.
Slow and missing go RTs. By default (replace_slow = TRUE), go omissions
and go RTs slower than rt_max (default 600 ms) are replaced by the
participant's slowest valid go RT, as recommended in the consensus guide. Turning
this off is possible, but discouraged for the integration and median methods,
and the package warns.
One row per trial, in trial order within each participant. The defaults expect these columns; other names can be passed unquoted (see below).
| Column | Content |
|---|---|
id |
participant identifier |
trial_type |
"go" or "stop" |
ssd |
stop-signal delay in ms; NA on go trials |
rt |
reaction time in ms; NA if there was no response |
corr |
logical. Go trials: TRUE if the participant responded (FALSE is an omission). Stop trials: TRUE if the response was inhibited, so FALSE means the participant responded |
The package includes sst_example, simulated data from 12 participants (true
mean SSRT = 220 ms).
library(sstFun)
meanSSRT(sst_example)
intSSRT(sst_example)
medSSRT(sst_example)
mid_run_avg(sst_example)
Each function returns one row per participant. Use return_full = TRUE to see
the components of the estimate:
intSSRT(sst_example, return_full = TRUE)
Screen participants whose p(respond | signal) is far from .5. The consensus
guide recommends excluding them (e.g. below 25 % or above 75 %), and
p_resp is returned as a percentage:
subset(intSSRT(sst_example, return_full = TRUE), p_resp < 25 | p_resp > 75)
intSSRT(
my_data,
participant = pid, trial_type = cond, corr = acc, ssd = delay, rt = rt_ms,
trial_labels = c(stop = "Stop", go = "Go")
)
trial_labels is a named character vector with elements go and stop.
| Argument | Effect |
|---|---|
rt_max |
go RTs slower than this value (ms) count as slow |
replace_slow |
replace slow and missing go RTs (default TRUE) |
mid_run |
use the mid-run SSD estimate (default: the conventional choice for each method) |
err_exc |
meanSSRT() only: exclude incorrect go trials |
return_full |
return all components of the estimate |
every_second |
mid_run_avg(): use every second run (default) or all runs |
The package warns when a method is combined with an SSD estimate it is not conventionally used with, or when slow-trial replacement is switched off. These combinations are provided for methodological comparison.
sst_example also includes the simulated latent variables go_rt and
ssrt_true, which are not observable in real data but allow the accuracy of
the estimators to be checked, per participant and per trial. go_rt is not
an observed RT; always pass rt to the estimators.
# compare estimates with each participant's realised mean stop latency
truth <- aggregate(
ssrt_true ~ id,
data = subset(sst_example, trial_type == "stop"),
FUN = mean
)
merge(intSSRT(sst_example), truth, by = "id")
See ?sst_example for details.
If you use this package, please cite it (citation("sstFun")) and the consensus
guide.
Levitt, H. (1971). Transformed up-down methods in psychoacoustics. The Journal of the Acoustical Society of America, 49(2B), 467–477.
Verbruggen, F., Aron, A. R., Band, G. P., Beste, C., Bissett, P. G., Brockett, A. T., ... Boehler, C. N. (2019). A consensus guide to capturing the ability to inhibit actions and impulsive behaviors in the stop-signal task. eLife, 8, e46323.
Wetherill, G. B., & Levitt, H. (1965). Sequential estimation of points on a psychometric function. British Journal of Mathematical and Statistical Psychology, 18(1), 1–10.