User Tutorial:Analyzing the Initial Mu Rhythm Session

From BCI2000 Wiki
Revision as of 17:40, 22 October 2008 by Gschalk (talk | contribs) (Generating a Feature Plot)

Jump to: navigation, search

This tutorial step assumes that you have performed an initial mu rhythm session. In order to identify the parameters (i.e., frequency and location) of a subject's mu rhythm, we will determine how different the EEG signal amplitude is for different types of imaginations that the subject performed during the recording. You will use the BCI2000 Offline Analysis tool for this purpose.

Generating a Feature Plot

The first step in these analyses is to separate data into amplitudes at individual frequencies and locations. These amplitudes are called features, and their correspondence with the subject's imagination will be plotted as a so-called feature map. From a feature map, it is possible to determine those frequencies and locations whose amplitude is maximally correlated with the subject's task, i.e., those features that are most different between two conditions. These features will subsequently be used to provide feedback in a BCI experiment.

To generate a feature plot from the initial session's data, perform the following steps:

  • Start the BCI2000 Offline Analysis tool:
    • If you have a version of Matlab installed, run tools/OfflineAnalysis/OfflineAnalysis.bat.
    • Otherwise, follow the instructions provided here.
  • In the Analysis Domain field, choose Frequency.
  • In the Acquisition Type field, choose "EEG".
  • As a Spatial Filter, choose "Common Average Reference (CAR)".
  • Enter states.StimulusBegin == 1 into the Trial Change Condition field.
  • Into the field labeled Target Condition 1, enter states.StimulusCode == 0.
  • Enter the word "Rest" into the field labeled Target Condition Label 1.
  • Similarly, enter states.StimulusCode == 2 into the Target Condition 1 field, and "Right Hand" into Target Condition Label 2.
  • Click the "Add" button located besides the Data Files field. A file chooser dialog will appear; navigate to data/<Subject>001, and select all .dat files available there (use your keyboard's ctrl button to click-select multiple files), then click the dialog's "Open" button.
  • Click "Generate Plots", and wait for the feature plot to appear.

Once the computation is complete, you will see a feature plot similar to the one below. In that plot, the horizontal axis corresponds to frequencies, and the vertical axis corresponds to individual channels. Color codes represent r-squared values, which are numbers between 0 and 1. R-squared values provide a measure for the amount to which a particular EEG feature (i.e., amplitude at a particular frequency and location) is influenced by the subject's task (e.g., hand vs. foot imagery).


Typically, there will be clusters of large r-squared values in the feature plot. The initial step to configure the online system is to determine which brain signal feature differed the most between two particular tasks. This is accomplished by picking the largest r-squared value from the map and by noting its corresponding frequency and location. However, it is important to verify whether the feature in question is consistent with the mu rhythm's known properties. This verification is necessary to avoid misconfiguration due to EEG artifacts, other noise, or random effects.

Generating Spectra and Topography Plots

  • Pick the four largest r-squared values from the feature map between 9 and 36Hz, and read off their frequencies and channels. The plot's "Data Cursor" tool (Data Cursor from the Tools menu) may be helpful for this.
  • In the analysis program's Spectra Channels field, enter the channel numbers you read off the feature map.
  • Click the Generate Spectra button. (Available in future versions of the Offline Analysis tool.)
  • In the Topo Frequencies field, enter the frequencies you read off the feature map.
  • Click the Generate Topos button. (Available in future versions of the Offline Analysis tool. In the current version, click "Generate Plots".)


The generated topography plots display the spatial distribution of r-squared values. For right-hand movement imagination, there should be a clear maximum of r-squared values over the left motor cortex, as displayed in subfigure (A) and (B) above. The generated spectra plots display amplitude distributions, and r-squared measure, over frequencies. Ideally, they should appear similar to the (C) and (D) subfigures above.

Analyzing Remaining Conditions

Up to now, you performed an analysis of how imagined movement of the Right Hand is correlated with brain activity. In order to choose the most useful channel and frequency for online feedback, perform similar analyses for the remaining conditions:

  • In the analysis program's Target Condition 2 field, enter states.StimulusCode == 1, and Left Hand into Target Condition Label 2.
  • Make sure the Overwrite existing plots check box is unchecked.
  • Click Generate Plots to create a feature plot for imagined movement of the left hand.
  • As previously, pick the four largest r-squared values, and compute spectra and topographies for their channels and frequencies.
  • Results should be similar to right hand results, except that modulated activity should originate from the right rather than the left motor cortex.
  • Repeat the analysis for conditions states.StimulusCode == 3: Both Hands, and states.StimulusCode == 4: Both Feet.
    • For the both hands condition, the result should resemble a combination of left hand and right hand results.
    • For both feet, modulated activity should be centered around electrode Cz.

Picking Optimal Features

By now, you should have identified a number of maximum r-squared values for each condition, and you should have some impression how plausible corresponding channels and frequencies are.

  • Remove all implausible maxima from your list.
  • From the remaining entries, pick the one with the largest r-squared value. Note this entry's frequency and electrode name, and the subject instruction (condition) that is associated with it. These are the parameters that you will use to configure the online system.

Next Step

Configuring Online Feedback shows you how to configure the BCI system using the parameters obtained in the analysis.

See also

User Tutorial:Mu Rhythm BCI Tutorial