npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@cyberpsychjs/experiment-stop-signal

v0.1.5

Published

A jsPsych implementation of the **Stop-Signal Task (SST)**, used to measure response inhibition. The participant performs a two-choice reaction-time task (left/right arrow) and must withhold the response on a minority of trials when a stop signal is prese

Readme

@cyberpsychjs/experiment-stop-signal

A jsPsych implementation of the Stop-Signal Task (SST), used to measure response inhibition. The participant performs a two-choice reaction-time task (left/right arrow) and must withhold the response on a minority of trials when a stop signal is presented.

The implementation and analysis follow the consensus recommendations in:

Verbruggen, F., Aron, A. R., Band, G. P. H., 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. https://doi.org/10.7554/eLife.46323

Task design

  • Go trials (~75%): an arrow appears (← or →); respond with the matching arrow key as fast and accurately as possible.
  • Stop trials (~25%): the arrow appears, then after a stop-signal delay (SSD) a red overlay (✕ + "STOP") appears on top of the arrow. The participant should withhold their response.
  • Practice phase with trial-level feedback, followed by a test phase without feedback.

Adaptive SSD (1-up / 1-down staircase)

The SSD is updated trial-by-trial in stimuli.ts:

  • Successful stop (no response) → SSD increases by ssdStep (the task gets harder).
  • Any response on a stop trial (whether before or after the stop signal) → SSD decreases by ssdStep.

Note that the staircase reacts to any response, including responses that arrive before the stop signal was presented. This is intentional: if a participant is fast enough that they routinely beat the stop signal, the only way to push the SSD down toward their RT is to treat those fast responses as a signal that the SSD is currently too long. Excluding them from the staircase update would let the SSD drift away from the participant's reaction window.

The Verbruggen consensus paper notes that pre-signal responses should be excluded from analysis of inhibition (see below) but is silent on the staircase update rule itself. This package adopts the more aggressive update rule for tracking responsiveness and compensates in the analysis.

The SSD is clamped to [minSSD, maxSSD] and resets to initialSSD between the practice and test phases.

Settings

Defined in config.ts.

| Setting | Default | Notes | | --- | --- | --- | | numTestTrials | 64 | ~25% are stop trials. Verbruggen et al. recommend ≥40 stop trials for a stable SSRT; consider increasing for research use. | | numPracticeTrials | 16 | | | goStimDuration | 1000 ms | Maximum response window on every trial. | | initialSSD | 250 ms | | | ssdStep | 50 ms | Staircase step. | | minSSD / maxSSD | 50 / 500 ms | Should remain comfortably below goStimDuration. | | fixationDuration | 500 ms | | | showFeedback | true | Practice-phase feedback only. |

Per-trial data fields

Set in stimuli.ts:

| Field | Meaning | | --- | --- | | trial_type_custom | 'go' or 'stop'. | | ssd | The SSD that was actually used on this stop trial. | | response_deadline | The go-stimulus duration (max RT). Used to impute omissions in the integration method. | | respond | Boolean: any key was pressed during the trial. | | responded_before_stop_signal | Stop trial only. The participant pressed before the stop signal appeared. | | responded_after_stop_signal | Stop trial only. The participant pressed after the stop signal appeared (= true failed inhibition). | | signal_respond | Stop trial only. Equals responded_after_stop_signal. This is the field consumed by the analysis when computing P(respond | signal). | | stopped_successfully | Stop trial only. The signal was presented and the participant did not respond. | | correct | Go trial: matched the cued direction. Stop trial: stopped successfully OR responded before the stop signal. | | omission | Go trial only. No response within the deadline. | | response_classification | One of correct-go, incorrect-go, omission-go, successful-stop, failed-stop-pre-signal, failed-stop-post-signal. Used by the practice-phase feedback display. |

Analysis

Implemented in analysis.ts. All analyses operate on test-phase trials only.

Trial subsets

  • All stop trials: every stop trial in the test phase.
  • Signal-presented stop trials: stop trials excluding those where the participant responded before the stop signal appeared. This is the subset used for SSRT estimation, per Verbruggen et al. (2019, p. 11).

P(respond | signal)

P(respond | signal) = N(failed_stop_after_signal) / N(signal-presented stops)

A well-calibrated 1-up/1-down staircase converges this probability toward 0.5. Values far from 0.5 indicate the staircase has not converged and the SSRT estimate should be interpreted with caution.

Stop Success Rate (descriptive)

Stop success rate = N(stopped_successfully) / N(all stop trials)

Reported separately from P(respond | signal). This is the figure that matches what the staircase is tracking, since the staircase updates on every stop trial.

Mean SSD

Mean of the ssd field over signal-presented stop trials only. This mean SSD is the one used in the SSRT formulas below.

SSRT — Integration method (primary)

This is the recommended primary estimate (Verbruggen et al., 2019).

  1. Build the go-RT distribution from all go trials:
    • For trials with a response: include the RT (correct and choice-error responses).
    • For omissions: impute the response deadline (response_deadline).
  2. Sort the distribution ascending.
  3. Take the n-th RT, where n = round(P(respond | signal) × N_go).
  4. SSRT_integration = nth_RT − mean_SSD, clamped at 0.

SSRT — Mean method (secondary)

SSRT_mean = mean(go RTs of responded go trials) − mean_SSD

Includes correct responses and choice errors but excludes omissions (per Verbruggen et al., 2019). Reported as a sanity check; the integration method is preferred when P(respond | signal) is far from 0.5.

Why pre-signal responses are excluded from SSRT

A response that arrives before the stop signal is presented is, by definition, not a failure to inhibit — there was nothing yet to inhibit. Including such trials in P(respond | signal) inflates the numerator and biases the integration-method nth-RT toward the upper tail of the go distribution, producing an SSRT that is too large. The consensus paper explicitly recommends excluding these trials from analysis.

They are still counted and reported as Failed Stops Before Cue so that practitioners can detect participants who were systematically beating the staircase.

Practical recommendations

  • For research use, increase numTestTrials so that there are at least 40 signal-presented stop trials in the test phase.
  • Inspect P(respond | signal) before trusting an SSRT estimate. If it is outside roughly 40–60%, the staircase did not converge.
  • If Failed Stops Before Cue is large, the participant is systematically responding before the stop signal — consider increasing goStimDuration or instructing the participant to balance speed and accuracy more carefully.
  • A high Go Omission Rate (>10%) is a sign the participant is strategically waiting for the stop signal; this violates the independence assumption underlying SSRT.