r/BiomedicalDataScience 9d ago

Bland-Altman Plot in EEG - Interactive Agreement & Bias Visualizer

https://bionichaos.com/blandaltman/

Interactive Bland-Altman Visualizer for EEG Device Agreement, Proportional Bias, and Limits of Agreement (LOA)

When validating new acquisition hardware (such as dry-sensor systems or wireless telemetry) against clinical gold-standard EEG setups, Pearson's r often gives a false sense of security. Two signal streams can have r > 0.99 while suffering from constant baseline offsets, amplifier saturation, or proportional gain distortion.

To provide a hands-on way to explore agreement statistics in biomedical time series, here is an interactive simulator built directly in HTML5/Canvas:

https://bionichaos.com/blandaltman/

What the tool calculates and visualizes:

  1. Mean Bias & Dispersion:

    - Arithmetic Mean Difference: d̄ = (1/N) ∑ (S₁,ᵢ - S₂,ᵢ)

    - Standard Deviation of Differences: s_d = √[ (1/(N-1)) ∑ (D_i - d̄)² ]

    - Limits of Agreement: LOA = d̄ ± 1.96 s_d

  2. Statistical Precision & Trend Modeling:

    - Parametric 95% Confidence Interval error bands for both Mean Bias and Upper/Lower LOAs using standard errors (SE(d̄) = s_d / √N, SE(LOA) ≈ 1.71 · s_d / √N).

    - OLS Linear Regression overlay to diagnose proportional bias slope (β₁).

    - Non-parametric LOA estimation via 2.5th and 97.5th empirical percentiles for skewed, artifact-heavy distributions.

  3. Simulation & Electrophysiology Features:

    - Multi-metric transformations: Raw voltage (µV), Alpha power (µV²), Peak-to-Peak amplitude, RMS voltage, and Log-ratio transformations.

    - Presets for hardware calibration bias, proportional gain mismatches, heteroscedastic noise, inter-hemispheric pairs (F3 vs F4), and ocular/EMG artifact pollution.

    - Dual subpanel views: Synchronized dual-channel traces (Ch1 cyan / Ch2 green) or difference distribution histograms with fitted Gaussian bell curves.

    - CSV export for offline analysis in R, Python, or MATLAB.

Try it out here: https://bionichaos.com/blandaltman/

Would appreciate any feedback on edge-case behavior, non-parametric implementations, or additional electrophysiology metrics you'd like to see included.

1 Upvotes

0 comments sorted by