User Tutorial:Performing an Offline Analysis of EEG Data

From BCI2000 Wiki
Revision as of 23:53, 7 January 2008 by Jfialkoff (talk | contribs)
Jump to navigation Jump to search

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 eegMov1.dat, eegMov2.dat and eegMov3.dat sessions that are included with BCI2000 and can be found in data/samplefiles/. In these sessions, 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. We will also be using the eegImag1.dat, eegImag2.dat and eegImag3.dat sessions. These sessions are labeled similarly but instead of actual movement, the subject was instructed to imagine performing the given instruction (e.g., imagine moving both feet). If you are relatively new to BCI2000, you may find it helpful to inspect the data files we'll be using with the BCI2000 Viewer. Using this tool, you will be able to see how state variables change with respect to the data over time.

The Feature Plot

Let's begin with an offline analysis of the data resulting from action movement (i.e., eeg1Mov.dat, eeg2Mov.dat and eeg3Mov.dat).

  1. 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.
  2. Set the analysis parameters as follows:
    1. Analysis Domain: Choose "Frequency" in order to perform a frequency-domain analysis
    2. Acquisition Type: Choose "EEG" since the data we'll be working with in this section was recorded using an EEG.
    3. Data Files: Click the "Add" button and navigate to data/samplefiles. From there, select the files eeg1Mov.dat, eeg2Mov.dat and eeg3Mov.dat and click "Open". To select multiple files, you'll need to first click on any one file and then, while holding down the control button on your keyboard, click the remaining files.
    4. Montage File: Leave this blank. The reason for doing so will be explained shortly.
    5. Target Condition 1: Enter the value "states.TargetCode == 0". This instructs BCI2000 Offline Analysis to search the data for sections where the TargetCode indicates that the subject was responding to the instruction to rest.
    6. Target Condition Label 1: The text entered here will be used to label data that is specific to condition 1. So, we will enter the string "Rest".
    7. 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.
    8. Target Condition Label 2: The text entered here will be used to label data that is specific to condition 2. So, we will enter the string "Both Feet".
    9. 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.
    10. Spectra Channels: Leave this blank. The reason for doing so will become clear.
    11. Topo Frequencies: Leave this blank. The reason for doing so will become clear.
    12. Spatial Filter: Choose "Common Average Reference (CAR)". Typically, for frequency domain analyses, filtering the data with a simple spatial filter such as CAR filter results in sharper, more useful plots.
    13. Ignore Warnings: Leave this field unchecked. For more information on this field, please see User Reference:BCI2000 Offline Analysis.
    14. 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.
  3. Click "Generate Plots".

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.

Eeg1FeaturePlt.png

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. 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.


See also

User Tutorial:BCI2000 Offline Frequency Analysis