Top Banner
Preprocessing for EEG & MEG Tom Schofield & Ed Roberts
44

Preprocessing for EEG & MEG Tom Schofield & Ed Roberts.

Dec 16, 2015

Download

Documents

Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Preprocessing for EEG & MEG Tom Schofield & Ed Roberts.

Preprocessing for EEG & MEG

Tom Schofield & Ed Roberts

Page 2: Preprocessing for EEG & MEG Tom Schofield & Ed Roberts.

Data acquisition

Page 3: Preprocessing for EEG & MEG Tom Schofield & Ed Roberts.

Data acquisition

Using Cogent to a generate marker pulse..

drawpict(2);

outportb(888,2); tport=time;

waituntil(tport+100); outportb(888,0);

logstring( [‘displayed ‘O’ at time ' num2str(time) ]);

Page 4: Preprocessing for EEG & MEG Tom Schofield & Ed Roberts.

Two crucial steps Activity caused by your stimulus (ERP) is

‘hidden’ within continuous EEG stream ERP is your ‘signal’, all else in EEG is

‘noise’ Event-related activity should not be

random, we assume all else is Epoching – cutting the data into chunks

referenced to stimulus presentation Averaging – calculating the mean value

for each time-point across all epochs

Page 5: Preprocessing for EEG & MEG Tom Schofield & Ed Roberts.

Extracting ERP from EEG

ERPs emerge from EEG as you average trials together

Page 6: Preprocessing for EEG & MEG Tom Schofield & Ed Roberts.

Overview

Preprocessing steps Preprocessing with SPM What to be careful about What you need to know about

filtering

Page 7: Preprocessing for EEG & MEG Tom Schofield & Ed Roberts.

mydata.mat

Page 8: Preprocessing for EEG & MEG Tom Schofield & Ed Roberts.

Epoching

Page 9: Preprocessing for EEG & MEG Tom Schofield & Ed Roberts.

Epoching - SPM

Creates: e_mydata.mat

Page 10: Preprocessing for EEG & MEG Tom Schofield & Ed Roberts.

Downsampling

Nyquist Theory – minimum digital sampling frequency must be > twice the maximum frequency in analogue signal

Select ‘Downsample’ from the ‘Other’ menu

Page 11: Preprocessing for EEG & MEG Tom Schofield & Ed Roberts.

Downsample

Creates: de_mydata.mat

Page 12: Preprocessing for EEG & MEG Tom Schofield & Ed Roberts.

Artefact rejection

BlinksEye-movementsMuscle activityEKGSkin potentialsAlpha waves

Page 13: Preprocessing for EEG & MEG Tom Schofield & Ed Roberts.

Artefact rejection

BlinksEye-movementsMuscle activityEKGSkin potentialsAlpha waves

Page 14: Preprocessing for EEG & MEG Tom Schofield & Ed Roberts.

Artefact rejection - SPM

Creates: ade_mydata.mat

Page 15: Preprocessing for EEG & MEG Tom Schofield & Ed Roberts.

Artefact correction Rejecting ‘artefact’ epochs costs you

data Using a simple artefact detection

method will lead to a high level of false-positive artefact detection

Rejecting only trials in which artefact occurs might bias your data

High levels of artefact associated with some populations

Alternative methods of ‘Artefact Correction’ exist

Page 16: Preprocessing for EEG & MEG Tom Schofield & Ed Roberts.

Artefact correction - SPM SPM uses a

robust average procedure to weight each value according to how far away it is from the median value for that timepoint

WeightingValue

Outliers are given

less weight

Points close to median

weighted ‘1’

Page 17: Preprocessing for EEG & MEG Tom Schofield & Ed Roberts.

Artefact correction - SPM

Normal average

Robust Weighted Average

Page 18: Preprocessing for EEG & MEG Tom Schofield & Ed Roberts.

Robust averaging - SPM

Creates: ade_mydata.mat

Page 19: Preprocessing for EEG & MEG Tom Schofield & Ed Roberts.

Artefact Correction

ICA Linear trend detection Electro-oculogram ‘No-stim’ trials to correct for

overlapping waveforms

Page 20: Preprocessing for EEG & MEG Tom Schofield & Ed Roberts.

Artefact avoidance

Blinking Avoid contact lenses Build ‘blink breaks’ into your paradigm If subject is blinking too much – tell them

EMG Ask subjects to relax, shift position, open mouth slightly

Alpha waves Ask subject to get a decent night’s sleep beforehand Have more runs of shorter length – talk to subject in between Jitter ISI – alpha waves can become entrained to stimulus

Page 21: Preprocessing for EEG & MEG Tom Schofield & Ed Roberts.

Averaging

R = Noise on single trialN = Number of trials

Noise in avg of N trials (1/√N) x R

More trials = less noiseDouble S/N need 4 trialsQuadruple need 16 trials

Page 22: Preprocessing for EEG & MEG Tom Schofield & Ed Roberts.

Averaging

Creates: made_mydata.mat

Page 23: Preprocessing for EEG & MEG Tom Schofield & Ed Roberts.

Averaging

Assumes that only the EEG noise varies from trial to trial

But – amplitude will vary But – latency will vary Variable latency is usually a bigger

problem than variable amplitude

Page 24: Preprocessing for EEG & MEG Tom Schofield & Ed Roberts.

Averaging: effects of variance

Latency variation can be a significant problem

Page 25: Preprocessing for EEG & MEG Tom Schofield & Ed Roberts.

Latency variation solutions

Don’t use a peak amplitude measure

Page 26: Preprocessing for EEG & MEG Tom Schofield & Ed Roberts.

Time Locked Spectral Averaging

Page 27: Preprocessing for EEG & MEG Tom Schofield & Ed Roberts.

Other stuff you can do – all under ‘Other’ in GUI

Merge data sessions together Calculate a ‘grand mean’ across

subjects Rereference to a different

electrode FILTER

Page 28: Preprocessing for EEG & MEG Tom Schofield & Ed Roberts.

Filtering

Why would you want to filter?

Page 29: Preprocessing for EEG & MEG Tom Schofield & Ed Roberts.

Potential Artefacts

Before Averaging… Remove non-neural voltages Sweating, fidgeting Patients, Children Avoid saturating the amplifier Filter at 0.01Hz

Page 30: Preprocessing for EEG & MEG Tom Schofield & Ed Roberts.

Potential Artefacts

After Averaging…

Filter Specific frequency bands Remove persistent artefacts Smooth data

Page 31: Preprocessing for EEG & MEG Tom Schofield & Ed Roberts.

Types of Filter

1. Low-pass – attenuate high frequencies

2. High-pass – attenuate low frequencies

3. Band-pass – attenuate both

4. Notch – attenuate a narrow band

Page 32: Preprocessing for EEG & MEG Tom Schofield & Ed Roberts.

Properties of Filters

“Transfer function”1. Effect on amplitude at each frequency2. Effect on phase at each frequency

“Half Amp. Cutoff”1. Frequency at which amp is reduced by

50%

Page 33: Preprocessing for EEG & MEG Tom Schofield & Ed Roberts.

High-pass

Page 34: Preprocessing for EEG & MEG Tom Schofield & Ed Roberts.

Low-pass

Page 35: Preprocessing for EEG & MEG Tom Schofield & Ed Roberts.

Band-pass and Notch

Page 36: Preprocessing for EEG & MEG Tom Schofield & Ed Roberts.

Problems with Filters

Original waveform, band pass of .01 – 80Hz

Low-pass filtered, half-amp cutofff = ~40Hz

Low-pass filtered, half-amp cutofff = ~20Hz

Low-pass filtered, half-amp cutofff = ~10Hz

Page 37: Preprocessing for EEG & MEG Tom Schofield & Ed Roberts.

Filtering Artefacts “Precision in the time domain is inversely related to

precision in the frequency domain.”

Page 38: Preprocessing for EEG & MEG Tom Schofield & Ed Roberts.

Filtering in the Frequency Domain

AB C

D E

Page 39: Preprocessing for EEG & MEG Tom Schofield & Ed Roberts.

Filtering in the Time Domain

Filtering in the time domain is analogous to smoothing

At a given point an average is calculated in relation to two nearest neighbours or more

X+1

X-1

X

Page 40: Preprocessing for EEG & MEG Tom Schofield & Ed Roberts.

Filtering in the Time Domain

Waveform progressively filtered by averaging the surrounding time points.

Here x = ((x-1)+x+(x+1))/3

Page 41: Preprocessing for EEG & MEG Tom Schofield & Ed Roberts.

Recipe for Preprocessing

1. Band-pass filter e.g.0.1 – 40Hz

2. Epoch

3. Check/View

4. Merge

5. Downsample?

6. Artefacts; Correction/Rejection

7. Filter

8. Average

Page 42: Preprocessing for EEG & MEG Tom Schofield & Ed Roberts.

Recommendations

1. Prevention is better than the cure

2. During amplification and digitization minimize filtering

3. Keep offline filtering minimal, use a low-pass

4. Avoid high-pass filtering

Page 43: Preprocessing for EEG & MEG Tom Schofield & Ed Roberts.

Summary

1. No substitute for good data2. The recipe is only a guideline3. Calibrate4. Filter sparingly5. Be prepared to get your hands

dirty

Page 44: Preprocessing for EEG & MEG Tom Schofield & Ed Roberts.

References

An Introduction to the Event-related Potential Technique, S. J. Luck

SPM Manual