# Detection of Movement Intention for Operating Methods of Serious Games
## 2 Materials and Methods
### Signal Processing and Data Analysis  
The root mean square (RMS) values of the sEMG signal data measured from the upper extremities were calculated to quantify muscle energy. A 50-ms window was used to capture the rapid dynamic contraction of the joint movement of the upper extremity. In  
Figure 4: Positions of the electrodes attached to collect sEMG signals.  
On the other hand, as the time series data of the EEG signals were vulnerable to noises from the surrounding environment, a signal-processing protocol, containing a suitable filter and quantification processes, was designed to calculate the ERD/ERS data (Figure 7).  
The EEG data collected at a frequency of 1024 Hz were down-sampled to 128 Hz, and since the length of the input signal was sufficiently long, the FIR (finite impulse response) filters for the \(\alpha\) (8-12 Hz) and \(\beta\) (12-30 Hz) waves were employed to obtain the time series data for a specific frequency band and remove the high-frequency noises at the same time. The relative amplitude (RA) values for the idle rhythm state and the upper extremity movement due to the stimulus were calculated for quantification using Equations (1)-(3). Equation (1) signifies the rectification process that converts a negative EEG signal into a positive amplitude to assure that the sum of the amplitudes would not be zero. Equations (2) and (3) refer to extraction of the RA. In Equation (2), the pre-stimulus baseline is calculated to examine the relative impact of the stimulus. The RA is then calculated by subtracting the reference value from the time series data at each point in Equation (3). Here, \(N\) refers to the total number of executions, \(y\) to the BPF process data of the \(j\)th sample of the \(i\)th trial, _Act(j)_ to the average of the squared \(j\)th sample, and \(R\) to the reference, indicating the average of the section of 1 to 2 s prior to the stimulus.  
\[Act_{(j)}=\frac{1}{N}\sum_{i=1}^{N}y_{ij} \tag{1}\]  
\[R=\frac{1}{k+1}\sum_{j=r_{0}}^{r_{0}+k}Act_{(j)} \tag{2}\]  
Figure 7: Flowchart of the signal processing for the event-related desynchronization (ERD)/event-related synchronization (ERS) calculation.  
\[RA_{(j)}(\%)=\left(\frac{Act_{(j)}-R}{R}\right)\times 100 \tag{3}\]  
Due to the difficulty in identifying the RA pattern only with a single trial, the average of the multi-trial data was employed to eliminate the extreme outliers in the data and minimize noise. Moreover, the double moving average was used to more clearly represent the data patterns. As the ERD peak was detected before a stimulus was given, the minimum value was selected among the data collected 1 to 2 s before a stimulus occurred. The ERS peak was selected as the maximum value at 1 s after occurrence on the stimulus. The minimum ERD and the maximum ERS values are the key states of the CNS that express participation in the activity of responses to movement or stimulus, indicating an induced response of changes in EEG oscillation [22]. Averaging the induced response allowed us to minimize the noise data and increase the signal-to-noise ratio (SNR). As the change in the stimulus became more notable in the idle state, the amplitudes were compared with each other to determine the cognitive characteristics.  
The normality of each data group was verified to compare the movement intention according to the operating method, and the two-way ANOVA was performed with a statistical significance level of 0.05. This method allowed to solve the increase in type-I error due to the multi-test problem when repeatedly using t-tests in multiple group comparisons, and also to validate the difference between groups with two or more independent variables. Therefore, we distinguished the tasks as a group of independent variables and set the \(\alpha\) and \(\beta\) waves as independent variables and the ERD/ERS peak values as a dependent variable. The resulting F statistic was the difference between groups for intra-group differences, and the larger the F-value, the more pronounced the difference between the groups.