{"_id":"@cyberpsychjs/experiment-stop-signal","_rev":"2-ad64c3a173258527d4db176518854fce","name":"@cyberpsychjs/experiment-stop-signal","dist-tags":{"latest":"0.1.5"},"versions":{"0.1.0":{"name":"@cyberpsychjs/experiment-stop-signal","version":"0.1.0","_id":"@cyberpsychjs/experiment-stop-signal@0.1.0","maintainers":[{"name":"hejtmy","email":"hejtmy@gmail.com"}],"dist":{"shasum":"8dce50dabafca3c78291bf34ba456f03361c33ba","tarball":"https://registry.npmjs.org/@cyberpsychjs/experiment-stop-signal/-/experiment-stop-signal-0.1.0.tgz","fileCount":14,"integrity":"sha512-IZA/0pUaSAbNFybP9ZcER0PJlQtUxOiUS0fBRl3BITCxy2bMmgKUI/FmU6iv+EvkMdGwHg50HMTrDwX8eR0OZg==","signatures":[{"sig":"MEUCIHYi0OKFW0+0xijvFq8wKDbUjwRsLC9Qh0OstissjFUxAiEAio3Nzss/Wolp6ylqsH9hLwIN7DC01JjbSrbXZW9bpCk=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":94511},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"gitHead":"9020394e3fbf7812c7dbcae0aad2edba684c43b8","scripts":{"build":"tsc -b"},"_npmUser":{"name":"hejtmy","email":"hejtmy@gmail.com"},"_npmVersion":"11.10.1","directories":{},"_nodeVersion":"25.7.0","dependencies":{"@cyberpsychjs/common":"^0.1.0","@cyberpsychjs/shared":"^0.1.0","@jspsych/plugin-instructions":"^2.1.0","@jspsych/plugin-html-keyboard-response":"^2.1.0"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/experiment-stop-signal_0.1.0_1773855647568_0.40653745782117223","host":"s3://npm-registry-packages-npm-production"}},"0.1.5":{"name":"@cyberpsychjs/experiment-stop-signal","version":"0.1.5","type":"module","main":"./dist/index.js","types":"./dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"scripts":{"build":"tsc -b"},"dependencies":{"@jspsych/plugin-html-keyboard-response":"^2.1.0","@jspsych/plugin-instructions":"^2.1.0","@cyberpsychjs/common":"^0.1.0","@cyberpsychjs/shared":"^0.1.0"},"gitHead":"d7ee02d6f01b4021b2a3e625b7f59b1cc883ff49","_id":"@cyberpsychjs/experiment-stop-signal@0.1.5","description":"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","_nodeVersion":"25.9.0","_npmVersion":"11.12.1","dist":{"integrity":"sha512-zyB9zBI48bAxsyAhKnFqUZuzovexOBWFyGIWvjwLJQgXs2kkpXJWafQKSzyH2lQprkBSRELRcaeQAG+WzLS4yg==","shasum":"ead204dae9e70d4578554d0a29027b1f85ab40cf","tarball":"https://registry.npmjs.org/@cyberpsychjs/experiment-stop-signal/-/experiment-stop-signal-0.1.5.tgz","fileCount":15,"unpackedSize":105529,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCIFL9YimmlCLQ+ndjNTHdch+LHNJGLUU+tRgoQQ/gBFicAiAfsj86duUMQUGou8uKF+C/1Sncg8OFstwMP/OA1NQ4yg=="}]},"_npmUser":{"name":"hejtmy","email":"hejtmy@gmail.com"},"directories":{},"maintainers":[{"name":"hejtmy","email":"hejtmy@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/experiment-stop-signal_0.1.5_1778498697597_0.6315359973584163"},"_hasShrinkwrap":false}},"time":{"created":"2026-03-18T17:40:47.436Z","modified":"2026-05-11T11:24:57.882Z","0.1.0":"2026-03-18T17:40:47.716Z","0.1.5":"2026-05-11T11:24:57.738Z"},"maintainers":[{"name":"hejtmy","email":"hejtmy@gmail.com"}],"readme":"# `@cyberpsychjs/experiment-stop-signal`\n\nA jsPsych implementation of the **Stop-Signal Task (SST)**, used to measure\nresponse inhibition. The participant performs a two-choice reaction-time\ntask (left/right arrow) and must withhold the response on a minority of\ntrials when a stop signal is presented.\n\nThe implementation and analysis follow the consensus recommendations in:\n\n> Verbruggen, F., Aron, A. R., Band, G. P. H., Beste, C., Bissett, P. G.,\n> Brockett, A. T., … Boehler, C. N. (2019). *A consensus guide to capturing\n> the ability to inhibit actions and impulsive behaviors in the stop-signal\n> task.* eLife, 8, e46323. <https://doi.org/10.7554/eLife.46323>\n\n## Task design\n\n- **Go trials** (~75%): an arrow appears (← or →); respond with the matching\n  arrow key as fast and accurately as possible.\n- **Stop trials** (~25%): the arrow appears, then after a *stop-signal delay*\n  (SSD) a red overlay (✕ + \"STOP\") appears on top of the arrow. The\n  participant should withhold their response.\n- **Practice phase** with trial-level feedback, followed by a **test phase**\n  without feedback.\n\n### Adaptive SSD (1-up / 1-down staircase)\n\nThe SSD is updated trial-by-trial in [`stimuli.ts`](src/stimuli.ts):\n\n- **Successful stop** (no response) → SSD **increases** by `ssdStep` (the\n  task gets harder).\n- **Any response on a stop trial** (whether before or after the stop signal)\n  → SSD **decreases** by `ssdStep`.\n\nNote that the staircase reacts to *any* response, including responses that\narrive before the stop signal was presented. This is intentional: if a\nparticipant is fast enough that they routinely beat the stop signal, the\nonly way to push the SSD down toward their RT is to treat those fast\nresponses as a signal that the SSD is currently too long. Excluding them\nfrom the staircase update would let the SSD drift away from the\nparticipant's reaction window.\n\nThe Verbruggen consensus paper notes that pre-signal responses should be\n**excluded from analysis** of inhibition (see below) but is silent on the\nstaircase update rule itself. This package adopts the more aggressive\nupdate rule for tracking responsiveness and compensates in the analysis.\n\nThe SSD is clamped to `[minSSD, maxSSD]` and resets to `initialSSD` between\nthe practice and test phases.\n\n## Settings\n\nDefined in [`config.ts`](src/config.ts).\n\n| Setting | Default | Notes |\n| --- | --- | --- |\n| `numTestTrials` | 64 | ~25% are stop trials. Verbruggen et al. recommend **≥40 stop trials** for a stable SSRT; consider increasing for research use. |\n| `numPracticeTrials` | 16 | |\n| `goStimDuration` | 1000 ms | Maximum response window on every trial. |\n| `initialSSD` | 250 ms | |\n| `ssdStep` | 50 ms | Staircase step. |\n| `minSSD` / `maxSSD` | 50 / 500 ms | Should remain comfortably below `goStimDuration`. |\n| `fixationDuration` | 500 ms | |\n| `showFeedback` | true | Practice-phase feedback only. |\n\n## Per-trial data fields\n\nSet in [`stimuli.ts`](src/stimuli.ts):\n\n| Field | Meaning |\n| --- | --- |\n| `trial_type_custom` | `'go'` or `'stop'`. |\n| `ssd` | The SSD that was actually used on this stop trial. |\n| `response_deadline` | The go-stimulus duration (max RT). Used to impute omissions in the integration method. |\n| `respond` | Boolean: any key was pressed during the trial. |\n| `responded_before_stop_signal` | Stop trial only. The participant pressed before the stop signal appeared. |\n| `responded_after_stop_signal` | Stop trial only. The participant pressed after the stop signal appeared (= true failed inhibition). |\n| `signal_respond` | Stop trial only. Equals `responded_after_stop_signal`. This is the field consumed by the analysis when computing P(respond \\| signal). |\n| `stopped_successfully` | Stop trial only. The signal was presented and the participant did not respond. |\n| `correct` | Go trial: matched the cued direction. Stop trial: stopped successfully OR responded before the stop signal. |\n| `omission` | Go trial only. No response within the deadline. |\n| `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. |\n\n## Analysis\n\nImplemented in [`analysis.ts`](src/analysis.ts). All analyses operate on\ntest-phase trials only.\n\n### Trial subsets\n\n- **All stop trials**: every stop trial in the test phase.\n- **Signal-presented stop trials**: stop trials excluding those where the\n  participant responded *before* the stop signal appeared. This is the\n  subset used for SSRT estimation, per Verbruggen et al. (2019, p. 11).\n\n### P(respond | signal)\n\n```\nP(respond | signal) = N(failed_stop_after_signal) / N(signal-presented stops)\n```\n\nA well-calibrated 1-up/1-down staircase converges this probability toward\n**0.5**. Values far from 0.5 indicate the staircase has not converged and\nthe SSRT estimate should be interpreted with caution.\n\n### Stop Success Rate (descriptive)\n\n```\nStop success rate = N(stopped_successfully) / N(all stop trials)\n```\n\nReported separately from P(respond | signal). This is the figure that\nmatches what the staircase is tracking, since the staircase updates on\nevery stop trial.\n\n### Mean SSD\n\nMean of the `ssd` field over **signal-presented stop trials only**. This\nmean SSD is the one used in the SSRT formulas below.\n\n### SSRT — Integration method (primary)\n\nThis is the recommended primary estimate (Verbruggen et al., 2019).\n\n1. Build the go-RT distribution from all go trials:\n   - For trials with a response: include the RT (correct **and**\n     choice-error responses).\n   - For omissions: impute the response deadline (`response_deadline`).\n2. Sort the distribution ascending.\n3. Take the *n*-th RT, where *n* = `round(P(respond | signal) × N_go)`.\n4. `SSRT_integration = nth_RT − mean_SSD`, clamped at 0.\n\n### SSRT — Mean method (secondary)\n\n```\nSSRT_mean = mean(go RTs of responded go trials) − mean_SSD\n```\n\nIncludes correct responses and choice errors but **excludes omissions**\n(per Verbruggen et al., 2019). Reported as a sanity check; the integration\nmethod is preferred when P(respond | signal) is far from 0.5.\n\n### Why pre-signal responses are excluded from SSRT\n\nA response that arrives before the stop signal is presented is, by\ndefinition, not a failure to inhibit — there was nothing yet to inhibit.\nIncluding such trials in P(respond | signal) inflates the numerator and\nbiases the integration-method nth-RT toward the upper tail of the go\ndistribution, producing an SSRT that is too large. The consensus paper\nexplicitly recommends excluding these trials from analysis.\n\nThey are still **counted and reported** as `Failed Stops Before Cue` so\nthat practitioners can detect participants who were systematically\nbeating the staircase.\n\n## Practical recommendations\n\n- For research use, increase `numTestTrials` so that there are at least\n  **40 signal-presented stop trials** in the test phase.\n- Inspect `P(respond | signal)` before trusting an SSRT estimate. If it is\n  outside roughly 40–60%, the staircase did not converge.\n- If `Failed Stops Before Cue` is large, the participant is systematically\n  responding before the stop signal — consider increasing `goStimDuration`\n  or instructing the participant to balance speed and accuracy more\n  carefully.\n- A high `Go Omission Rate` (>10%) is a sign the participant is strategically\n  waiting for the stop signal; this violates the independence assumption\n  underlying SSRT.\n","readmeFilename":"README.md","description":"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"}