Preprocessing for EEG MEG Tom Schofield Ed Roberts
Preprocessing for EEG & MEG Tom Schofield & Ed Roberts
Data acquisition
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 ' num 2 str(time) ]);
Two crucial steps n n n 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
Extracting ERP from EEG ERPs emerge from EEG as you average trials together
Overview n n Preprocessing steps Preprocessing with SPM What to be careful about What you need to know about filtering
mydata. mat
Epoching
Epoching - SPM Creates: e_mydata. mat
Downsampling n n Nyquist Theory – minimum digital sampling frequency must be > twice the maximum frequency in analogue signal Select ‘Downsample’ from the ‘Other’ menu
Downsample Creates: de_mydata. mat
Artefact rejection Blinks Eye-movements Muscle activity EKG Skin potentials Alpha waves
Artefact rejection Blinks Eye-movements Muscle activity EKG Skin potentials Alpha waves
Artefact rejection - SPM Creates: ade_mydata. mat
Artefact correction n n 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
Artefact correction - SPM n Weighting Value Outliers are given less weight Points close to median weighted ‘ 1’ SPM uses a robust average procedure to weight each value according to how far away it is from the median value for that timepoint
Artefact correction - SPM n n Normal average Robust Weighted Average
Robust averaging - SPM Creates: ade_mydata. mat
Artefact Correction n n ICA Linear trend detection Electro-oculogram ‘No-stim’ trials to correct for overlapping waveforms
Artefact avoidance n Blinking n Avoid contact lenses Build ‘blink breaks’ into your paradigm If subject is blinking too much – tell them n EMG n Ask subjects to relax, shift position, open mouth slightly n Alpha waves n n n 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
Averaging R = Noise on single trial N = Number of trials Noise in avg of N trials (1/√N) x R More trials = less noise Double S/N need 4 trials Quadruple need 16 trials
Averaging Creates: made_mydata. mat
Averaging n n 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
Averaging: effects of variance Latency variation can be a significant problem
Latency variation solutions n Don’t use a peak amplitude measure
Time Locked Spectral Averaging
Other stuff you can do – all under ‘Other’ in GUI n n Merge data sessions together Calculate a ‘grand mean’ across subjects Rereference to a different electrode FILTER
Filtering Why would you want to filter?
Potential Artefacts n Before Averaging… n n n Remove non-neural voltages Sweating, fidgeting Patients, Children Avoid saturating the amplifier Filter at 0. 01 Hz
Potential Artefacts n After Averaging… n n n Filter Specific frequency bands Remove persistent artefacts Smooth data
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
Properties of Filters n n “Transfer function” 1. Effect on amplitude at each frequency 2. Effect on phase at each frequency “Half Amp. Cutoff” 1. Frequency at which amp is reduced by 50%
High-pass
Low-pass
Band-pass and Notch
Problems with Filters n n Original waveform, band pass of. 01 – 80 Hz Low-pass filtered, half-amp cutofff = ~40 Hz Low-pass filtered, half-amp cutofff = ~20 Hz Low-pass filtered, half-amp cutofff = ~10 Hz
Filtering Artefacts n “Precision in the time domain is inversely related to precision in the frequency domain. ”
Filtering in the Frequency Domain B A D C E
Filtering in the Time Domain n X-1 Filtering in the time domain is analogous to smoothing X X+1 n At a given point an average is calculated in relation to two nearest neighbours or more
Filtering in the Time Domain n n Waveform progressively filtered by averaging the surrounding time points. Here x = ((x-1)+x+(x+1))/3
Recipe for Preprocessing 1. Band-pass filter e. g. 0. 1 – 40 Hz 2. Epoch 3. Check/View 4. Merge 5. Downsample? 6. Artefacts; Correction/Rejection 7. Filter 8. Average
Recommendations 1. 2. Prevention is better than the cure During amplification and digitization minimize filtering 3. Keep offline filtering minimal, use a low-pass 4. Avoid high-pass filtering
Summary 1. 2. 3. 4. 5. No substitute for good data The recipe is only a guideline Calibrate Filter sparingly Be prepared to get your hands dirty
References n n An Introduction to the Event-related Potential Technique, S. J. Luck SPM Manual
- Slides: 44