## 4 Discussion  
Estimation of the phase of EEG rhythms is challenging due to their low signal-to-noise ratio and dynamic nature. In this study, we presented an adaptive method to estimate the phase of alpha oscillations and compared the results with those of the AR model. Our aim was to improve real-time EEG applications that depend on phase estimates. This approach estimates instantaneous frequency and phase of an EEG segment (three channels: O1, O2, and Oz) and then forecasts the signal based on these aforementioned methods. Two prediction lengths (128 ms and 256 ms) of the EEG segment were investigated, and performance was evaluated in terms of PLV. Previously, [PERSON] [27] used the AR model [21]. For comparison and consistency purposes, we applied the AR model with the same filtering method, AR model order, length of EEG data segment, and prediction length. Additionally, we assessed how the future prediction window affected the performance of both methods. Earlier studies used the Hilbert-Huang transform [45,46] and complex wavelet transform [47] to extract frequency and phase information from EEG signals. These methods are limited because the task of predicting a future signal is hard to resolve using analysis of non-stationary data. Rendering methods such as AR assume stationarity over short time periods, therefore they are not suitable for closed- loop and real-time applications. Our adaptive method relies on frequent updates to cater for EEG signals with non-stationarity, thus making it possible to predict the future signal while adjusting to dynamic changes over time. \begin{table}
\begin{tabular}{c c c} \hline \hline \multirow{2}{*}{**Subjects**} & \multicolumn{2}{c}{**Results of Channel O1 800 ms**} \\ \cline{2-3}  & **Autoregressive (AR) Model** & **Least Mean Square (LMS)-based AR Model** \\ \cline{2-3}  & **Time Points** & **Time Points** \\ \hline
10. & 694 & * \\ \hline
11. & 630 & 678 \\ \hline
12. & 506 & 556 \\ \hline
13. & 702 & 618 \\ \hline
14. & 524 & 522 \\ \hline
15. & 796 & * \\ \hline
16. & 644 & 598 \\ \hline
17. & 528 & 578 \\ \hline
18. & * & 778 \\ \hline
19. & 566 & 598 \\ \hline
20. & 660 & 714 \\ \hline
21. & 452 & 406 \\ \hline \hline \end{tabular}
\end{table} 
Table 1: _Cont._ \begin{table}
\begin{tabular}{c c c c} \hline \hline \multirow{2}{*}{**Prediction Time Point (ms)**} & \multirow{2}{*}{\(p\)**-Value**} & **AR Model** & **LMS-Based AR Model** \\ \cline{3-4}  & & **Rayleigh’s Z Value (Mean Values)** \\ \hline
64 & \(p\) \(<\) 0.001 & 582 & 568 \\ \hline
128 & \(p\) \(<\) 0.001 & 384 & 403 \\ \hline
256 & \(p\) \(<\) 0.001 & 113 & 131 \\ \hline
340 & \(p\) \(=\) 0.010 & 50.5 & 61.18 \\ \hline
400 & \(p\) \(=\) 0.070 & 29 & 35 \\ \hline \hline \end{tabular}
\end{table} 
Table 2: Statistical comparison of [PERSON]’s \(Z\) value for channel O1 for 800 ms prediction. Considering the precise phase dynamics of an ongoing oscillation, the use of closed-loop neurostimulation has escalated significantly in the last few years. Specifically, a prior study [48] used Fast Fourier- and Hilbert transform-based algorithms for phase-locked stimulation of different EEG bands. The authors proposed a short window prediction algorithm based on an intermittent protocol with distinct windows for phase extraction and prediction. As in our study, they used the PLV metric for performance evaluation and exceeded it to 0.6 for alpha band detection. Similarly, they reported that performance declined relative to increasing the size of prediction length in both methods. The major limitations of this study were a relatively small sample size and neglect to show the functioning of a whole closed-loop system. A study published in 2018 reported three different phase prediction methods (AR model, Hilbert-based, and zero crossing) [44]. Different performance metrics were applied, including PLV, phase synchrony based on entropy, and degree deviation. Their study confirmed that PLV decreases with an increasing time-window as indicated by an increase in alpha fluctuations at longer intervals.