# Spectral Analysis of Electroencephalographic Data in Serious Games
## 4 Results
### Clustering of Subjects  
The subjects are divided into three groups according to the specific features identified in the spectrograms described above. The k-means clustering method is used for clustering based on these signal similarities. Three features are selected as an input to the k-means algorithm. The first feature (F1) reflects the alpha activity's presence during the closed eyes and its change during the gameplay. If we calculate average alpha activity during the resting \(\overline{\alpha_{R}}\) and average alpha activity during the gameplay \(\overline{\alpha_{G}}\), then we can calculate the difference of the alpha activity by the equation  
\[\alpha_{diff}=\overline{\alpha_{G}}-\overline{\alpha_{R}}. \tag{10}\]  
If \(\alpha_{diff}>0\), then the alpha activity increased during the gameplay compared to the state of eyes closed; otherwise, if \(\alpha_{diff}<0\), then the alpha activity decreased during the gameplay. The similar computation as for alpha activity Equation (10) can be used also for beta, delta, and theta activity  
\[\beta_{diff}=\overline{\beta_{G}}-\overline{\beta_{R}}, \tag{11}\]  
\[\delta_{diff}=\overline{\alpha_{G}}-\overline{\delta_{R}}, \tag{12}\]  
\[\gamma_{diff}=\overline{\gamma_{G}}-\overline{\gamma_{R}}, \tag{13}\]  
The F1 feature vector is normalized to interval \(<\!-1\); l\(>\) across all subjects. The second feature (F2) describes the spread of brain activity to frequency sub-bands during the gameplay. At first, the brain activity differences computed by Equations (10)-(13) are normalized to the individual's maximum value. Then, the mean of brain activity differences \(A\) in all frequency sub-bands is calculated for each individual  
\[A=\frac{1}{4}\sum_{i=1}\alpha_{diff,norm}+\beta_{diff,norm}+\delta_{diff,norm}+ \gamma_{diff,norm}. \tag{14}\]  
Figure 11: The beta/alpha ratio during the rest and gameplay. If the \(A\) value is high, then the brain activity is spread to all brain sub-bands, typical for subject in group 1. The F2 features are normalized within the interval \(-1\) to 1 across all subjects. The third feature (F3) represents an increase in the beta/alpha ratio during the gameplay. The increase of beta/alpha ratio can be defined as the slope of a line connecting eyes closed and gameplay columns in Figure 11. If the slope is more than 1 degree, then the beta/alpha ratio is considered rising, and the F3 feature equals 1. Otherwise, the beta/alpha ratio is static or decreasing, and the F3 value is \(-1\). The result of k-means clustering in a three-dimensional space is shown in Figure 12. The k-means algorithm splits subjects into three groups with 10, 8, and 3 subjects in group 1, group 2, and group 3, respectively. The order of the subjects presented in this paper is according to the clustering results. To demonstrate the classification's correctness, we calculated the increase of brain activity in the delta, theta, alpha, and beta sub-band using Equations (10)-(13) for all examined subjects. The results are depicted in Figure 13. The power of sub-band brain activities is normalized by maximum value within the subject. The absolute values in Figure 13 cannot be compared across individuals because slightly different skin-electrode impedance will raise different signal strength and power. On the other hand, we are able to evaluate the increase or decrease of particular activity during the gameplay across subjects and the mutual ratio of brain activities within the subject. If the value of power is negative, then the brain activity decreased during the gameplay. During the gameplay, increased brain activity in all frequency bands is typical for subjects in group 1. A decrease of alpha activity is typical for group 2, and a negligible increase of beta activity compared to alpha activity is typical for group 3. As we can see from the bar plots, the delta and theta waves were significantly raised during the gameplay [70].