EEG Data

Install MATLAB & EEGLAB

MATLAB
EEGLAB

Data Prep

I. Upload EEG Data
  1. Download a subject's dataset from Sharepoint

    • In your MATLAB folder, create a folder for EEG data

    • Download the subject's .mff files for pitch and duration

    • Create a folder for each subject's .mff files

    • Add each subject folder to your EEG data folder

  2. Open MATLAB

    • Make sure you’re in Documents > MATLAB

    • Right click on the eeglab2024 folder > add to path > select folders and subfolders

    • Type “eeglab” into the command window and hit enter

  3. Import the subject's data

    • Select File > Import data > Using eeg lab functions & plugins > Import magstim/EGI.mff file

    • Navigate the directory to open the subject's .mff file

    • Select code > Ok

II. Pre-Process Data
  1. Change the sampling rate

    • Select Tools > Change sampling rate > 250

    • Nyquist Rule: you can only analyze frequencies that are half of the sampling rate

    • We only care about frequencies between 0-20

  1. Rename the data set

    • Rename the file by deleting all characters behind either “p” or “d" and add "resampled" > Ok

  2. Re-reference the data

    • Select Tools > Re-reference the data

    • Select Re-reference data to channel(s) > "..." > E65 > Ok

  3. Rename the data set

    • Rename the file by adding "rerf" to the end (ex: 19000X resampled rerf) > Ok

  4. Filter the data

    • Select Tools > Filter the data > Basic FIR filter

    • Set the lower edge as 0.5 and the higher edge as 30

    • Deselect plot frequency > Ok

  5. Save as a new dataset

    • Rename the file by adding "filter" to the end (ex: 19000x resampled reref filter)

    • Select Save it as file > Browse

    • Add the file name and save it in the subject's EEG data folder

    • Select Save > Ok


Scroll & Scrub

III. Select EEG Dataset
  1. Open MATLAB

    • Make sure you’re in Documents > MATLAB

    • Right click on the eeglab2024 folder > add to path > select folders and subfolders

    • Type “eeglab” into the command window and hit enter

  2. Import the subject's data

    • Select File > Load existing dataset

    • Navigate the directory to open the subject's "resampled reref filter" file

    • Select code > Ok

IV. View data
  1. Select Plot > Channel data (scroll)

  2. In the plot window, select Settings > Time range display > 60 > Ok

  3. Select Display > Remove DC offset

  4. Select Display > Normalize channels

  5. Decrease the lower amplitude to 1 > continue to decrease until EGG details are clear and channels are discriminable

V. Clean data
  1. Scroll through the data and highlight all unpredicted noise

    • Avoid deleting data right after tone 1 and tone 2; that's what we're most interested in

  2. Once all noise is highlighted, select reject

  3. Rename the file replacing "resampled reref filter" with "clean" (ex: 19000x clean)


XXXXXXXXXXXXXXXXXXXXXXXXXXXX

2b. Independent Component Analysis

noise: repeated noise (blinking) —> ICA electrical noise —> filtered out in beginning bad electrode —> doesn’t matter how much you remove, so note any electrodes that look weird unpredicted noise - when participant moves around or clenches jaw excessively

run ICA ⁃ neural network ⁃ tools —> decompose by ICA ⁃

click on channels ⁃ highlight all channels from 1-60 ⁃ deselect electrodes we wrote down for being problematic by clicking on them while pressing command on your keyboard

ICA neural net will start learning

tools —> inspect/label components by map

prompt with how many components to show.

# components = # channels input into algorithm (degrees of freedom)



⁃	maps tell you where noise patterns and occurring

⁃	 checkerboard is bad
⁃	organizes data based on sources of most noise
⁃	most important are in first two rows
⁃	color map is most important

⁃	long streaks = eye movement
⁃	v

maps tell you where noise is occurring

brain data looks like fuzzy tv

to reject: - go through components with streaks or electrode popping and accept then click ok

tools —> remove components by data —> yes —> plot single trials - time range = 60 ⁃ normalize ⁃ if the red lines look different enough from the black lines —> click accept then ok

bad electrodes interpolation

⁃	tools —> interpolate electrodes —> select from data channels —> select removed electrodes from before (not 61-64)
⁃	add “int” to end of name and click ok
⁃	tools —> extract epochs —> 3 dots —> select time 1 and time 2
⁃	epoch limits change to -0.1 0.5
⁃	tools —> remove epoch baseline —> click ok 

plot —> channel ERP image —> type all relevant channels into channels box and click ok ⁃ click on blue line graph to open

or plot —> channel ERP with scalp map —> window = -100 490 ⁃ P2 = peak ⁃ N2 = dip

file —> save current dataset as —> subject id “p” “n1”

Last updated