User Tutorial:Analyzing the Initial Mu Rhythm Session

From BCI2000 Wiki
Revision as of 13:54, 16 October 2008 by Mellinger (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

In order to identify a subject's mu rhythm, the EEG signal amplitude must be correlated with the type of imagination that the subject performed during the recording. You will use the BCI2000 Offline Analysis tool for this purpose.

Generating a Feature Plot

As a first step of data analysis, data is separated 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 read off frequency and location whose amplitude is maximally correlated with the subject's imagination. These are optimally suited to provide brain signal 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/<SubjectInitials>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; these are numbers between 0 and 1, providing a measure for the amount to which signal amplitude is determined by the subject's imagination.


Typically, there will be clusters of large r-squared values in the feature plot. In principle, picking the largest r-squared value from the map, and using its frequency and channel to configure the online system, would be sufficient. Still, it is important to check whether the signal in question is consistent with the mu rhythm's known properties. This way, it is possible 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 with 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 Feature

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