Hello, my name is Arnaud Delorme
and I'm the main software architect of the EEGLAB software for processing EEG data.
This is part six of EEG pre-processing, about removing bad channels.
So, we were just examining the raw data
and now it's time to identify and reject bad channels.
To reject bad channels, first we need to remove channels which are not supposed to be in the data.
So this would be with the menu "Edit -> Select data"
and this interface pops up.
In the last edit box, you would enter the channel(s) you want to ignore.
In most amplifiers, sometimes you don't have [all of the] channels hooked up.
They might record additional channels, which you would want to just ignore
because they're flat, they don't have any data, and they're just distracting you.
The channels EXG5-EXG8 in this dataset don't have any data
so we'll just select them [and] press OK.
Now they [are] listed in the edit box, and we check the box to remove these.
Now they're removed, and now we can visualize the data and see which channels we want to remove.
What I personally like to use is the "Channel spectra and maps"
because I can see at once with the channel spectrum if the channel is bad or not.
So when when you [select] this menu, this interface pops up.
By default here you have 15%.
Sometimes this function takes time, so the default is not 100%.
You might want to put 100%, especially if you don't have too much data.
And you might want to increase the frequency range as well.
You would press OK, this is the interface that would pop up.
And here we can see we have a lot of channels.
We have some real data, and here we can see some alpha power,
but we have a lot of artifact channels.
When you look at this interface, you can actually click on every single trace here
then on the MATLAB command line it will tell you this is channel 24, 15, 32, and 30.
Then you can put them in the previous interface and say I want to reject these channels
and re-plot this trace to check that these disappeared.
Another menu to reject channels is "Channel properties."
So we will plot the properties for channel 3 and 31 here
and that's what we would get.
Channel 3 is located here, so we have a little red dot.
And channel 31 is located here.
You can see [for] channel 31, the range goes from -38 to +38 microvolts (uV)
but for channel 3 it goes up to -4,000 to +4,000 (uV).
So you can see using the range
this channel seems widely out of range.
Also the spectrum is very smooth.
This visualization, by the way, is just the visualization in which we stack the data for this channel
so we can see the whole activity throughout the session.
So I might want to tag channel 3 as a bad channel, based on bad information.
Although, it could just be that specific set of segments right here
and if I remove these segments, the rest of the channel will be okay.
Once you've selected the channels you want to remove
you go back to this menu, "Select data"
and now you're going to enter the name of the channels here.
You can also enter the channel number.
Then you would not forget to check this box, "remove these."
If you don't check this box, it's only going to keep channel F6.
You press OK.
And then, as usual, it pops up this interface
"What do you want to do with the new dataset?"
You can overwrite the parent or save it.
There [are] also methods for automatic channel rejection.
I'm just going to mention two.
Here is the "Automatic channel rejection" in EEGLAB.
And this method allows you to decide which electrode(s) you want to remove
and you can use two measures, one is probability and one is kurtosis.
When you use probability, it's going to find the channels which have improbable activity compared to the other channels.
When you choose kurtosis, it's going to compute the kurtosis of each channel and find the outliers.
It uses the standard deviation as outliers, and it will tag which channels are bad.
Another method is called clean_rawdata, it's one of the extensions of EEGLAB.
So if you want to install extensions, you go [to] the menu "File -> Manage extensions"
and that would be a data processing extension.
This plugin also allows you to detect bad channels using other metrics
and there are other plugins that also allow you to reject bad channels.
When we select one of these methods, it might show you
this is the bad channel I've detected, do you want to reject it or not.
You press the reject button, and now this channel gets removed.
In EEGLAB, removed channels are not only labeled for rejection
they are actually removed from the data.
This is why we ask users to save their data at different steps
because the channels are actually removed from the data.
There is a trace, so it knows that this channel was present in the data
it still retains the name, but the data itself is gone.
So if you want to get back to the data
you have to load the dataset that was saved before removing this channel.
The reason this is done this way is that
there is a common line interface for processing data, batch processing
and this makes it much simpler for the users
because the data that's on the command line is only the clean data
from which you removed artifacts [and/or] segments.
There is also the option, instead of removing channels, of interpolating channels.
So you say "Interpolate electrodes -> Select from data channels."
You can say I don't want to remove F6, I just want to interpolate it.
And that's definitely an option.
For technical reasons, (we will see in one of the future videos)
when you want to run independent component analysis
it is better not to interpolate data channels, it's just better to remove them.
And then they can be interpolated later on, when you do group analysis.
There [are] automated methods that just search and find the channels which need to be interpolated automatically.
We usually don't interpolate channels because we're going to run ICA
and interpolated channels can interfere with ICA.
I'm going to explain that in the future video
but that's certainly an option if you want to do it.
I'm going to do a live demo now.
So again, starting EEGLAB.
And I'm going to read that dataset that's in the sample_data folder of EEGLAB.
So "Load existing dataset," sample_data, eeglab_data.set.
And this time I will also look up the channels
because it's useful to have the channel labels.
I present that in another video.
So "Edit -> Channel locations."
Cancel.
And then reading the channel location file using this button ("Read locations").
Sample_data, that's the file that corresponds to this dataset.
So I'm just going to open it.
OK, autodetect.
And now I have the channel locations.
So, first I'll plot the spectrum ("Plot -> Channel spectra and maps").
You can put here 100% of the data
up to half the sampling frequency, which is the Nyquist frequency.
And we can see here on the spectrum that there are not that many outliers.
So if I click on the curve here I can see 15, 24.
These are two channels which are below the other ones.
And here we have 6 and 2.
So let's see what these channels are.
So to see which channel they are I can go "Select data."
And here I see 2 is EOG so these are the EOG channels, 2 and 6 are the EOG channels.
And 15 and 24, they're T8 and F8, so they're temporal channels.
So they usually have more high frequency noise than others.
So in this case, I would not reject these channels.
I might reject the EOG channels if they don't have the same reference as the rest of the channels
but in this case they do, so I don't need to reject them.
Also, I would only reject channels [whose] spectrum is widely different from other channels.
Here it's not so much of a departure.
But let's still look at the "Automatic channel rejection" menu.
So if we try the kurtosis, we just leave everything default.
It's gonna tell us these three channels are outliers.
Here it gives us the mid kurtosis, 60 for FPZ, 22 for EOG1.
So it labels them as bad because they're more than five standard deviations compared to the other channels.
Again, here we wouldn't remove these channels.
We can look at the other measures, like their probabilities.
so that's how unlikely the activity is from one channel [compared to the others].
And again, it selects the first two ones.
And then you can see the (normalized) measure of probability here.
I also wanted to show the spectrum measure.
So here in the spectrum analysis we saw these two channels.
They seem to have a little bit higher spectrum.
So if I was to set a measure here
(I tried before to so I could find the right threshold)
more than 2.5 standard deviations in the 40 to 50 [Hz] frequency range using the spectrum
then it would detect the two EOG channels.
So these two channels right there.
So these are very simple automated artifact rejection measures.
There are more advanced ones (like the ones I mentioned earlier in the presentation)
[such as] ASR that you can try.
And there's still more.
[File -> Manage EEGLAB extensions -> Data processing extensions]
ASR is not installed by default, so you have to install it with the data processing extension.
That's it for this presentation.
In the next video we will talk about removing bad data segments.