ERP Averager
Add trials one at a time and watch the component emerge from the noise, then turn the same trials into the measurement error curve that answers "how many trials do I need?".
5 claims on this page are unverified. TODO(confirm) marks a specific statement the author has not yet checked against a
primary source. Everything else on this page has been reviewed. Treat a marked claim as
provisional and go to the cited source rather than quoting the sentence.
Modes: averager · sme — the widget below runs in averager. Use Share state to put the exact view in the URL.
What it does
About 200 single trials from one subject, two conditions, four channels, and a slider for N. In averager mode the widget averages the first N trials of the chosen condition and draws the result over the single trials, with the signal, the residual noise and the resulting signal-to-noise ratio computed from the data and printed underneath, next to the √N reference curve. In sme mode the same trials drive a bootstrap estimate of the standardized measurement error — the standard error of the measurement you would actually report — as a function of trial count, with an analytic reference for the linear measures and a read-out of the trials needed to reach a stated target.
Everything is computed in the browser from the stored trials, so a shared state reproduces the same numbers, and the shuffle is seeded.
Controls
| Control | What it sets |
|---|---|
| N | How many trials are averaged |
| Shuffle | Advances the seed of the trial order, so the same N draws a different subset |
| Condition | Which condition is averaged; the rarer one has fewer trials |
| Channel | Which channel the waveform panel and the measurements follow |
| Measurement window | The interval the amplitude and latency measures are taken over |
| Baseline / noise interval | The pre-stimulus interval used as the noise estimate |
| Polarity | Which extremum the peak measures take |
| Target SNR | (averager) the signal-to-noise ratio the “trials needed” read-out solves for |
| Measure | (sme) mean amplitude, peak amplitude or peak latency |
| Target SME | (sme) the measurement-error threshold the “minimum trials” read-out solves for |
| Bootstrap replicates | (sme) how many resamples the bootstrap SME uses |
| Single trials / SEM band / all-trials average | Which reference layers are drawn |
What to look for
averager
- At N = 1 the trial is mostly noise and the component is not visible. Raise N and the same deflection appears in the same place every time: averaging did not create it, it removed what was not time-locked to the event.
- The two numbers under the chart move differently. The signal settles early; the noise keeps falling. The signal-to-noise ratio rises because the noise falls, not because the response grows.
- Compare the measured curve with the dashed √N line. Four times the trials buys twice the ratio — so the cost of the next doubling is four times the recording time, and the “trials needed” read-out is that law solved for N.
- Press Shuffle at a fixed N: the path toward the average changes, the average does not. The average is a property of the trial set, not of the order.
- Switch condition. The rare condition has fewer trials, so its average is noisier although nothing about its component changed — an unequal trial count is a difference in measurement precision, not in brain response.
sme
- The SME curve falls as 1/√N: steep on the left, nearly flat on the right. Past a point, more trials buy very little.
- For mean amplitude the bootstrap curve sits on the analytic reference (the standard deviation of the single-trial measurements divided by √N). Switch to peak amplitude and the two separate, because the measurement of the average is not the average of the measurements.
- The “minimum trials” read-out answers the design question directly. Widen the measurement window and the answer falls — then ask what widening the window cost.
- Peak latency has a much larger SME than the amplitudes at small N, and it is the measure whose curve flattens last: a latency needs a peak that is already stable before it can be located.
- The SME is per subject and per condition. Two conditions with different trial counts have different SMEs in the same recording, which is why trial counts belong in a methods section.
Used in
- L3.2 The ERP and its components (
averager) - L3.5 SNR, trial counts and design (
sme)
Data provenance
ds-erpcore — ERP CORE (Kappenman et al., 2021), open access, per-subject downloadable. Biosemi ActiveTwo, 30 EEG + 3 EOG electrodes in a 10-20 placement scheme, 1024 Hz, CMS online reference, 60 Hz mains, no software filters, 40 participants per paradigm.
The shipped asset is sub-001’s P3 run: 200 single trials (40 target, 160 standard) at four channels (Pz, Cz, PO7, PO8), stored over −0.199 to 0.801 s and baseline-corrected to (−0.2, 0) s, with a per-trial, per-channel noise estimate — the standard deviation of that trial’s baseline-corrected pre-stimulus window in µV — which is what makes the SNR and SME read-outs computations rather than illustrations. Derived: FIR band-pass 0.1–40 Hz at the native rate, epoched, re-referenced offline to the average of P9 and P10 (the montage has no mastoid sites; P9/P10 are the nearest stand-in), resampled 1024 → 256 Hz. Generated by data/scripts/extract_p2_widgets.py; trials.json is both the widget index and the §4.5 sidecar of trials.bin, and the asset is registered in data/manifest.json. The frame’s provenance line is the authority.
The 40-to-160 trial split is the paradigm’s own: targets are rare by construction, which is exactly the imbalance L3.2 and L3.5 ask you to reason about.
TODO(confirm): the asset sidecar records a licence conflict in the source — the OSF node record for thsqg says CC BY 4.0, the per-paradigm component’s own LICENSE file says CC BY-SA 4.0, and its dataset_description.json says CC0. The site states CC BY 4.0 on the strength of the node record; the author reconciles the three (§10.11 item 8, §13 item 22) and mirrors the entry into data/registry.yaml. TODO(confirm): the dataset DOI and paper DOI are TODO(confirm) in data/directory.yaml. TODO(confirm): the reference used by the dataset’s own published processing pipeline is not recorded, so the P9/P10 stand-in is this site’s choice, not the dataset’s.
Open the code
site/src/components/widgets/w-erp-averager/ — Widget.svelte, index.ts, meta.ts, README.md. Repository link: TODO(confirm) (GitHub org/repo, §13 item 3).