## 2 Improved Cycle-Slip Detection and Repair Algorithm
\right]=\left(\mathbf{B}^{T}\mathbf{B}\right)^{-1}\mathbf{B}^{T}L \tag{9}\]  
The coefficients of the ionospheric delays are assumed as \(\mathbf{b}\). Thus, the estimated ionospheric delays can be written as:  
\[\hat{I}=\mathbf{b}^{T}L \tag{10}\]  
However, the variations of the total electron content (TEC) could be assumed as a polynomial model during a short time (one hour) given an inactive ionosphere period, which can be concluded from the estimated errors of ionospheric delays (Figure 4). Therefore, this study takes a polynomial function to fit the ionospheric delays in short time (five epochs). Thus:  
\[\hat{I}_{(t)}=\theta_{0}+\theta_{1}t+\theta_{2}t^{2}+e^{\prime}_{m} \tag{11}\]  
where \(\theta\) is the polynomial coefficients; \(t\) is the epoch point, and \(e^{\prime}_{m}\) is the model fitting residual. The ionospheric delay is assumed to be fitted by five epochs. Then:  
\[\mathbf{I}=\mathbf{G}\mathbf{\theta}+d\mathbf{I} \tag{12}\]  
where \(\mathbf{I}=\left[ \begin{array}{cccc}\hat{1}_{(t-5)}&\hat{1}_{(t-4)}&\hat{1}_{( t-3)}&\hat{1}_{(t-2)}&\hat{1}_{(t-1)}\end{array} \right]^{T}\), \(\mathbf{\theta}=\left[ \begin{array}{cc}\theta_{0}&\theta_{1}&\theta_{2}\end{array}  \right]^{T}\), \(\mathbf{d}\mathbf{I}=\left[ \begin{array}{cc}(e^{\prime}_{m})_{1}&\cdots&(e^{\prime}_{ m})_{5}\end{array} \right]^{T}\) and \(\mathbf{G}=\left[ \begin{array}{cccc}1&1&1&1\\ -5&-4&-3&-2&-1\\ 25&16&9&4&1\end{array} \right]^{T}\)  
The coefficients of polynomial function are computed as follows:  
\[\hat{\mathbf{\theta}}=\left(\mathbf{G}^{T}\mathbf{G}\right)^{-1}\mathbf{G}^{T}\mathbf{I} \tag{13}\]  
Then, the current epoch is set as \(t=0\). Therefore, the prediction of ionospheric delay is:  
\[\mathbf{\tilde{I}}_{(t)}=\hat{\theta}_{0}=\mathbf{g}^{T}\mathbf{I} \tag{14}\]where \(\mathbf{g}=\left[ \begin{array}{cccc}g_{1}&g_{2}&g_{3}&g_{4}&g_{5}\end{array} \right]^{T}\) represents the coefficients of five ionospheric delays. By inserting Equations (7) and (14) into Equation (6), we obtain:  
\[ \begin{array}{l}\sigma_{A\widehat{T}}^{2}=\text{var}[e_{m}]+\text{var}[d \hat{\theta}_{0}]+\text{var}[d\hat{I}_{(t-1)}]-2\text{cov}[d\hat{\theta}_{0},d \hat{I}_{(t-1)}]\\ =\sigma_{m}^{2}+(\mathbf{g}^{T}\mathbf{g})(\mathbf{b}^{T}\mathbf{b})\sigma_{L}^{2}+\mathbf{b}^{T} \mathbf{b}\sigma_{L}^{2}-2\text{cov}[g_{5}d\hat{I}_{(t-1)},d\hat{I}_{(t-1)}]\\ =\sigma_{m}^{2}+[(\mathbf{g}^{T}\mathbf{g})+1-2g_{5}](\mathbf{b}^{T}\mathbf{b})\sigma_{L}^{2} \end{array}  \tag{15}\]  
\[ \begin{array}{l}\mathbf{c}=\text{cov}[\Delta_{L}^{2}\Delta\widehat{I}]=\text{ cov}[-\bar{\varsigma}_{(t-1)}d\theta_{0}-d\hat{I}_{(t-1)}]\\ =\text{cov}[-\bar{\varsigma}_{(t-1)}(g_{5}-1)\mathbf{b}^{T}\bar{\varsigma}_{(t-1 )}]=(1-g_{5})\sigma_{L}^{2}\mathbf{b}\end{array}  \tag{16}\]  
In Equation (6), \(\mathbf{Q}\) can be simplified as:  
\[\mathbf{Q}=\sigma_{m}^{2}\mathbf{k}\mathbf{k}^{T}+\overline{\mathbf{Q}} \tag{17}\]  
where \(\overline{\mathbf{Q}}=\left\{(\mathbf{b}^{T}\mathbf{b})[(\mathbf{g}^{T}\mathbf{g})+1-2g_{5}]\mathbf{k }\mathbf{k}^{T}+E_{2}-(1-g_{5})\mathbf{k}\mathbf{b}^{T}-(1-g_{5})\mathbf{b}\mathbf{k}^{T}\right\} \sigma_{L}^{2}\) and \(E_{2}\) is an identity matrix with two dimensions. Based on the matrix inversion lemma, \(\mathbf{Q}\) can be expressed as:  
\[\mathbf{Q}^{-1}=\overline{\mathbf{Q}}^{-1}-\frac{\sigma_{m}^{2}}{1+\sigma_{m}^{2}\mathbf{ k}^{T}\overline{\mathbf{Q}}^{-1}\mathbf{k}}\overline{\mathbf{Q}}^{-1}\mathbf{k}\mathbf{k}^{T} \overline{\mathbf{Q}}^{-1}=\overline{\mathbf{Q}}^{-1}-\theta_{m}\mathbf{M} \tag{18}\]  
where \(\mathbf{M}=\overline{\mathbf{Q}}^{-1}\mathbf{k}\mathbf{k}^{T}\overline{\mathbf{Q}}^{-1}\), and \(\theta_{m}=\frac{\sigma_{m}^{2}}{1+\sigma_{m}^{2}\mathbf{k}^{T}\overline{\mathbf{Q}}^{- 1}\mathbf{k}}\).