PhysioEEG PhysioEEG logo

EEG Analysis Functions for PhysioExperiment Objects

PhysioEEG provides 79 exported functions covering the full electroencephalography analysis pipeline. Built on top of PhysioCore, it supports preprocessing, independent component analysis (ICA), event-related potential (ERP) extraction and measurement, source localization, microstate analysis, sleep staging, brain-computer interface (BCI) feature extraction, clinical EEG analysis, time-frequency decomposition, connectivity analysis, and publication-quality visualization -- all operating directly on PhysioExperiment objects.

Installation

You can install PhysioEEG from r-universe:

# the containers build on Bioconductor, so its repositories are needed too
install.packages("BiocManager", repos = "https://cloud.r-project.org")
install.packages("PhysioEEG",
  repos = c("https://x-biosignal.r-universe.dev", BiocManager::repositories()))

Or install the development version from GitHub:

# install.packages("remotes", repos = "https://cloud.r-project.org")
remotes::install_github("x-biosignal/PhysioEEG")

Quick Start

library(PhysioEEG)

# Continuous EEG: run the preprocessing pipeline (filter, bad channels, re-reference)
raw <- make_eeg(n_time = 2500, n_channels = 19, sr = 250)
clean <- eegPreprocess(raw, lowcut = 1, highcut = 40, verbose = FALSE)

# Epoched EEG with embedded ERP components: detect and measure the P300
pe <- make_eeg_erp(n_epochs = 40, n_channels = 19, sr = 250)
components <- eegERPdetect(pe, component = "P300")
measures <- eegERPmeasure(pe, window = c(0.25, 0.5))

# Inspect the detected component (peak amplitude and latency per channel)
components
measures

# Plotting helpers -- eegPlotERP(), eegPlotTopomap(), eegPlotButterflyGFP(),
# eegPlotSpectrogram() -- render these results and require the optional
# ggplot2 package.

Features

Preprocessing Pipeline

A complete, configurable preprocessing pipeline from raw recordings to analysis-ready data:

Independent Component Analysis (ICA)

Blind source separation for artifact removal and source identification:

Event-Related Potential (ERP) Analysis

End-to-end ERP component extraction, measurement, and statistical testing:

Source Localization

Estimate the cortical sources underlying scalp EEG:

eegPlotGlassBrain() requires finite three-dimensional source coordinates; it never turns a bare amplitude vector into anatomical positions. Its shared type-8 threshold is computed from absolute amplitude before projection. Source-estimate orientation components are reduced by root-sum-square within time and RMS across time. The bundled outline is a schematic display frame, not MRI registration, patient anatomy, or validation of the inverse solution.

Microstate Analysis

Characterize the temporal dynamics of global brain states:

Sleep Staging and Event Detection

Automated sleep analysis following AASM guidelines:

Brain-Computer Interface (BCI) Features

Feature extraction and classification for BCI paradigms:

Clinical EEG

Functions for clinical neurophysiology and QEEG:

Time-Frequency Analysis

Spectral decomposition with multiple methods:

eegPlotSpectrogram() keeps numeric power unchanged when a mask is supplied: non-selected bins are dimmed with display alpha and logical boundaries are drawn without interpolating the mask. Logical masks and p-value matrices must match the complete pre-filter time and frequency axes exactly. Cluster masks require repeated, independent and exchangeable observations; the correction is for the maximum sign-separated four-neighbour cluster mass, so a corrected cluster is not bin-wise or mechanistic evidence.

Connectivity Analysis

Functional and effective connectivity between EEG channels:

Visualization

Publication-quality plots for every analysis stage:

Simulated Data Generators

Ready-to-use data for testing, demonstration, and teaching:

Dependencies

PhysioExperiment Ecosystem

PhysioEEG is the EEG analysis layer of the PhysioExperiment ecosystem, a suite of R packages for multi-modal physiological signal analysis:

Package Description
PhysioCore Core data structures and accessors
PhysioIO File I/O (EDF, HDF5, BIDS, CSV, MAT)
PhysioPreprocess Preprocessing (filters, ICA, resampling)
PhysioAnalysis Analysis and visualization
PhysioEEG EEG analysis (ICA, ERP, source, BCI, sleep)
PhysioEMG EMG analysis (synergy, fatigue, onset)
PhysioECG ECG and HRV analysis

Visit the r-universe page to browse all available packages.

License

MIT License. See LICENSE for details.

Author

Yusuke Matsui

Governance & support

Part of the Physio ecosystem. Community and policy documents live in the umbrella repository: