Jump to content

Mu Rhythm Off-line Analysis Tutorial: Difference between revisions

From BCI2000 Wiki
Fcincotti (talk | contribs)
No edit summary
 
Fcincotti (talk | contribs)
m MuTutorial moved to Mu Rhythm Off-line Analysis Tutorial: more descriptive title
(No difference)

Revision as of 20:38, 15 December 2006

Starting an analysis session

Every recording session has its own history. It is very difficult to say in advance what might happen during the recording. So we will assume that everything was perfect (the subject collaborated, no channel went lost, etc); later on we will consider the main causes of contamination, how to recognize it and what to do.

If the recording session run smoothly, in the folder \TestData\Data\Mu you should have now two files named ALFAS006R01.dat and ALFAS006R02.dat, corresponding to two of the eight runs usually recorded, respectively.

Before you start the analysis you should locate on your hard disk the correct montage file. This is a file that describes the list of channels that were acquired. In this tutorial we will use Complete_Montage(suggested choice).mmf, which is located in the folder \TestData\Montage. If you need to edit the *.mmf file, check its data format. < the of performances optimize that parameters try will we then online; performed BCI2000 analyses same off-line replicate to first>

Opening files with Mario

After having run mario.exe, press "Select Data Files".

A dialog window will ask you to select the dat files. You can either select a single data file, or select multiple files. This time, we will select all files in the dataset.

A green box will surround the Raw Data box in the main window.

As an optional (but recommended) operation, push the LOAD MONTAGE button and choose the mmf file. This will allow you to see the labels of each channel the following steps, and to allow to apply spatial filters that depend on the electrode position.

At least you can load an additional parameters file according to different choices from those carried out during the experimentation.

At this point, you can check that Mu is selected in the Analysis menu (indicating that a Mu dataset has been recognized) and push the LOAD DATA button to confirm your choices. This will enable the EDIT CHANNEL LIST button you can use to select the channels you want to include in your analysis.

Selecting Channels

Pushing the the EDIT CHANNEL LIST button, two forms will show you the channels list (valids' and not-valids' one) and an image reassuming valid channels and their location.

Clicking on Add and Remove buttons you can move whichever channel from one list to the other enabling or disabling it.

Selecting the Spatial Filter

Coming back to main window, you can therefore choose which filter to apply for your elaborations, selecting it between the possible supplied solutions.

You can choose between:

  • RAW;
  • CAR;
  • Large Laplacian;
  • Small Laplacian.

Common Average Reference (CAR) will be fine for most the situations.

We hope to release soon an user defined solution for any custom analysis.

Feature Extraction Analysis

The Analysis field in the Feature Extraction panel will appear automatically according to loaded files while the Feature Extractor field shows currently the only possible choice.

You can view/edit analysis details by pushing "Set Analysis Details" and "Set F.E. parameters"

This second form reports all the settings for the parametric (autoregressive) spectral estimation stage. Most of the values are set after the corresponding values used on-line (see BCI2000 setup for Mu). With settings as the ones reported in figure, the analysis software will:

  • data recorded at 200 Hz sampling rate;
  • remove the mean value;
  • sample the spectrum at points starting from 0 Hz to 60 Hz, every 0.2 Hz.;
  • Identify an auroregressive model of order 16;
  • average these values into 2 Hz wide bins;
  • take a 1 s long epoch of data.

You can modify these settings according to your aims. Changing the model order, for instance, brings sometimes to interesting results. Remember though that in the online version, spectral estimation is performed in epochs as short as 200 ms (i.e. 40 samples, at 200 Hz sampling rate), so you should avoid using model order higher than half the samples available in the epoch. When you are done, remember to confirm your choices by pushing DONE. It will make the program accept changes.

Moreover, a button in the Spectral Extimation frame allows you to revert the values to the original.

Altogether you have to specify:

  • which data (in each trial) you want to take into account. Mu will only use the part of the trial when the cursor is visible, while MuExtended will take into account all the period when the target is visible. To learn more, see section D2Box Application States ;
  • If you have made an artifact rejection (or noted on the run sheet during the acquisition which trials contain artifacts), you can instruct the software not to use them;
  • Finally, you must decide how the software must extract EEG epochs from the continuous data.

The epochs can be partially overlapped. This attenuates the data loss in case the length of a trial is not a multiple of the length of an epoch.


The percentage of overlap can be set both in Mario GUI and in any batch script. It's equal to the value of the MU_params.overlapping variable and the corresponding GUI field can be found by pressing Set Analysis Details on MARIO main form.


At this point you can start the analysis by pressing the Evaluate and Plot button.

View results

The first figure that appears is the R-square matrix (channels x frequency bins)

R-square matrix

The r-square matrix highlights the most relevant spectral features for the separation of the two classes of EEG - Cursor Up (target 1) and Cursor Down (target 2).

Each row of the matrix is related to a single channel, while a column represents a frequency bin (labeled with its central frequency). The color codes the statistical significance of the difference between the two kind of evoked potentials.

Thus a red color would mean that, on that channel and for that frequency, the "Up" EEG is significantly synchronized with respect to "Down" EEG.

Clicking on a cell of the matrix will open two more windows:

  • Power spectral distribution of the selected channel;
  • Topographic maps at the selected frequency.

You can choose whether to overwrite or to put the most recently evoked figures beside the previous one. Two sets of waveform/topography figures are available, and are linked to the click of the left, the central or right mouse button. Left Button will create/overwrite a first figure, Right Button will do the same on a second figure, the Central Button will always open a new plot.

Power Spectra and Topographic Plots

