EEG Preprocessing Protocol Guideline
EEG Preprocessing Protocol Guideline
• The time series data can be temporally shifted during analyses the
decision of what to use as time 0 event will not necessarily limit your
analyses
7.3. Creating Epochs
Buffer Zone
• How much time to include before and after time = 0
• Depends on the experiment
• What type of analyses you want to perform
• At least as long as the duration of the trial
• Select the first N trials from each condition, where N is the number of
trials in the smallest conditions;
• Not necessary
• Compare different groups of subjects (patient vs. control)
• Correlate the EEG results across subjects with a behavioral variable
related to trial count
• Report this in method section + behavioral results before and after
trials selection
7.5. Filtering
• Remove high-frequency artifacts and low-frequency drifts
• High-pass filter
• Useful and recommended attenuate slow drifts
• Should be applied only to continuous data not epoched data
(due to edge artifact lasting longer than your epoch)
• Most time-frequency methods apply set of temporal filters
• Wavelet convolution
• FFT
• Filter-Hilbert
7.6. Trial Rejection
• There is a true brain signal recorded by the electrode, but lot of noise
• Apply low-pass filter at 30hz (low frequency signal from that electrode
look similar to surrounding electrode)
7.10. Start With clean data
7.10. Start With clean data
• There is no substitute for clean data
• Preprocessing will turn good data to a very good data, but no amount
of preprocessing will turn low-quality and noisy data into very good
data
Preprocessing Pipelines Using EEGLAB
Approach I
To install EEGLAB:
1. Download latest version: http://sccn.ucsd.edu/eeglab/currentversion/eeglab_current.zip
2. Unzip folder into “Documents\MATLAB\”
for specific versions, see: https://sccn.ucsd.edu/eeglab/downloadtoolbox.php
To install ERPLAB:
3. Download latest version:
https://github.com/lucklab/erplab/releases/download/7.0.0/erplab7.0.0.zip
4. Unzip folder into “Documents\MATLAB\eeglab2019_0\plugins\”
for specific versions, see: https://github.com/lucklab/erplab/releases
EEGLAB and ERPLAB
• In the EEGLAB menu bar, select File > Memory and other options
Uncheck "If set, keep at most one dataset in memory".
• Select the
file S1_EEG.set and
click the Open button.
View the EEG data for the file you just loaded
• Result of the ICA is set of weights for all the electrodes, and the
weighted sum of all the electrode activities is some independent
course.
• Each component has one time course and N electrodes
• For instance a 64-channel electrode:
• Each comp has 64 weights take the weighted sum activity of all
electrodes a single time course
• Each component Has 64 weights and one time course
ICA Concept
• It is best to use ICA to identify the noise and subtract the noise from
the signal.
• ICA is sometimes not very accurate to separate the noise from signal
• It is also important to take into account how much the component is
accounting for the variance in the data.
ICA Decomposition using EEGLAB interface in MATLAB
Participant 1001
In a glance
• Reference to mastoid
• electrode 65 and 66: EXG1 and EXG2
• High-pass: 0.1-0.20
• Low-pass: 30 HZ
Change Sampling rate
• This is because the ICA fills in artifactual data with data that would be
probably based on the other data remaining.
• you can always go back after the ICA, if you are having difficulty, and see
if removing any more epochs would help the process.
• To delete the marked epochs,
select Tools Reject data
epochs Reject Marked
epochs
Run ICA
• Now, that you have carefully preprocessed your data, you are ready to run ICA.
• Make sure you take your preprocessing steps carefully, because, if you needed to
change something, you have to re-run the ICA
• After you press Ok, you will see a series of “steps” being calculated in
the Matlab command window. Thus takes some time, depending on
the data, and will usually work its way up to approximately step 300
• Before checking the ICA components map, look at characteristic patterns
in your data:
• Tools Reject data epochs Reject by inspection (you are not going to be
rejecting anything here – just inspecting)
• When you see a blink, right click on that point. You will see a map of what
that pattern looks like. You can click Edit Copy Figure and paste the
image into a word document, to remind yourself later.
• You can do this same thing for other notable ocular artifacts. For other
types, you’ll want to be sure to specify for yourself what each figure
referred to, in case you are making a decision later (e.g., “small ocular
blip”, “end of a blink”, “artifact in a few ocular electrodes”)
Running ICA Decompositions
• function binica() calls the (1.5x faster) binary version (a separate download)
translated into C from runica() by Sigurd Enghoff.
• ICA works best when given a large amount of basically similar and
mostly clean data.
• When the number of channels (N) is large (>>32) then a very large
amount of data may be required to find N components.
• When insufficient data are available, then using the 'pca' option to
jader.m to find fewer than N components may be the only good
option.
• Important note: If run twice on the same data, ICA decompositions
under runica/binica will differ slightly.
• That is, the ordering, scalp topography and activity time courses of best-
matching components may appear slightly different.
• This is because ICA decomposition starts with a random weight matrix (and
randomly shuffles the data order in each training step), so the convergence
is slightly different every time.
• For fairly clean data focus on only on the oculars on first pass
Plot component spectra and map
• What frequency are you interested to look at
• What comp at that frequency has the highest power
Plot ICA ERPs
• How ERPs look like for different components
• How one component with its all channels contributes to overall ERP
• IC back-projection envelop
• Check the data to see how it turned out after removing those
components:
• Tools Reject data epochs Reject by inspection (you are not going to be
rejecting anything here – just inspecting)
• Look through the data to check that blinks and major ocular artifacts were
removed, and that the data does not otherwise look more wonky.
After removing ICA components (focused on ocular artifacts):
• Automatic Rejection vs. Rejection with Improbable data (i.e. the later
one is the technique that is used by queen’s folks)
Automatic rejection
• Click OK
• File “Save current dataset
Creating Categories
• Working from the baseline-corrected data file, click Edit “Select epochs
or events”
• In the “category” section, type in one of your category labels (e.g., NPM
or PPM)
• Check off “keep only selected events and remove all others”
• Click OK. It will ask if you are okay with it rejecting/deleting the remaining
number of trials – select OK/yes again.
• Re-name your new dataset , and select “save it as a file” to save the file in
your folder as well. Select OK.
• Repeat for each of your stimulus categories.
Final Notes:
• In general, we want to have at least 20 trials per category.
• Fewer than 15 trials is too few (amplitudes will be high and the data will
be noisy). Between 15-20 trials is an iffy range.
• If you have any stimuli in this range (which you likely will), you can look at
the participant’s ERPs to have an idea of their data quality. To do so, load
that participant’s data in EEGlab. Then go Plot Channel ERPs In
scalp/rect. Array
• You can also always do this on your data files that are averaged across
the stimulus categories, just to check on the overall quality of the waves
with more trials.
• Also, once the data is in matlab, we will average across participants and
can look at the waveforms that way.
Resources
• https://www.youtube.com/watch?v=JOvhHSEt-ZU