Skip to content

D_reref_exclextrn_interp_avgref_ica_autoexcom

Douwe Horsthuis edited this page Feb 28, 2024 · 3 revisions

Interpolate

After that we re-referencing we interpolate. We moved this up from where it was before (after the ICA), because this allows us to use the ICA weights and gives us all the channels.

Here we interpolates all the channels that got deleted before. It does this using the pop_interp function. It loads first the _info.set file (that was created in B script) to see how many channels there were originally (it deletes the externals because you don't want these in your new data). Then we use the pop_interp to do a spherical interpolation for all channels that were rejected.

It is important to realize that if too many channels from around the same location are rejected, the newly formed channels have inaccurate data.

For each participant, data get stored containing the ID number and how many channels were interpolated.

These are the variables you NEED to change:

subject_list = {'some sort of ID' 'a different id for a different particpant'}; 
name_paradigm = 'name' % this is how the .mat file with the info is being called
home_path  = 'the main folder where you store all the data';

These you can change if you want to change settings

EEG = pop_interp(EEG, ALLEEG(1).chanlocs, 'spherical');% 

Back to top

Average reference

After this we reference the data to the average. There are mulitiple reasons to do this but we do it mainly for 2 reasons.
1, in preparation for Independent Component Analysis (ICA).
2, The extra referencing step, will give you 40 dB extra CMRR (Common mode rejection ratio)

We only do it now because we just interpolated, which minimizes potential bias in the average referencing stage. For example, if there are 64 channels, and 16 channels are identified as bad and rejected but only from the right hemisphere. Then, the number of channels in the left vs. right hemispheres are 32 vs. 16, with which average will be biased toward the left hemisphere. To avoid this bias, scalp electrodes may be interpolated. See Makoto's pipeline for more info, the previouse text is his explanation

Back to top

PCA

The PCA is set to the amount of channels deleted -1 (for the average reference), the PCA will dictate how many components the ICA will create. This is especially important because we are interpolating and doing an average reference before the ICA. This could cause "ghost components", or just make the data go bad all together due to working with data that is rank deficiant. Setting the PCA preferents this rank issue. Another solution is to delete a channel (after the average ref). But this would still not solve the issue for the interpolated channels + we would lose a good channel.

Back to top

ICA

We are using the pop_runica function, as suggested by EEGLab, but there are other options that might be quicker (this might, however, come at a cost). We do an ICA mainly to delete artifacts that are repeated, such as eye blinks, eye movement, muscle movement and electrical noise.

Back to top

IClabel

We are using IClable as a function to automatically label the components. After that, we only delete the eye-components. We only focus on eye-blinks because we know they have a bad/strong impact on the data and as you can see in the next part deleting more has a very strong impact on the data and we are not sure what gets deleted. In our case components will only get deleted if they are >80% eye and <10% brain. We decided on these criteria after comparing how many components experts in our lab would delete and what criteria would match this the closesed.

Matlab will save a figure with the deleted Eye components and with all the remaining components grouped separately. Lastly, Matlab will save a variable called components, with the ID and how many of each type of component reached the threshold.

These are the variables you NEED to change:

subject_list = {'some sort of ID' 'a different id for a different particpant'}; 
home_path  = 'the main folder where you store all the data';

These you can change if you want to change settings

EEG = pop_runica(EEG, 'extended',1,'interupt','on'); % you can choose a different ICA function, or command it out if you don't want to use it (you will also need to command out the IClable part)
bad_components = find(ICA_components(:,3)>0.80 & ICA_components(:,1)<0.05);% look for >80% eye and <5% brain

Back to top

Impact of ICA on simple ERPs

This is an example of what the ICA does to an ERP. ERP-ICA-vs-no-ICA

Here you see the impact of the ICA on data after using IClabel to auto delete bad components. While all of the components that are deleted are non-brain related and we even check that within the components there is less than 5% brain data, the impact is huge. When using ICA always make sure to use the right setting and make sure your data look the way it should. Doing it manually takes a lot of practice and understanding of the data and a lot of time. This is why we currently prefer the more objective IClabel function in EEGlab

To make more sense of the impact of deleting components I've plotted 4 different ERPs.

  • For the first ERP I deleted for each participant every component if the labels* of the sum of bad** components >90 and the brain label <3%***
  • For the second ERP I only deleted a component if the eye label would be >80% and the brain label <5%
  • For the third ERP I deleted for each participant every component if the labels of the sum of bad components >80 and the brain label <5%
  • For the fourth ERP I did not delete any component, this is the ERP before IClabel is ran.

The first plot is an VEP directly after seeing a stimulus
ERP-ICA-vs-no-ICA-hit
The second plot is an ERP after a False Alarm (button press when they were supposed to inhibit) ERP-ICA-vs-no-ICA-fa

* IClabel labels for each component how much % they are made up out of $$Brain, muscle, eye, Heart, Line Noise, channel noise and other$$
** We only use a sum of muscle, eye, Heart, Line Noise, channel noise to create bad components
*** every label will always have something above 0%, this is why I didn't want to go lower then 3%

re-referencing

Thanks to the suggestion of Ana Francisco we moved this to after the ICA. Since the average reference would undo this part.
After realizing that re-referencing causes flat channels to have the data of the reference channel and thus making it impossible to see if it's flat, we only re-reference here (after having deleted all the channels that are noisy/flat).
You can choose a reference channel. Biosemi explains why it matters for their system but that you should delete flat channels first. Brainproducts and this paper Also agree that mastoids are commonly used and good, the paper also talks about different options that could work.

In our case we use the average of both mastoids (channel 65/66 for us), but you can change this to a different channel or leave it empty if you don't want to do this.

This is the impact it has on our data. Here we compare data referenced to the mastoid externals with data where we left the ref_chan variable empty.
hit-ref
fa-ref
The first plot is the ERP after a Hit. The second one is after a False alarm. It is clear that the amplitudes increase significantly, however it does seem like the standard error also increases.

Back to the home page
Back to the C_manual_check page
To the E_epoching page