Analyzing event related potentials using adaptive filter

ERPs (Event Related Potentials) are EEG signals which are directly measured from cortical electrical response to external stimuli such as feelings, sensual or cognitive events. The evaluation of the amplitude and latency of the ERP wave has important significance in evaluating neurological reflex. However, the ERP wave amplitude is small compared with the EEG wave, and considerably affected by the noise such as eyes, muscles, heart motion etc. In this paper, datasets are collected from ERPLAB and journals provided available datasets with the stimulus of sound and light. Using adaptive noise cancellation (ANC) combined with LMS algorithm the waves P300 of ERP were detected and separated. The algorithm was evaluated by the ratio SNR and average value. Results were compared with other published tools such as P300 calculation algorithm of ERPLAB softwar.


INTRODUCTION
Electroencephalography records (EEGs) carry information about different responses to certain stimuli in the human brain. Some of the characteristics of these signals are their frequencies and shapes. These components are in the order of just a few up to 200 μV, and the frequencies differ according to different neurological rhythms, such as the alpha, beta, delta and theta rhythms [1].
Event related potentials (ERPs) can be considered as voltage deflections generated by cortical neurons that are time-locked to specific events and associated with stages of information flow in specific cortical areas. ERPs were first identified in 1964, and have remained as a useful diagnostic tool, in both psychiatry and neurology. Besides, they have been widely used in braincomputer interfacing (BCI). ERPs are those EEGs that directly measure the electrical response of the cortex to sensory, motor or cognitive events [2]. They are voltage fluctuations in the EEG induced within the brain, as a sum of a large number of action potentials (APs). They are typically generated in response to peripheral or external stimulations, and appear as somatosensory, visual, and auditory brain potentials, or as slowly evolving brain activity observed before voluntary movements or during anticipation of conditional stimulation. ERPs are quite small (1-30µV) relative to the background EEG activity. However, although evaluation of the ERP peaks does not still result in a reliable diagnosis, the application of ERP in psychiatry has been very common and widely used. The ERP waveform can be quantitatively classified according to three main characteristics: amplitude, latency, and scalp distribution. In addition, an ERP signal may also be analyzed with respect to the relative latencies between its subcomponents. The amplitude characterizes the extent of neural activity and how it responds functionally to experimental variables, the latency expresses the timing of this activation, and the scalp distribution displays the spatial pattern of the voltage gradient on the scalp at any time. The ERP signals are either positive, represented by the letter P, such as P300, or negative, represented by the letter N, such as N100 and N400. The timing is estimated in terms of milliseconds after the stimuli (audio, visual, or somatosensory). The P300 wave represents cognitive functions involved in orientation of attention, contextual updating, response modulation, and response resolution, and consists mainly of two overlapping subcomponents P3a and P3b. P300 has significant diagnostic and prognostic potential, especially in combination with other clinical symptoms and evidences [2].
The simplest and most widely used method for analysis of ERPs is averaging measured values of a trial set known as Ensemble Averaging (EA). It is an optimal way to improve signal-to-noise ratio (SNR) when underlying model of the observations assumes that ERP is a deterministic signal independent to additive background noise. Major drawback of averaging technique is its dependency on the amount of trials, which has to be large enough for better results [3]. The average of a trial set can depend considerably on the realistic model features. This will be more problematic for time series averaging that sum activities of many distinct brain and non-brain sources whose detailed features are of primary interest, including their spatial and temporal trial-to-trial variability [4]. Filtering is another common method used for the single trial analysis of ERP, through which the contamination due to on-going background activity can be attenuated from ERP. Major disadvantage of filtering method is low SNR and the performance of filter in detection of signals depends on statistical properties of the signal [5].
To overcome these problems, concept of adaptive filters and its applications as noise canceller was introduced by Widrow et al [6]. Since then, adaptive noise cancellation techniques (ANC) have been used in many engineering applications.
The basic concept of the adaptive filter design is the minimization of error between input and reference signal. There are various types of algorithm or error estimation methods exploited in adaptive filters to adjust the weight of filters and error estimation according to signal and noise properties. Most efficient gradient based algorithms for EEG signals are LMS, RLS and their different variants are used for adaptive filtering of EEG/ERP signals. Kalman filtering and generic observation models have been used to denoise the ERP signals [7]. Prony's Approach has been developed for detection of P300 Signals [8]. The EEG/ERP signal as initially decomposed into the background EEG and ERP signal before and after the stimulus time. The ERP component is also divided into two segments, the early brain response, which is a low-level high-frequency signal, and the late response, which is a highlevel low-frequency signal. Main contribution of the proposed work is the methodology extracting ERP from EEG/ERP signal based on application of ANC through LMS algorithm.

