This vignette demonstrates a complete ERP analysis workflow using PhysioEEG.
# Peak amplitude measurement
peak <- eegERPmeasure(pe, window = c(250, 500), method = "peak",
polarity = "positive")
# Mean amplitude measurement (more robust to noise)
mean_amp <- eegERPmeasure(pe, window = c(250, 500), method = "mean",
polarity = "positive")
# Adaptive mean (window centered on peak)
adaptive <- eegERPmeasure(pe, window = c(250, 500), method = "adaptive_mean",
polarity = "positive")
print(data.frame(method = c("peak", "mean", "adaptive_mean"),
amplitude = c(peak$amplitude[1], mean_amp$amplitude[1],
adaptive$amplitude[1])))# For real data, apply ICA before epoching:
# 1. Run ICA on continuous data
# 2. Remove artifact components
# 3. Epoch the cleaned data
# 4. Average and measure ERPs
pe_continuous <- make_eeg(n_time = 10000, n_channels = 19, sr = 250)
pe_ica <- eegICA(pe_continuous, method = "fastica")
artifacts <- eegICAdetect(pe_ica, method = "kurtosis")
pe_clean <- eegICAremove(pe_ica,
components = artifacts$component[artifacts$type == "artifact"])