User Tutorial:Analyzing the Initial Mu Rhythm Session

From BCI2000 Wiki
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 movements 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 elsewhere.
  • In the Analysis Domain field, choose Frequency.
  • In the Acquisition Type field, choose "EEG".
  • As a Spatial Filter, choose "Common Average Reference (CAR)".
  • Enter auto 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 2 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/mu/<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 movements).


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 channels you read off the feature map.
  • In the Topo Frequencies field, enter the frequencies you read off the feature map.
  • Click the Generate Plots button.


The generated topography plots display the spatial distribution of r-squared values. In this comparison of EEG activity for right-hand movements and rest, there should be a clear maximum of r-squared values over the left motor cortex as shown 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 brain activity is related to imagined movements of the Right Hand. 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 somewhat resemble that derived for the right hand, except that the colored activity changes should appear over the right and not 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

Here we are looking for the frequency with the highest r-squared value between 9Hz and 36Hz. Further, acceptable readings are centered on the proper electrode for the predicted stimulus; C3 for readings from the right hand, C4 for the left hand, both C3 and C4 for both hands, and Cz for both feet.

Equipped with the frequency and electrode that provides the reading with the highest r-squared value, we can begin configuring the setup for proper use.

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