Materials [9, 10]
Data used in this paper is taken from web database [9]. Frequencies of EEG signals are less than 100Hz. In many cases, this frequency is less than 30Hz. In addition, most recordings present a 50-Hz frequency component contaminating several electrodes. Therefore, the signals are lowpass filtered to eliminate this frequency component and other high frequency components generally produced by muscular activity. A Butterworth filter of order 10 with a cutoff frequency of 45 Hz is used [1]. Performing the averaging and filtering by the adaptive filter on total of trials of EEG data.

Methods [11]
The original signal s(n) can be affected by many different kind of noise, however for simplicity we consider signal affected by adding the noise signal X(n) linearly. The corrupted signal d(n) is composed of s(n) and X(n): We want to remove X(n) to extract s(n), but we don't know it. Instead of that we have noise sources xi(n) received by secondary sensors, e.g. EOG, EMG, ECG etc. So we can subtract the corrupted signal d(n) by mentioned noise source signals multipled with weight coefficients: where L is the length of the FIR filter. The original signal s(n) is different to the noisecanceled signal e(n). In order to fit e(n) and s(n), we try to find w, which estimates X(n) -w T x(n) nearly equal to 0.
Indeed the squared expectation of e(n) can be calculated as follows:
Finally, we have used adaptive filter with optimizing criterion of least mean square (LMS) algorithm to calculate the weight ratios w. Figure  1 illustrates the structure of an adaptive filter. Detailed description of mentioned algorithm can be found in [11].

The results from the sample data of ERPLAB [13]
To verify proposed method we used the sample data containing P300 wave of the software package ERPLAB [13]. This continuous EEG dataset file contains raw 32-channel data plus records of 154 events that occured during the experiment. In this experiment, there were two types of events: "square" events corresponding to the appearance of a green colored square in the display and "rt" events corresponding to the reaction time of the subject. The "square" could be presented at five locations on the screen distributed along the horizontal axis. In this experiment, the subject had to attend the selected location on the computer screen and had to respond only when a square was presented at this location, and ignore circles when they were presented either at the attended location or at unattended locations. Signals were firstly preprocessed by Butterworth filter of order 10 with a cutoff frequency of 45 Hz to remove noise 50Hz and high frequency comonents. Then, we calculated ERP signal using average algorithm and adaptive filter of our proposed work and compared with the result of ERPLAB available code.  Figure 2b is ERP average images plotted by ERPLAB of channels FPz. Fig. 2c is ERP average images plotted by average code of our work of channels FPz. The result shows a good accordance in waveform and amplitude with ERPLAB result. The P300 wave is shown quite clearly at about 300ms after stimulus. However, the average of a distribution suggests a large enough data, that can be problematic in many realistic models. This may be even more problematic for time series averages that sum signals of brain and non-brain sources whose detailed features are out of primary interest. Using adaptive filter can overcome this. Figure 2d shows ERP image calculated by ANC of our work on channel FPz.
The result shows a good accordance in waveform and amplitude with results of average algorithm and noise reduced.

The results from data of Biosemi Active Two system [9]
The data were recorded with a Biosemi Active Two system. Event matrix contains the time-points at which the flashes (events) occurred. In each of the datasets, the first flash comes 400 ms after the beginning of the EEG recording. Stimuli are arrays containing the sequence of flashes. Entries have values between 1 and 6 and each entry corresponds to a flash of one image on the screen.   Figures 3b, 3c and 3d show the results of ERP signal calculated by ERPLAB code, our average and adaptive filter code resp. of the channel P07. These results shows good accordance with [9], in which he P300 waves appear at about 300ms after stimulus.

CONCLUSIONS
The ERP signal is a specific indicator of the brain function and can be potentially used as predictor of many applications in neurology research, diagnosis or treatment. ERPs are also related to the circumscribed cognitive process and can be use in neurofeedback application. Extracting ERP signal on EEG background suggests high reliability and flexibility in order to realize longterm measurements. Proposed work is an important component of our project on using ERP to study neurological behavior and application of neurofeedback in diagnosis and treatment. The results verified on published datasets showed good accordance with published results and proved that proposed algorithm could be used with good reliability. Mentioned ANC could be improved using neuron network if reference datasets is large enough to test.