😰Manual Data Cleaning
I. Pre-Process Data
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
Rename the data set
Rename the file by deleting all characters behind either “p” or “d" and add "resampled" > Ok

Re-reference the data
Select Tools > Re-reference the data

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

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

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

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
Data prep only needs to be done once for each dataset (but only if you save it!)
II. Select EEG Dataset
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

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

III. View Data
Select Plot > Channel data (scroll)

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

Select Display > Remove DC offset

Select Display > Normalize channels

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

IV. Clean Data
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

Once all noise is highlighted, select reject
Rename the file replacing "resampled reref filter" with "clean" (ex: 19000x clean)
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

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”