*3.2. EEG Data*

In order to test the performance of our phase TE estimator in the context of BCI, we obtain effective connectivity features from EEG signals recorded under two different cognitive paradigms: the first one consisting of motor imagery (MI) tasks and the second one of a change detection task designed to study working memory (WM). Our aims are to set up classification systems that allow discriminating between the conditions in each paradigm, using as inputs relevant directed interactions among EEG signals and then evaluate their performance in relation to the connectivity measures used to train them. To those ends, we employ two publicly available databases: the BCI Competition IV database 2a (http://www.bbci.de/competition/iv/index.html, accessed on 2 June 2021) and a database from brain activity during visual working memory (https://data.mendeley. com/datasets/j2v7btchdy/2, accessed on 2 June 2021).

#### 3.2.1. Motor Imagery

Motor imagery (MI) is the process of mentally rehearsing a motor action, such as moving a limb, without actually executing it [43]. The BCI Competition IV database 2a [44] comprises EEG data from 9 healthy subjects recorded during an MI paradigm consisting of four different MI tasks, namely, imagining the movement of the left hand, the right hand, both feet, or the tongue. Each trial of the paradigm starts with a fixation cross displayed on a computer screen, along with a beep. At second 2, a visual cue appears on the screen for a period of 1.25 s (an arrow pointing left, right, down, or up, corresponding to one of the four MI tasks). The cue prompts the subject to perform the indicated MI task until the cross vanishes from the screen at second 6. A representation of the paradigm's time

course is shown in Figure 2A. Each subject performed 144 trials per MI task. The EEG data are acquired at a sampling rate of 250 Hz, from 22 Ag/AgCl electrodes (*C* = 22) placed according to the international 10/20 system, as depicted in Figure 2B. Next, the data are bandpass-filtered between 0.5 Hz and 100 Hz. A 50 Hz Notch filter is also applied. For each subject, the database contains a training dataset and a testing dataset, obtained following the same experimental paradigm [44]. In this study, we consider a bi-class classification problem involving the left and right hand MI tasks, so we drop the trials associated with the feet and the tongue. Afterward, we also drop the trials marked for rejection in the database itself [44]. Then, for all trials we select a 2 s long time window stretching from second 3 to second 5 (*M* = 500 samples), as schematized in Figure 2A. Finally, we compute the surface Laplacian of each remaining trial through the spherical spline method for source current density estimation, in order to reduce the deleterious effects of volume conduction on connectivity analyses [21,45,46].

**Figure 2.** (**A**) Schematic representation of the MI protocol. (**B**) EEG channel montage used for the acquisition of the MI database.

## 3.2.2. Working Memory

The concept of working memory (WM) refers to a cognitive system of limited capacity that allows for temporary storage and manipulation of information [47]. The database from brain activity during visual working memory, presented in [48], contains EEG data recorded from twenty-three subjects, with normal or corrected-to-normal vision, and without colorvision deficiency, while performing multiple trials of a change detection task [49]. The task consists of remembering the colors of a set of squares, termed memory array, and then comparing them with the colors of a second set of squares located in the same positions, termed test array. A trial of the task begins with an arrow indicating either the left or the right side of the screen. Then, a memory array appears on the screen for 0.1 s. For every trial, memory arrays are displayed on both hemifields, but the subject must remember only those appearing on the side indicated by the arrow cue. Next, after a retention period lasting 0.9 s, a test array appears. The subject then reports if the colors of all the items in the memory and test arrays match. The task has three levels according to the number of elements in the memory array: low memory load (one square), medium memory load (two squares), and high memory load (four squares). A representation of the above-described experimental paradigm is depicted in Figure 3A. The color of one of the squares in the test array differs from its counterpart in the memory array in 50% of the trials. Each subject performed a total of 96 trials, with 32 trials for each memory load level. The EEG data are acquired at a sampling rate of 2048 Hz, using 64 electrodes (Biosemi ActiveTwo) arranged according to the international 10/20 extended system, as depicted in Figure 2B. Besides the

EEG data, the database provides recordings from four EOG channels and two externals electrodes located on the left and right mastoids.

**Figure 3.** (**A**) Schematic representation of the WM protocol. (**B**) EEG channel montage used for the acquisition of the WM database.

In this study, we perform the following preprocessing steps before any further data analysis. First, we re-reference the data to the average of the mastoid channels. Next, we bandpass-filter the data between 0.01 Hz and 20 Hz using a Butterworth filter of order 2. Afterward, we extract the trial information from the continuous EEG data using a 1.4 s squared window. Each trial segment starts 0.2 s before the presentation of the memory array. Then, we perform a visual inspection of the data and discard two subjects (subjects number 11 and 17) because of the presence of strong artifacts in a very large number of trials. Subjects number 22 and 23 are reassigned as subjects 17 and 11, respectively. After that, we remove ocular artifacts from the EEG data by performing independent component analysis (ICA) on it and then eliminating the components that more closely resemble the information provided by the EOG data [48]. Then, we discard all incorrect trials, i.e., trials for which the subjects incorrectly matched the memory and test arrays. Next, we select 32 out of the 64 channels in the EEG data (*C* = 32), as shown in Figure 3B. Then, we downsample the data to 1024 Hz, and segment, for each trial, the time window starting 0.3 s after the onset of the memory array and ending just before the presentation of the test array (see Figure 3A). The 0.7 s long segments (*M* = 717) cover most of the retention interval, the period when the subjects should maintain the stimulus information in their working memories, while leaving out any purely sensory responses elicited immediately after the presentation of the stimulus. Finally, with the aim of reducing the presence of spurious connections associated with volume conduction effects, we compute the surface Laplacian of each trial.
