User Reference:BCI2000 Offline Analysis
BCI2000 Offline Analysis is a graphical tool for finding useful features in EEG and ECoG data. It should not be confused with the matlab tools for offline data analysis, which are of more interest to experienced Matlab users.
The OfflineAnalysis tool operates in two steps. In a first step, it transforms recorded data such that it is now represented by a certain set of features rather than by EEG time courses. The set of features differs by the type of data analyzed as follows:
For P300 (ERP) data, a single feature corresponds to
- raw EEG amplitude
- at a certain time offset after the stimulus
- in a certain channel.
For mu rhythm (SMR) data, a single feature corresponds to
- absolute value of EEG amplitude
- at a certain frequency
- in a certain channel.
After transformation from raw EEG into features, data are selected/sorted into two groups according to the conditions specified in the OfflineAnalysis GUI. Again, the meaning of these conditions depends on the type of data analyzed: For P300 data, one condition is the presentation of an unattended stimulus, while the other condition is the presentation of an attended stimulus. For mu rhythm data, one condition may be imagined movement of the left hand, while the other condition may be rest.
Now, for a single feature, there exists a number of sampled values, taken from two sets (conditions). What OfflineAnalysis now does is that it uses these values to compute a number representing how much a feature's value tells about the condition under which it was recorded. That measure is called "determination coefficient", or "r^2 (r squared)," and is a number between 0 and 1. The larger a feature's r^2, the more correlation exists between a feature's value and the condition under which it was recorded. For details about how r^2 values are computed, see Coefficient of Determination.
Finally, OfflineAnalysis produces a main graph that shows r^2 values, plotted over the two dimensions that locate a feature. Using this graph, one may identify and select individual channels and time offsets/frequencies for which to display more detailed information, i.e. topographic plots, ERP wave forms, spectra.
Installing and Running
In order to run BCI2000 Offline Analysis you'll need a system running Windows. If your system meets this requirement, please choose from one of the following:
Systems with MATLAB v7.0 or greater installed
If you have not yet opened MATLAB, the easiest way to run BCI2000 Offline Analysis is to double click the OfflineAnalysis.bat file that resides in tools/OfflineAnalysis/
From the MATLAB command line
If MATLAB is already running, navigate to tools/OfflineAnalysis/ using the Current Directory explorer or typing the absolute path into the textbox at the top of the MATLAB window. Then, type OfflineAnalysis at the MATLAB command prompt in order to start analyzing your data.
Systems that do not have MATLAB installed or with versions that predate MATLAB v7.0
- Install the MATLAB Component Runtime (MCR)
- Download MATLAB runtime version 8.5 (R2015a) from the MathWorks website.
- When the download is complete, run the installer.
- Follow the on-screen instructions to complete the installation.
- Navigate to tools/OfflineAnalysis/
- If you installed the x64 version of MATLAB runtime version 8.5, double-click OfflineAnalysisWin64.exe to begin analyzing your data. Otherwise, run OfflineAnalysisWin32.exe.
For a BCI2000 Offline Analysis and Eloc Helper tutorial, please see User Tutorial:Performing an Offline Analysis of EEG Data and User Tutorial:Performing a Time-Domain Offline Analysis of EEG Data.
File>Save Settings - "Save Settings" allows you to save the values you've entered for all fields excluding "Data files", "Ignore warnings" and "Overwrite existing plots". This functionality may be particularly useful if you want to run the same or similar analyses between sessions.
File>Load Settings - "Load Settings" allows you to load a settings file previously created using File>Save Settings.
Analysis Domain - The BCI2000 Offline Analysis tool allows for you to analyze your data either in the frequency domain or the time domain. Be aware that certain fields will be labeled differently depending on the domain that is chosen. Specifically, choosing "Frequency" will make the "Spectra Channels" and "Topo Frequencies" fields available. Choosing "Time" on the other hand will make the fields "Waveform Channels" and "Topo Times" available. Additionally, the values for the target conditions, trial change condition and spatial filter will be overwritten so as to correspond with the chosen domain.
A frequency domain analysis will result in up to three plots comprising a feature plot, a spectra plot (one spectrum for each channel specified) and up to 9 topographic plots (one for each topo frequency specified). Typically the best frequency domain features can be found in the range of 9-12 Hz and 18-25 Hz. Please see User Tutorial:Performing an Offline Analysis of EEG Data for a more complete explanation of this type of analysis.
A time domain analysis will result in up to three plots comprising a feature plot, a waveform plot (consisting of one waveform for each channel specified) and up to 9 topographic plots (one for each topo time specified). Typically P300 features are found at around 300 ms following presentation of the stimulus. Please see User Tutorial:Performing a Time-Domain Offline Analysis of EEG Data for a more complete explanation of this type of analysis.
Acquisition Type - Acquisition type allows the user to indicate whether the data was acquired using an EEG or an ECoG.
Data Files - Any number of BCI2000 data files with the same state information and number of channels may be analyzed in a single run. To select a file to add to the list of files to be analyzed, simply click the "Add" button, choose the desired file and click "Open." To add multiple files from the same directory, click on any one of the desired files and then control-click the additional files. Then, when all desired files are selected, click "Open." If files have already been added to the data files list then subsequent uses of the above procedure will append the selected files to the list allowing for addition of files from different directories.
Montage File (optional) - If topographic plots are desired, you must specify a montage file that is congruent with the chosen acquisition type (i.e., EEG or ECoG). If you do not yet have a montage file, you can create one using the Eloc Helper tool that comes with BCI2000 Offline Analysis. For more information about Eloc Helper, please see User Reference:Eloc Helper. In place of a montage file, you may also use data files that specify channel names that are compliant with the 10-20 standard. In this case, BCI2000 Offline Analysis will use the channel name corresponding to each electrode to infer the location of that electrode.
Target Conditions - Target conditions consists of four fields that allow for the specification of two different conditions. Each condition consists of the condition itself (i.e., a MATLAB-syntax Boolean statement) and the label for the corresponding data (e.g., "Opening and Closing Both Hands"). Typically you will want to specify two different conditions in order to compare two different datasets. Occasionally, however, you may want to inspect a single dataset to investigate certain artifacts such as subject-related noise. In this case, you can omit the second condition (i.e., both the condition and the label). To learn more about condition syntax, please see User Tutorial:Performing an Offline Analysis of EEG Data or User Tutorial:Performing a Time-Domain Offline Analysis of EEG Data.
Trial Change Condition - The trial change condition allows for the user to indicate to BCI2000 Offline Analysis how to determine the position of the trial edges. The condition must be a MATLAB-syntax Boolean statement. To learn more about condition syntax, please see User Tutorial:Performing an Offline Analysis of EEG Data or User Tutorial:Performing a Time-Domain Offline Analysis of EEG Data.
Spectra Channels (optional) - Note: This field is available only if you've chosen "Frequency" as the analysis domain. If you would like to have the analysis generate spectra plots, you must enter at least one channel in this field. Multiple channels can be specified using a comma-delimited list (e.g., "1,2,3") or a space-delimited list (e.g., "1 2 3").
Topo Frequencies (optional) - Note: This field is available only if you've chosen "Frequency" as the analysis domain. If you would like to have the analysis generate topographic plots, you must enter at least one frequency in this field. Multiple frequencies can be specified using a comma-delimited list (e.g., "8, 11, 22") or a space-delimited list (e.g., "8 11 22").
Waveform Channels (optional) - Note: This field is available only if you've chosen "Time" as the analysis domain. If you would like to have the analysis generate P300 waveform plots, you must enter at least one channel in this field. Multiple channels can be specified using a comma-delimited list (e.g., "1,2,3") or a space-delimited list (e.g., "1 2 3").
Topo Time (optional) - Note: This field is available only if you've chosen "Time" as the analysis domain. If you would like to have the analysis generate topographic plots, you must enter at least one time in this field. Multiple times can be specified using a comma-delimited list (e.g., "200, 300, 400") or a space-delimited list (e.g., "200 300 400").
Spatial Filter - By applying the right spatial filter to your data, you will likely be able to achieve better results. Depending on the data, however, the optimal filter will differ. BCI2000 Offline Analysis offers the CAR filter which is typically effective as long as the response isn't spread out over a large number of electrodes. To apply a CAR filter to your data before processing, choose "Common Average Reference". Otherwise, choose "None" in order to run the analysis on the raw data.
Ignore warnings - In order to get an accurate representation of the data, it is recommended that the analysis be performed on no less than 10 trials. BCI2000 Offline Analysis will generate a warning if this condition is not met. This warning can be ignored by checking this box. If a particular combination of data files and conditions results in less than 3 trials, an error is displayed and the analysis is halted. Errors cannot be overridden.
Overwrite existing plots - Each time the analysis is run, up to three plots may be generated. If you want to compare the results from different runs, ensure that this checkbox is unchecked. In this case, BCI2000 Offline Analysis will generate the plots in new figures instead of simply overwriting the plots from previous analyses.
Clicking on any button results in the error "Undefined command/function ..." followed by "Error while evaluating figure ..."
If you're receiving this error, it is possible that after opening BCI2000 Offline Analysis you changed MATLAB's working directory. Make sure that your working directory is the same directory that contains the OfflineAnalysis script.
The analysis doesn't seem to be generating any topographic plots In order to generate topographic plots, it is necessary to specify a montage file and at least one topo frequency (for frequency domain analyses) or topo time (for time domain analyses). If the analysis you're running doesn't generate a topogrphic plot, please ensure that you've entered values in both of these fields.
The analysis doesn't seem to be generating any spectra or waveform plots In order to generate spectra or waveform plots, it is necessary to specify at least one spectra channel (for frequency domain analyses) or waveform channel (for time domain analyses). If your analysis is not resulting in one of these plots, please ensure that you have entered values into the appropriate field.
I've typed in a valid target or trial change condition, but I get the error "Invalid ... condition specified". Condition syntax is case-sensitive. For instance, while states.TargetCode may be a valid state condition, states.targetcode is not. Please double-check your conditions to ensure that the state variables are capitalized correctly.