|Spectrogram of the EEG Signals from the Back of my Head ("O1"). Note the horizontal stripe of energy near 10 Hz when my eyes are closed. These are the Alpha waves being generated in my occipital lobe.|
Simple Approach First: There is a huge body of literature out there on the various signal processing techniques to address the "detection" problem. Most approaches (or, at least, the language used to describe the approaches) get very technical very fast, even in introductory material, so I'm going to take a simple approach first, and only add additional complication as needed to solve particular problems.
|Average EEG Spectrum when My Eyes are Closed. The Alpha rhythm clearly shows up around 10 Hz.|
Frequency View: As a human being looking at the spectrogram at the top of this post, I easily see the horizontal stripe of energy that represents my Alpha waves. Since the frequency is nearly constant, the Alpha waves should show up in a simple spectrum view of signal. The spectrum view plotted above shows the EEG spectrum averaged entire period when my eyes are closed. Clearly, there is a strong peak in the Alpha Band (7.5-12 Hz). This is the tool that we will use to measure the Alpha waves.
Alpha Through Time: Since the Alpha waves are clearly identifiable in the spectrum, and since the OpenBCI GUI already computes the spectrum as the EEG data arrives from the OpenBCI board, let's use the spectrum as our tool for focusing on just the Alpha waves. To quantify the amplitude of the Alpha waves, I find the maximum value of the spectrum within the 7.5-12 Hz band. Since the OpenBCI GUI computes a new spectrum every 200 msec, I get a new estimate of the Alpha amplitude five times a second. The plot below shows the estimate of Alpha amplitude that results from this process.
|Looking at the Alpha Band (7.5-11.5 Hz) through Time. Notice that the amplitude is highly variable. When my eyes are closed, the amplitude is generally much higher.|
Choose a Detection Threshold: As you can see in the plot above, the EEG amplitude in the Alpha band increases greatly when my eyes are closed (and, a bit surprisingly, we also see that my Alpha amplitude is not very steady...it varies a lot when my eyes are closed). To have the computer decided when Alpha waves are present, the simplest approach is to pick a threshold value such that, when the signal amplitude is above the threshold, we declare that Alpha waves are present. Looking at the plot, I picked a threshold value of 3.5 uVrms.
False Alarms. To improve our sensitivity further, one could imagine lowering the detection threshold so that we capture more of the points within the "eyes closed" region. Doing this, though, would also cause more points outside of the "eyes closed" region to be falsely detected as Alpha waves. Even with our 3.5 uVrms threshold, there are several moments (t = 58, t = 77, t = 123) when strong broadband EEG activity happens to be strong enough to cross our detection threshold. Since these detections are not due specifically to Alpha activity, we call these false alarms.
Balancing Sensitivity with False Alarms: Selecting a good detection threshold requires one to balance the desire for high sensitivity with the requirement for a low false alarm rate. After trying several different threshold values (see table below), 3.5 uVrms seems like it provides a decent balance for this EEG recording. Other recordings might require a different threshold value.
Threshold N_TRUE N_FALSE
2.5 uVrms 126 (82%) 43
3.0 uVrms 112 (73%) 20
3.5 uVrms 101 (66%) 15
4.0 uVrms 75 (49%) 12
4.5 uVrms 59 (39%) 11
Moving Forward: With this simple method of quantifying the Alpha amplitude (ie, take the maximum value from the spectrum in the 7.5-12 Hz band) and with this simple method of deciding whether Alpha is present (ie, using a pre-defined detection threshold), we can easily have the computer detect our eyes-closed Alpha waves. Sure, we might have a few false alarms but this is just our first try! In the next post, I'll try adding a few techniques to be more selective to reduce our false alarms, without significantly degrading our sensitivity.
Follow-Up: See how I reduce the false alarms by introducing Guard Bands!