## 4 MS-FARIMA Algorithm and Orbit Extrapolation Improvement with MSEC
### MS-FARIMA Algorithm for Orbit Extrapolation Based on MSEC
#### 4.2.2 MS-FARIMA Algorithm for Elimination of Ephemeris Errors  
According to the previous analysis, the RE can be eliminated through MSEC. After eliminating the RE, we define the ephemeris error data as \(S^{\prime}_{orbit}(t)\). They can be decomposed into PE \(S(t)\) and TE \(R(t)\):  
\[S^{\prime}_{orbit}(t)=R(t)+S(t) \tag{33}\]  
TE \(R(t)\) reflects the ephemeris data errors in different scenarios. However, it can be predicted for certain periods in the future based on the known sequence using the TSF algorithm. This study uses the MS-FARIMA algorithm to predict TE \(R(t)\) for a future period.  
We construct a \(FARIMA(p,d,q)\) model for \(R(t)\). The details are as follows.  
1. Determine the differencing order d to render TE \(R(t)\) stationary. For TE \(R(t)\), set the differencing order \(d\) such that \(\Delta^{d}=(1-B)^{d}\). The stationary TE \(R^{\prime}(t)\) is obtained through multiple differencing processes;
2. Determine the coefficients \(p\) of the autoregressive terms and the \(q\) of the moving average terms. Select the orders \(p\) and \(q\) using the AIC. The values of \(p\) and \(q\) are chosen such that the AIC value is minimized;
3. Fitting the model parameters using the MLE, eventually we obtain the predictive model \(FARIMA(p,d,q)\);
4. Predict TE \(R(t)\) for a future period using the obtained predictive model \(FARIMA(p,d,q)\). We assume that the resulting values are \(R^{\prime\prime}(t)\), which satisfies the following equation: \[R^{\prime\prime}(t+\Delta t)=FARIMA(p,d,q)R(t)\] (34) where \(\Delta t\) represents the discrete sampling interval of the real ephemeris.
5. The final ephemeris' predicted position \(S^{\prime\prime}_{orbit}(t)\) is obtained from the predicted component \(R^{\prime\prime}(t)\) and the PE \(S(t)\), which can be expressed as \[S^{\prime\prime}_{orbit}(t)=R^{\prime\prime}(t)+S(t)\] (35) The specific implementation process is shown in Algorithm 1.  
```
Input: TLE data of \(K\) satellites: precise ephemeris \(\sigma\eta_{parc}\) for \(K\) satellites over the discrete time interval from 1 to \(T_{d}\) Output: Prediction results
101: Initialize differencing order \(d\) for satellite \(i=1:K\)
103: Read the SCOEs \(n_{i},i_{i},e_{i},M_{i},\omega_{i},\Omega_{i}\) of satellite \(i\) from \(TLE_{i}\)
104: Input the SCOEs of satellite \(i\) into the SGP4 algorithm to obtain the velocity \(V_{i}\big{(}v_{x},v_{y},v_{z}\big{)}\) and position \(R_{i}\big{(}v_{x},v_{y},v_{z}\big{)}\) of satellite \(i\)
105: Calculate the ephemeris error from the SGP4 algorithm as \(\Delta_{i}=R_{i}-\epsilon\eta_{parc}(i)\)
106: End
107: Substitute the \(K\) error values \(\Delta_{i}\) into Equations (22) and (23). Use the function \(solve\) to solve the equations and obtain the current service satellite error \(S^{\prime}_{orbit}(t)\) after eliminating the RE
108: Do
109: Use the function \(find\)s to extract the upper and lower extrema of \(S^{\prime}_{orbit}(t)\), yielding the extrema sets \(u(t)\) and \(dl(t)\), and calculate the mean \(ml(t)\)
```  
**Algorithm 1**MS-FARIMA algorithm