User Tutorial:Performing an Offline Analysis of EEG Data
Although the basic properties of the Mu rhythm are identical for all humans, its spatial pattern and its exact frequency will differ. BCI2000 Offline Analysis helps to determine the frequencies and locations that correlate best with a given instruction.
Experimental Design
This tutorial will make use of the eeg1.dat session that is included with BCI2000 and can be found in data/samplefiles/. In this session, the subject was asked to move both hands and both feet in a predefined pattern. The resulting data was recorded using BCI2000 and labeled using the TargetCode state variable such that TargetCode is equal to 1 when the subject is responding to the instruction to move both hands, 2 when the subject is responding to the instruction to move both feet and 0 when the subject is responding to the instruction to rest. While it is unnecessary for the purpose of this tutorial, the temporal progression of state variables can be viewed using the BCI2000 Viewer. Please see User Reference:BCI2000Viewer for a description of this tool.
The Feature Plot
Let's begin with an offline analysis of dataset eeg1.
- Open BCI2000 Offline Analysis. If this is your first time using BCI2000 Offline Analysis, you may want to review the instructions on how to install and run this application: User Reference:BCI2000 Offline Analysis.
- Set the analysis parameters as follows:
- Analysis Domain: Choose "Frequency" in order to perform a frequency-domain analysis
- Acquisition Type: Choose "EEG" since the data we'll be working with in this section was recorded using an EEG.
- Data Files: Click the "Add" button and navigate to data/samplefiles. From there double-click or otherwise open the file named "eeg1.dat".
- Montage File: Leave this blank. The reason for doing so will be explained shortly.
- Target Condition 1: Enter the value "states.TargetCode == 1". This instructs BCI2000 Offline Analysis to search the data for sections where the TargetCode indicates that the subject was responding to the instruction to move both hands.
- Target Condition Label 1: The text entered here will be used to label data that is specific to condition 1. So, it would seem that entering the value "Both Hands" would be appropriate.
- Target Condition 2: Enter the value "states.TargetCode == 2". This instructs BCI2000 Offline Analysis to search the data for sections where TargetCode indicates that the subject was responding to the instruction to move both feet.
- Target Condition Label 2: The text entered here will be used to label data that is specific to condition 2. So, it would seem that entering the value "Both Feet" would be appropriate.
- Trial Change Condition Enter the value "states.IntertrialInterval == 1". This instructs BCI2000 Offline Analysis that the trial edges correspond to data samples where IntertrialInterval becomes 1 or is 1 and becomes something else.
- Spectra Channels: Leave this blank. The reason for doing so will be explained shortly.
- Topo Frequencies: Leave this blank. The reason for doing so will be explained shortly.
- Spatial Filter: Choose "Common Average Reference (CAR)". Typically, filtering the data with a simple spatial filter such as CAR results in sharper, more useful plots.
- Ignore Warnings: Unchecked
- Overwrite existing plots: If you have not yet run any analyses, this field should be disabled. If it is enabled, it is best for the purposes of this tutorial to leave it checked. Unchecking this box will instruct BCI2000 Offline Analysis to open new figures whenever it plots. This is useful if you want to compare the results of one analysis against another.
- Click "Generate Plots". This will generate a warning that, based on the conditions we've specified, there are less than 10 useable trials. While it is typically best to have at least 10 trials to consider in the analysis, this is not always possible.
- Click "OK" to dismiss the warning.
- Check the checkbox labeled "Ignore warnings" so that we can run the analysis regardless of the small number of trials.
- Click "Generate Plots" again to reattempt the analysis with the warning override.
Once the analysis has completed, you should see a feature plot similar to the one below. This plot displays the r-squared (coefficient of determination) values for the two distributions (i.e., the average signal for condition 1 and the average signal for condition 2) as a function of frequency and channel.
The feature plot is an overview of the possible features. Thus, it is typically the best place to start your analysis. From this plot, we can find the best features by looking for frequency/channel pairs with the higest r-squared (coefficient of determination) values. As we know, however, not all frequencies and channels are reasonable as EEG features. Take, for example, the block at 63 Hz and channel 42 that exhibits an r-squared value of about 0.6. Here, the r-squared value is relatively, high, but 63 Hz is too high to have been recorded by an EEG and additionally, it is out of the mu and beta rhythm ranges. Thus, we can conclude that 63 Hz and channel 42 is not a good feature.
For instance, one of the darker squares in the graph (i.e., a square with a high ) can be found at approximately 9 Hz and channel 41.
