PhysioEEG provides comprehensive EEG analysis functions for PhysioExperiment objects. This vignette shows a quick tour of the main features.
PhysioEEG includes test data generators for quick exploration:
Decompose EEG into independent components and remove artifacts:
# Run ICA
pe <- eegICA(pe, n_components = 19, method = "fastica")
# Detect artifact components automatically
artifacts <- eegICAdetect(pe, method = "kurtosis")
print(artifacts)
# Remove artifact components
artifact_idx <- artifacts$component[artifacts$type == "artifact"]
pe_clean <- eegICAremove(pe, components = artifact_idx)Detect and measure event-related potentials in epoched data:
Compute band power across all channels:
Segment EEG into discrete microstates:
Motor imagery classification with CSP:
pe_bci <- make_eeg_bci(n_trials = 30, n_channels = 8, sr = 256)
labels <- metadata(pe_bci)$labels
# Extract CSP features
pe_csp <- eegCSP(pe_bci, labels = labels, n_filters = 3)
# Classify
features <- eegBCIfeatures(pe_bci, method = "bandpower")
results <- eegBCIclassify(pe_bci, features = features, labels = labels)
print(paste("Accuracy:", mean(results$predicted_class == labels)))Automatic sleep staging and event detection:
Spike detection, QEEG, and slowing assessment:
pe <- make_eeg(n_time = 5000, n_channels = 19, sr = 500)
# Detect EEG slowing
slowing <- eegSlowing(pe, method = "dtar")
print(slowing)
# Frontal alpha asymmetry
asym <- eegAsymmetry(pe)
print(asym)
# Burst-suppression detection
bs <- eegSuppression(pe, threshold = 10)
print(paste("BSR:", attr(bs, "bsr"), "%"))