This repository contains the MATLAB code used for writing the master thesis Unmixing Cognitive Strategies Using the EEG Signal. The thesis is currently in progress of being written, and is supervised and graded by dr. Leendert van Maanen (Amsterdam, UvA) and dr. Max Hinne (Nijmegen, Radboud). The thesis contains the theoretical explanation of what happens within the functions written and used by this repository. This readme file contains additional information on how to replicate the results of the simulation study to evaluate the break detection method, hopefully aiding anyone who hopes to extend this method in the future.
From scratch, this repository and its dependencies can be used for generating the EEG data under specific (differing) assumptions containing a structural break, estimating if and when any structural breaks happen, and evaluating the accuracy of this estimation.
For simulating the EEG data accurately, we need 2 'parts'. First are the underlying ERPs which correspond to the application of any specific cognitive strategy (or sleep stage, or anything else). Second is the typical 'EEG noise' which has a specific frequency spectrum. It is not simply white noise, so a specific generator is used for this part.
Event Related Potentials are small 'bumps' of electrical activity distributed over multiple electrodes of the EEG. The onset, amplitude, and latencies of these bumps can vary from trial to trial. The toolbox used to simulate this is SEREEGA: Simulating Event Related EEG Activity.
The EEG is contaminated by many artefacts from many different and unknown sources. However, it is observed the frequency spectrum of the EEG is often the same. Therefore, simulating realistic EEG noise tries to replicate this frequency spectrum. A simulation procedure by Yeung, Bogacz, Holroyd, Nieuwenhuis & Cohen simulates the noise by adding 50 random-phase sinusoids together. Their procedure can be downloaded here.
For handling the data, the standard Matlab package EEGLAB is used.
For estimating the break points, first we decompose the signal into Independent Component Analysis (ICA) models. However, one ICA is not sufficient since there is a structural break: The EEG over the full experiment is a mixture of two ICA models. Therefore, we use Adaptive Mixture Independent Component Analysis (AMICA), which estimates different ICA models for self-similar parts of the data. AMICA returns the ICA models, but critically also the probabilities of each estimated ICA model being active over time. Structural Break detection can be applied to this timeseries of model probabilities.
The mixture ICA estimator used for this thesis is AMICA. It can be run from EEGLAB directly, which is useful. For replication of the large-scale simulation study in this thesis, relying on the EEGLAB-GUI of AMICA is not recommended.
To estimate the break points in the AMICA model probabilities, the Bai-Perron test is used. This method is implemented in a toolbox named 'm_break'. For more implementations of break detection, look here.
Some of these toolboxes come with their own dependencies, which may or may not already be installed in your version of Matlab. Consult the documentation for each of these toolboxes if something is not working, the solution should lie there.
Here I can discuss the scripts used for actually running the simulation study. Within the functions, not much needs to change.
This
Settings
Evaluations