In the lower panel you can find the spectral density of power for both classes of EEG. Blue line refers to "Up" condition, while Red line to "Down". We can see that at the vertex the "Down" condition is generally more synchronized than the "Up", with maximal difference in the beta band, consistently with what is shown by the R-square matrix. The proportinality between spectral differences and R-square is anyway rough, since r-square is sensitive to the dispersion (variance) of single trials; thus, small differences between spectra could bring to a high r-square, if they were very reproducible.

The peak around 50 Hz is due to mains disturbance; this also allows to appreciate the leakage introduced by the spectral estimation.

Over the spectral graph, a topografic plot shows the scalp distribution of the r-square.

The color coding is the same as the r-square matrix figure, and values on each channel are interpolated to create a continuous bidimensional map. The higher the number of electrodes, the more accurate is the map. The number of channels shown on the scalp may not coincide with the whole number of electrodes in case of a Surface Laplacian spatial filtering, since in that case the value of the laplacian is not computed on the border channels. Interpretation of the results

The first step in the preliminary analysis of P300 BCI data is to find the absolute maximum of r-square. This simple statement must be mediated with a proper knowledge of physiological phenomena. In fact, we do not expect any sensorimotor activity at 3 Hz, so if the absolute maximum is at that frequency, you must suspect that it is actually an artifact. The same holds if the spatial localization of the peak is far away from the centro-parietal electrodes.

From a practical point of view, it is not important now to understand the reasons different component that explain the desynchrinization peak on Cz at 17 Hz, as far as we are confident that this component is stable enough to be exploitable during the next session to control the cursor.

The absolute value of R-square is mathematically bound to lie in the interval between 0 and 1. Values above 0.4 allow a rate of missed target in the order of a few percent. Values around 0.1 are promising. Values below 0.03 are possibly due to random fluctuations. All the previous figures are referred to analyses made on 240 trials. Beware of artifacts!

During the acquisition, you should be particularly careful to avoid artifacts. While EOG and blink artifacts are confined to very low frequencies, EMG artifacts are mostly on the beta band and could largely overlap with the frequency band that characterize the mu rhythm.

If contaminated data was acquired, then you have two problems:

  • Realize that EMG is superimposed to data;
  • Distinguish between spectral modulation introduced by EEG and by EMG.

The first task is not as trivial as it might appear. If you did not acquire the data yourself (or even if you did it) you might complete the analysis procedure without giving a single glance to the raw data. So you must be particularly careful when you analyze the R-square maps, and always wonder whether the peak you are seeing might be due to an artifact.

Discriminant features between EEG and EMG are both in the frequency distribution and in the spatial distribution.


EMG that strongly affects the recordings is mostly generated by muscles at the forehead or close to the ears/jaws. Thus their spatial distribution is such that the most responsive channel is one of those at the border of the montage. Of course, due to volume conduction, the effects can be seen even on electrodes on the opposite part of the montage, but they show a degrading pattern. On the other hand, a peak that shows its maximum on a central channel, can hardly be generated by a muscle or by other non-cephalic source.

The spectrum of EEG is mainly concentrated in the alpha band, with a possible flatter and lower peak in beta. With the exception of the beta peak/plateau, the EEG spectrum decreases almost linearly (if measured in dB) after 12 Hz. On the other hand, EMG spectrum becomes significant at about 20 Hz and is still very high at the highest frequencies we usually analyze (60 Hz). A spectrum with a pattern more similar to the latter, must induce the suspect that non-EEG activity is present in the data.

Improving the analysis

The first cause of an unsuccessful analysis is a poor quality of the recording. For this reason it is highly recommended that, at least for the first experiments, the subject is highly motivated and cooperative. If this is the case, data of low quality are usually present in one or a few runs. And if the experimenter is careful enough, he/she should have noted down the occurrence of strong artifacts on the run sheet. In this hypothesis, the following step is to repeat an unsatisfactory data analysis after having excluded the (putative) bad runs. To do this, just go back to the file selection dialog, choose LOAD Data again and load only the runs that you believe are clean. The number of runs should not be too low (as a rule of thumb, the data set should contain at least 100 trials), otherwise the r-square statistical analysis would loose sensitivity.

Analyzing the Screening

The screening experiment is not different from a regular training session, from the point of view of data format. You will have four sets (horizontal movement, horizontal imagination, vertical movement, and vertical imagination) of three runs, containing EEG acquired in two conditions (up and down, or left and right).

Start analyzing the vertical movement execution, and mark a few possible responsive features. The analysis on vertical movement imagination should confirm (though with a lower R-square) those that are actually related to sensorimotor cognitive states.

In the hypothesis that no reliable responsive EEG feature is found, the analysis can be repeated on the horizontal dataset.

If both the vertical and horizontal dataset show responsive features, and these are different, the subject should be trained for some session on the vertical training until he/she decreases the false positive below 10%; at that point the training of the horizontal modulation can begin, with the aim that at a certain point the subject can control both the vertical and the horizontal simultaneously in a two-dimensional task.

Conclusions

If you are confident that you have found a significant difference between conditions, that is due to EEG rather than an artifact, and that reflects a cognitive process that is likely to be reproduced (or even enhanced with training) in the next session, well you have reached your goal. Next time the same subject practices with the D2Box Application, you will have to change the MUD matrix so that it reflects the feature that you just outlined.

Troubleshooting

Some OpenGL drivers may sometimes show defective figures like the following:

Matlab customers can go round this problem using this simple procedure:

  • Select the defective figure window;
  • Go to the Matlab Command Window;
  • Execute one of the following command line:
    • set(gcf, 'Renderer', 'Painters');
    • set(gcf, 'Renderer', 'zbuffer').

The figure will be plot using a different renderer (Painters or zBuffer).