## 3 Least Squares Estimation Model for GNSS Positioning and Outlier Correction
### Receiver Autonomous Integrity Monitoring Model for Outlier Detection and Removal  
RAIM is a self-monitoring process in a GNSS receiver to provide protection against the measurement faults. The classic RAIM scheme uses observation residual vector from the LSE for outlier prediction and tracking.  
\[\mathbf{r}_{\rho}\cong\Delta\rho-\mathbf{H}\Delta X^{u} \tag{6}\]  
\(\mathbf{r}_{\rho}\) is the observation error residual vector. Replacing \(\Delta X^{u}\) from Equation (4) into Equation (6),  
\[\mathbf{r}_{\rho}\cong(I-\mathbf{H}{(\mathbf{H}^{T}\mathbf{H})}^{-1}\mathbf{H }^{T})\Delta\rho \tag{7}\]  
The test statistic for fault isolation is defined as the sum of the squared residual errors,  
\[v=\mathbf{r}_{\rho}^{T}\mathbf{r}_{\rho} \tag{8}\]  
Under a fault-free positioning condition, the corresponding test statistic \(v\) follows a chi-square (\(\chi^{2}\)) distribution with \(\overline{\mathbf{n}}-\overline{v}\) degree of freedom where \(\overline{\mathbf{n}}\) is the number of measurements and \(\overline{v}\) is the number of unknowns, and should be less than a predefined threshold T\({}_{th}\). The system false alarm probability P\({}_{FA}\) and misdetection probability P\({}_{md}\) are used to calculate the T\({}_{th}\).  
\[\mathrm{P}_{FA}=\mathrm{P}\{\,v>\mathrm{T}_{th}|\text{no fault}\} \tag{9}\]  
\[\mathrm{P}_{md}=\mathrm{P}\{\,v<\mathrm{T}_{th}|\text{fault in sat}\} \tag{10}\]  
Mathematically P\({}_{FA}\) and P\({}_{md}\) are expressed as [6],  
\[\mathrm{P}_{FA}=\int\limits_{thr}^{\infty}\left[\frac{v^{\left(\frac{\overline {\mathbf{n}}-\overline{v}}{2}-1\right)}e^{\frac{-\overline{v}}{2\omega^{2}}}}{ \left[\frac{\overline{\mathbf{n}}-\overline{v}}{2}\Gamma\left(\frac{\overline {\mathbf{n}}-\overline{v}}{2}\right)\sigma^{\overline{\mathbf{n}}-\overline{ v}}\right]}\right]dv \tag{11}\]  
\[\mathrm{P}_{md}=\int\limits_{0}^{thr}\left[\frac{1}{2\sigma^{2}}e^{\frac{2+ \overline{v}}{2\omega^{2}}}\left(\frac{v}{8^{2}}\right)^{\left(\frac{\overline {\mathbf{n}}-\overline{v}}{4}-\frac{1}{2}\right)}I_{\frac{\overline{\mathbf{n }}-\overline{v}}{2}\left(\frac{\mathbf{s}}{\sigma^{2}}\sqrt{v}\right)}\right]dv \tag{12}\]  
\(\Gamma(\alpha)\) and \(I_{a}(t)\) are the gamma and the first order Bessel function respectively; \(\sigma^{2}\) is the variance of measurement error and \(\mathbf{s}=\sqrt{E[\mathbf{r}_{\rho}^{T}]E[\mathbf{r}_{\rho}]}\). If the test statistic exceeds the threshold, the presence of fault is confirmed. Referring to [7; 8], the standardized outlier test is defined as,  
\[q_{l}=\frac{|e_{l}^{T}\mathbf{r}_{\rho}|}{\sqrt{e_{l}^{T}Q_{v}e_{l}}} \tag{13}\]  
\(e_{l}=\left[0,\ldots,1,\ldots 0\right]^{T}\), the \(l\)_th_ element equal to 1 while others are zeros. \(Q_{v}\) is the cofactor matrix of the estimated residuals and is defined as,  
\[Q_{v}=\left(I-\mathbf{H}{(\mathbf{H}^{T}\mathbf{H})}^{-1}\mathbf{H}^{T}\right) \tag{14}\]A second test is performed to isolate the faulty measurements.  
\[\left|q_{j}\right|>\left|q_{l}\right|\forall l\text{ and }\left|q_{j}\right|> \mathrm{N}_{\frac{\alpha_{o}}{2}}(0,1) \tag{15}\]  
\(\alpha_{o}\) is the probability of false alarm.