## 2 Methodology
### Parameter Initialization and Updating Algorithm
To this end, we developed a recursive algorithm by integrating KF and EM for parameter update and estimation. The proposed algorithm consists of two main steps. The KF-step focuses on the estimate and update of the system state, and the EM-step aims to estimate other unknown and non-updating parameters in the observation equation. Recall that the initial mean and variance of drift is \(\mu_{\lambda,0}\) and \(\sigma_{\lambda,0}^{2}\), i.e., \(\lambda_{0}\sim N\Big{(}\mu_{\lambda,0},\sigma_{\lambda,0}^{2}\Big{)}\). In addition, the hidden state \(\lambda_{i}\) can be estimated once the observed monitoring data up to \(t_{i}\), i.e., \(\mathbf{y_{i}}=\{y_{1},\cdots,y_{i}\}\), are available. Denote the mean and variance of \(\lambda_{i}\) by \(\mathrm{E}_{\mathrm{\beta}i}=\mathrm{E}\big{(}\lambda_{i}|\mathbf{y_{i}}\big{)}\) and \(\mathrm{Var}_{\mathrm{\beta}i}\!\!=\mathrm{Var}\big{(}\lambda_{i}|\mathbf{y_{i}} \big{)}\) respectively. To obtain \(\mathrm{E}_{\mathrm{\beta}i}\) and \(\mathrm{Var}_{\mathrm{\beta}i}\), we need to calculate the conditional PDF of \(\lambda_{i}\) given \(\mathbf{y_{i}}\), denoted by \(p\big{(}\lambda_{i}|\mathbf{y_{i}}\big{)}\). Recursion solution of \(p\big{(}\lambda_{i}|\mathbf{y_{i}}\big{)}\) can be estimated from \(p\big{(}\lambda_{i-1}|\mathbf{y_{i-1}}\big{)}\) using the well-adopted Bayesian rule, i.e.,  
\[ \begin{array}{l}p\big{(}\lambda_{i}|\mathbf{y_{i}}\big{)}\qquad=\int_{\infty}^{+ \infty}p(\lambda_{i}|\lambda_{i-1})p\big{(}\lambda_{i-1}|\mathbf{y_{i}}\big{)}d \lambda_{i-1}\\ \qquad=\frac{\int_{\infty}^{+\infty}p\big{(}\lambda_{i}|\lambda_{i-1}|p\big{(}y _{i}|\lambda_{i-1}|\mathbf{y_{i-1}}\big{)}p\big{(}\lambda_{i-1}|\mathbf{y_{i-1}}\big{)} d\lambda_{i-1}}{p\big{(}y_{i}|\mathbf{y_{i-1}}\big{)}}.\end{array}  \tag{15}\]  
Combing Equation (13) to Equation (15), we could obtain that \(p\big{(}\lambda_{i}|\mathbf{y_{i}}\big{)}\) follows Gaussian distribution with mean \(E_{\mathrm{\beta}i}\) and variance \(\mathrm{Var}_{\mathrm{\beta}i}\), i.e.,  
\[p\Big{(}\lambda_{i}|\mathbf{y_{i}}\Big{)}=\frac{1}{\sqrt{2\pi\mathrm{Var}_{\mathrm{ \beta}i}}}\exp\!\left(-\frac{\left(\lambda_{i}-E_{\mathrm{\beta}i}\right)^{2}}{2 \mathrm{Var}_{\mathrm{\beta}i}}\right), \tag{16}\]  
where both \(\mathrm{E}_{\mathrm{\beta}i}\) and \(\mathrm{Var}_{\mathrm{\beta}i}\) can be estimated by using the following KF-step (Algorithm 2). Following the KF-step, the historical monitoring data can be captured via recursively updating \(\text{E}_{\text{i}\text{j}i}\) and \(\text{Var}_{\text{i}\text{j}i}\), based on which the conditional PDF of \(\lambda_{i}\), i.e., \(p\big{(}\lambda_{i}|\mathbf{y}_{i}\big{)}\), is derived. On the basis of the estimated \(p\big{(}\lambda_{i}|\mathbf{y}_{i}\big{)}\), we need to update the unknown parameters including \(\mu_{\lambda}\), \(\sigma_{\lambda}^{2}\), \(m\), \(\theta\), \(\sigma_{m}^{2}\) and \(\kappa\). Define parameter vector \(\widetilde{\Theta}=[\Theta,\kappa]^{\prime}\), then the log-likelihood function of \(\mathbf{y}_{i}\) can be given as  
\[ \begin{array}{ll}\ln L_{i}\big{(}\widetilde{\Theta})&=\ln p\big{(}\mathbf{y}_{i },\mathbf{\lambda_{i}}|\widetilde{\Theta}\big{)}\\ &=\ln p\Big{(}\mathbf{y}_{i}|\mathbf{\lambda_{i}},\widetilde{\Theta}\big{)}+\ln p\big{(} \mathbf{\lambda_{i}}|\widetilde{\Theta}\big{)}\\ &=\ln p\big{(}\lambda_{0}|\widetilde{\Theta}\big{)}+\sum_{j=1}^{i}\ln p\big{(} \lambda_{j}\big{|}\lambda_{j-1},\widetilde{\Theta}\big{)}+\sum_{j=1}^{i}\ln p \Big{(}y_{j}\big{|}\lambda_{j-1},\widetilde{\Theta}\big{)},\end{array}  \tag{17}\]  
where \(\mathbf{\lambda_{i}}=\{\lambda_{0},\lambda_{1},\cdots,\lambda_{i-1}\}\) denotes the history of the updated drift parameters, and \(p\big{(}\mathbf{y}_{i},\mathbf{\lambda_{i}}|\widetilde{\Theta}\big{)}\) denotes the joint PDF of the observed monitoring data \(y_{i}\).