1. Analyses of EEG data
Theory and Practice
Rachele Pezzetta & Quentin Moreau
AgliotiLab
Quentin Moreau, PhD
2. Summary
Part I. History, Recording, Preparing an EEG experiment
Part II. Preprocessing Theory and Good Practice
Part III. Hands-On session with FT, Preprocessing Pipeline and ERP
Part IV. Time-Frequency Theory and Good Practice
Part V. Hands-On session with FT – TFs
Part VI. Source Analysis, Theory and Hands On
Part VII. Connectivity analysis, Theory and Hands On
5. EEG: Pros and Cons
Baig et al. 2019
In Cognitive Neuroscience,
EEG together with MEG is
the non invasive
technique with the highest
temporal resolution.
But its spatial resolution is
poor and the activity
recorded is only cortical.
7. Recording EEG data
Computer recording
EEG
Computer delivering
stimuli
The two computers are synchronized through a wire that sends triggers
from computer that delivers the stimuli to the computer that records the
EEG. Thus, we may know when events occurred during the EEG
recording.
8. EEG montage
- 16, 32, 64, 128, 256, 512 electrodes… They all belong to the same
International System 10-20
- This system ensures consistent placement (independent of the head
size) and naming of the electrodes
- The "10" and "20" refer to the fact that the actual distances between
adjacent electrodes are either 10% or 20% of the total front–back or
right–left distance of the skull.
9. Ground Electrode
The ground is used for “common mode” rejection. The
primary purpose of the ground is to prevent power line
noise from interfering with the small biopotential signals
of interest for cancelling out the electrical noise in the
system. A ground electrode for EEG recordings is often
placed on the forehead (but could be placed anywhere
else on the body).
10. Reference Electrode(s)
Voltage is always measured as a difference from two
sites. In EEG, signal from electrodes over the scalp is
always the result of a difference in potential with
another electrode. The most common placement of EEG
electrodes are mastoids or earlobes, but it could also be
the nose
11. Dirty EEG raw data
A HAPPY participant!
Mounting the EEG cap
13. Having good EEG signal
When using passive EEG system, the key factor
is having a good contact between the scalp
and the electrode
Recent EEG systems have measures of
impedence (the highest the value, the worst
the signal)
Using gel, niddles and scrubbing, the
experimenter lowers the impedance of each
electrodes (ideally below 10 KOhms)
=> Main goal: Reduce NOISE
14. Having good EEG signal
Other sources of noise in EEG signal:
- Electronic noise (50 Hz – or 60 in the US)
15. Having good EEG signal
Other sources of noise in EEG signal:
- Muscular Artifacts
16. Having good EEG signal
Other sources of noise in EEG signal:
- Sweat Artifacts
17. Having good EEG signal
Other sources of noise in EEG signal:
- Eye Artifacts
20. Important Point !
- Most artifacts can be removed by various tools and data
processing (be patient)
HOWEVER!
‘There is no substitute to good
data‘
Jon Hansen
23. Previous literature
Define your hypothesis based on previous literature (including MEG
papers)
i.e. In the example of face processing, the most famous ERP is the N170
24. EEG experiment tips
‘Keep subjects happy’:
● Make sure they are relaxed
● Make sure the trial blocks are not too long and include breaks (less alpha)
● Make sure that the inter-trial interval (ITI) is long enough (1-3 seconds)
and ask subjects to blink during those to avoid artifacts during the time of
interest
25. Select the number of trials for each condition
Boudewyn et al., 2017
26. Select number of subjects
● Power Analysis in EEG is still at its
early days
● Power depends on several factor,
including signal-to-noise ratio (N
trials), the type of marker you are
targeting…
● A minimum requirement seems to
be at least 20 subjects
27. Have theoritical final plots in mind
A recommended step before even recording is to have a clear series
of final plots and analysis in your head, so that you will design your
pipeline accordingly
Analysis
Pipeline
30. Preprocessing
- EEG data is not directly informative. It needs many steps
to arrive to the final output of interest
- Activity caused by your stimulus is ‘hidden’ within
continuous EEG stream
- The asumption in ERP analysis is that everything that is
not linked to your event (stimulus-locked) is noise and is
assumed to be random
- A universal pipeline does not exist
31. Some restricted choices to be made; A lot of consistent
literature; Choices easy to justify;
More advanced choices; slightly more recent literature;
mild risks of misinterpretation; choices relatively easy to
justify
Crucial choices to be made; recent literature not always
consistent; higher risks of misinterpreting; harder
justifications; reviewers opinions might differ from
yours;
Risky analysis; literature is very recent; requires coding-
only analysis; have to be interpreted with care;
Researchers Degrees of Freedom
32. EEG Preprocessing
Downsampling & Filtering
Re-reference
ICA
Segmentation
Visual Artifact rejection
Continuous data
Segmented data
Preprocessed Data Matrix
33. Resampling/Downsampling
- EEG signal is recorded at 1000 Hz (in our lab) => 1 data point/ms
- Reducing the sampling rate reduce file size (and therefore processing
time)
- Nyquist frequency: the sampling frequency needs to be greater than
twice the maximum frequency of the signal you want to look at
e.g. with a sampling rate of 500 Hz, the maximal frequency that you can
analyze in the data is 250 Hz
34. Filtering
- Filters affect your data but are a necessary evil!
- They can create time and phase shifts
- Three main classes of filters:
• IIR infinite impulse response (e.g. Butterworth)
filters the data in both directions,
avoiding any phase shift
• FII finite impulse response
very efficient but…
can produce artificial oscillations in the
filtered data
• Notch filters
attenuates one narrow range of
frequencies and passes everything else
35. Filtering
If you don’t know what you are doing:
⇒ Butterworth filter:
High-pass: 0.5 Hz or lower
Low-pass: 30 Hz or higher for ERPs
No low-pass + notch filter at 50 Hz for Time-Frequencies
Low-pass filtering attenuates higher
frequencies (e.g. muscles)
High-pass filtering attenuates slow
frequencies (e.g. sweat)
36. Re-referencing
● If your reference online was the right earlobe (or mastoid), the re-
referencing offline to the average of both righ and left ealobes is
necessary to avoid any lateralization bias
● Another option is the average referencing, meaning that the average of all
the electrodes is flat, and that their activity is relative to all the others
37. Independent Component Analysis
ICA CAN IMPROVE SIGNAL – EFFECTIVELY DETECT, SEPARATE AND REMOVE ACTIVITY IN
EEG RECORDS FROM A WIDE VARIETY OF ARTIFACTUAL SOURCES. (JUNG, MAKEIG, BELL,
AND SEJNOWSKI) ● ICA extracts from
signal independent
activity
● In preprocessing, this
is useful to remove
non-brain activity
(mostly eye related
artefacts)
38. Independent Component Analysis
ICA CAN IMPROVE SIGNAL – EFFECTIVELY DETECT, SEPARATE AND REMOVE ACTIVITY IN
EEG RECORDS FROM A WIDE VARIETY OF ARTIFACTUAL SOURCES. (JUNG, MAKEIG, BELL,
AND SEJNOWSKI)
The resulting ICs are
ordered by the amount of
variance they account for
Tip: Eyes artifact are usually
present in the first 10 ICs
39. Independent Component Analysis
ICA CAN IMPROVE SIGNAL – EFFECTIVELY DETECT, SEPARATE AND REMOVE ACTIVITY IN
EEG RECORDS FROM A WIDE VARIETY OF ARTIFACTUAL SOURCES. (JUNG, MAKEIG, BELL,
AND SEJNOWSKI)
Blinks
Saccades
43. Baseline correction
Baseline correction consists in removing average activity pre-stimulus (usually
-200ms 0) to post-stimulus data in order to remove slow drifts and have all
trials at the same voltage before avering
Make sure that your baseline period is not contaminated by artifacts !
44. Visual artifact rejection
● Necessary step to make sure that no artifact remains in your data
set
● This involves checking trials for residuals artifacts (all of them) and
remove problematic trials
● Some tools are here to help you:
-Semi-automatic artifact detection (Brain Vision Analyzer)
-Automatic artifact rejection (MNE-Python & Fieldtrip) -
CAREFULL
46. ERPs representations
● Single plot
(1 electrode or pool of electrodes)
● Topographical plot (average
voltage over a time window)
● Butterfly plot
(all electrodes in time)
47. Example 1: the N170
The N170 is one of the component that reflects the neural processing
of faces. This response is maximal over occipito-temporal electrode
sites (P8-PO8-PO7-P7), which is consistent with a source located at the
FFA (Fusiform Face Area)
48. Example 2: the Error Related Negativity
An ERN component is observed after errors are committed during
various choice tasks, and its maximum amplitude usually is observed
over FCz-Cz (Matching location with the Anterior Cingulate Cortex).
Reflection of the activity of the Monitoring System (i.e;performance)
Reversed negativity
51. Fieldtrip
● FieldTrip is a MATLAB toolbox that contains a set of separate (high-level)
functions, it does not have a graphical user interface.
● Tutorials, Walkthrough and mailing list
● Fieldtrip allows you to do everything from preprocessing to statistics
● It simplifies your analysis by creating struct matrices with all necessary
info imbedded in submatrices
● The grammar is simplified
● Function are written as ft_XXXXX and need specific configurations -cfg-
Paragraphs are written:
cfg = [ ];
cfg.XXX = Y;
ft_XXX(cfg, data)
52. Hands-on example
This dataset comes from a visual experiment, where subjects had a look at a
screen where hands were presented
Three type of stimuli were presented: 1) Still Hands, 2) Grasping Hands and
3) Shaking Hands.
53. Hands-on example
- The hypothesis is that Hands with a social meaning would generate specific
activity over Lateral-Occipito-Temporal site compared to the other conditions.
- We know that the N190 is modulated by the presence of body and body parts
- and that the EPN (early posterior negativity) is modulated by emotions
54. Hands-on example
And in the Frequency domain, we know that
● Theta power (4-7 Hz) increases during the presence
of hands
● Theta is able to distinguish between hand-actions
65. Why look at data in another way ?
• Time domain analysis: when do things (amplitudes) happen?
Treats peaks as single events.
• Interest in time-frequency analysis is gaining momentum as it
allows us to study neural oscillation over the scalp and potential
interactions between neuronal groups.
• Time-Frequency analysis gives access to richer and more complex
signals, allowing for example connectivity analysis.
66. Neural oscillations
● Oscillations arise from an interaction between the intrinsic properties
of neurons (excitability) and their interconnectivity, giving rise to
synchronous activity (Buzsáki and Draguhn, 2004)
69. Fourier Transform – what is the Frequency Domain
● Fourier analysis converts a signal from its original domain
(here time) to a representation in the frequency domain
Deconstructing a time domain signal (ERP) to its oscillatory component
70. From time domain to frequency domain
Going from the time domain to the
frequency domain through Fourier
transform
71. Time-frequency domain
Fourier transform can be used to obtain a frequency-domain
representation of the EEG data.
Two limitations of the Fourier transform :
- no time resolution
- EEG data violate the stationarity assumption of Fourier analysis
To extract time-frequency information, several techniques have been
used and they all come with pros and cons
72. Morlet Wavelets
Wavelets work like a band-pass
filter: they extract information at
a frequency and move on the
next
Parameters involve a definition
of the ‘Mother Wavelet’ and the
decomposition with the help of
the Wavelet family
73. Morlet Wavelets
It is assumed that wavelets provide good temporal resolution, but
when looking at the entire spectrum, the choice of the mother
wavelet affects the frequency resolution
74. Short-term Fourier Transform (STFT)
Computation of Fourier transform with a fixed time-window that slides
along the time series in order to characterize power changes over time
and frequencies
Limits: a fixed time-window affects
temporal resolution
Tapering methods to limit
spectral leakage
Hanning or multitapering
75. Time-Frequency Analysis
Just like with ERPs, we want to look at how the power spectrum is
affected by an event.
1/f noise
Whole Power Spectra
76. Time-Frequency Analysis – Baseline Correction
Event Related Desynchronization / Event Related Synchronization
81. Intertrial Phase Coherence
Mike X Cohen
“The term is an interpretation of a presumed
mechanism — oscillations become “ locked ”
to an external event or to the phase values of
another electrode — but the
neurophysiological mechanisms underlying
phase locking are less clear. Thus, ITPC is a
succinct description of the analysis, which is
that phase values become clustered over
trials.”
83. Cross Frequency Coupling
The most famous cross frequency
measure is the Phase-Amplitude
coupling (PAC) that highlight the
relation between the phase low
frequencies and the amplitude of
higher frequencies
This rule has been recently shown
to also govern the temporal
organization of spontaneous large-
scale brain activity in humans
(Osipova et al., 2008, Roux et al.,
2013, Florin and Baillet, 2015,
Weaver et al., 2016)
91. Forward solution & Inverse Problem
Physiological
source
Body Tissue
Volume
Conductor
Scalp
distribution
Forward Model
Inverse Model
92. Source localization solution(s)
The inverse problem is the best answer to the question: Given my observed
pattern of topographical activity, what are the most likely location(s),
orientation(s), and magnitude(s) of brain source(s) that could have produced
this topographical pattern of activity?
Different inverse methods exists:
- Dipole fitting (e.g. BESA)
-> Assume a small number of sources // Where are the strongest sources ?
- Distributed dipole models (e.g. Low resolution electrical tomography
(LORETA))
-> Assume activity is everywhere and target what is the distrubtion of the
activity all over the brain
- Spatial Filtering (e.g. Beamforming)
-> Scanning method that target the likelihood of a given location
94. Dynamic imaging of coherent sources (DICS) -
Beamforming
● Baseline contrast (similar to ERD/ERS)
● Identify Time-Frequency Activity of interest (e.g. Theta band 0-500 ms)
● You need a volume conduction model (based on a MRI)
● With beamformers, you estimate source activity with a spatial filter
● You divide your volume model in a grid and you scan the grid location by
location
101. Connectivity
● So far, we have looked at univariate analysis at the channel level or the
source level
● Connectivity goes beyond univariate (i.e. multivariate) to target how brain
regions interact together
● Effective Connectivity & Functional Connectivity
● Functional refers to a statistical inference of communication between two
signals
● Effective connectivity refers to causal relationship between two signals
● Model based connectivity (DCM) is based on a priori knowledge of brain
areas involved in a given task
● Data driven connectivity generates connectivity matrices
104. Connectivity
● So far we have focused on the Amplitude (Power), but with Fourier
transform you can extract complex values that have both info on
Amplitude and Phase
● Signal in the complex domain is represented as
X = Aeiφ
● Connectivity measures (like coherence coeficient) focus on the phase
values of two signals
107. ROI identification
Virtual Sensor Extraction
Fronto-
Central
Right-LOTC
Time (s)
Amplitude
(uV)
Phase-Locking Value between the two ROIs
Frequency
30
2
30
2
Frequency
30
2
30
2
0 0.5
Time (s)
0 0.4
0.2
0 0.5
Time (s)
0 0.5
Time (s)
0 0.5
Time (s)
Cued-Correction
Interactive-Correction
Cued-NoCorrection
Interactive-NoCorrection
0.2
0
PLV
0.2
0
PLV
0.2
0
PLV
0.2
0
PLV
113. Rationale
Rather than examine activation between
conditions, MVPA examines differences in
distributed patterns of brain activity
Therefore with EEG, we can track the time-course
of object representation and how different
objects differ in their processing, using single
trials
114. Multivariate Pattern Analysis (MVPA)
K-fold
Goal: Classify single trials according to the stimulus
presented
Two sets of data:
- ERP information 5-fold cross validation
The dataset is divided in 5
subsets
Training phase (all-but-
one)
The classifier practices in a
supervised way on 4 subsets
=> Feature selection
Test phase
The classifier tries to
predicts the category on the
remaining subset
Classifier performance
Statistically estimated using
binomial testing against
chance level (50%)
117. Temporal Decoding - Question?
0-50 ms: low-level features
50-250 ms: categorisation
Can Sociability be a factor of
early classification in the
brain ?