# Implementation of Tools for Lessening the Influence of Artifacts in EEG Signal Analysis
## 5 Examples  
In this section, illustrative examples of the results obtained by using the methods and code proposed are shown to facilitate the reader to follow and replicate the processes. The figures obtained, as well as the data used in the examples shown, correspond to the processing of EEG data of a certain subject (denoted subject 001), recorded according to the procedure, and the experiment described in Section 2. **Method 1: ICs removal. ** ICA components with a high absolute value of their correlation with EOG signals are simply eliminated; as a consequence, a significant portion of information can be lost. In Figure 1, three graphs can be observed: Figure 1 represents EOG signals, Figure 1b shows the Fp1 channel (which usually appears strongly affected by ocular artifacts) and Fz of the original EEG signal, and, in Figure 1c, the same channels for the decontaminated EEG signals from the proposed method are shown. In Figure 1c, the observable large peaks linked to ocular artifacts have been removed. In addition, it can be observed that in some areas not influenced by artifacts there is a decrease in amplitude with respect to the original shape of the signal. An illustrative example of the utilization of this method is shown in Box 1. **Box 1. ** Matlab example code for the utilization of the proposed function for the complete elimination of ICs. **XXECG file**  
filename = 'SUJ_001_EXP_001_1.eeg';  
Typeprocessing EEG files  
cfg = []:  
cfg_dataset = filename;  
Nameuroe the audio  
cfg_channel = '('all', '-Audio');  
Reference channel  
cfg_refchmannel = 'FCz';  
XCorrection by the reference point  
cfg_deman = 'yes';  
cfg_deternd = 'yes';  
cfg_lpfilter = 'yes';  
cfg_lpfiltype = 'fir';  
cfg_lpfiltilt = 'toppass';  
cfg_lpfilter = 'yes';  
cfg_lpfpfire = 'fir';  
cfg_lpfiltdir = 'toppass';  
data_eeg = _ft_preprocessing(cfg);  
**XIFIER METHOD**  
fig = 1;  
clean_data = _ft_ica_removed_components_method(data_eeg, fig);  
Visualize the clean EEG data  
ft_databrowser([],clean_data);  
Figure 1: Method 1: Removal of ICs. (**a**) HEOG and VEOG signals; (**b**) original EEG data (for channels Fp1, near the eyes, and Fz); and (**c**) decontaminated data obtained after artifact removal with the proposed method. The reduction of the correlation coefficients between the independent components and EOG data after using the method is illustrated in Figure 2; specifically, Figure 2b shows a significant reduction of the correlation coefficients with respect to Figure 2a, after the application of the procedure. The identification of the ICs to remove is implemented as a well-separated procedure, which should allow the utilization of other methods based on schemes such as the ones described in [23; 24], or others. **Method 2: Partial removal of ICs. ** This method requires the identification of specific samples in which artifacts are present. This artifact detection process can be performed by hand or by automatic means to build the MSF (see Section 3). This method might somehow resemble PCA decomposition in sliding windows, as used in the ASR schemes for artifact removal [8]; however, the manner in which the windowing procedure is considered, and the way in which data are employed, are completely different. Figure 3 shows signal excerpts with samples where artifacts have been automatically detected, and marked, building the MSF shown in red. Then, the decontamination process is carried out similarly to Method 1, but only for the samples in which artifacts were found. The signal obtained after the process is expected to be without artifacts; additionally, less information should be lost in the rest of the samples, as compared to the previous method. Figure 2: Sum of the correlation coefficients between ICs and EOG data (**a**) before and (**b**) after the rejection of the highest correlation components in the example of Method 1. An example of the usage procedure of this method is shown in Box 2. **Box 2. ** Matlab example code for the application of the proposed function for partial elimination of ICs using the MSF.