Skip to contents

Convenience wrapper over eegICLabel() that returns the indices of the components most likely to be artifacts, ready to pass to eegICAremove(). A component is flagged when its probability in any of the requested artifact classes exceeds prob_threshold.

Usage

eegICLabelFlag(
  x,
  prob_threshold = 0.5,
  classes = c("muscle", "eye", "heart", "line_noise", "channel_noise"),
  ica_assay = "ica_components",
  line_freq = 50
)

Arguments

x

A PhysioExperiment object with ICA results (from eegICA()).

prob_threshold

Probability above which a component is flagged (default: 0.5).

classes

Character vector of artifact classes to flag (default: all non-brain, non-other classes).

ica_assay

Metadata name holding the component activations (default: "ica_components").

line_freq

Mains line frequency in Hz (default: 50).

Value

An integer vector of flagged component indices (possibly empty), with an attribute "labels" giving the corresponding class of each.

Examples

if (FALSE) { # \dontrun{
pe <- make_eeg(n_time = 5000, sr = 500)
pe <- eegICA(pe, n_components = 10, method = "fastica")
bad <- eegICLabelFlag(pe, prob_threshold = 0.5)
pe <- eegICAremove(pe, components = bad)
} # }