## 2 Positioning Model and Residual Analysis
### Double-Difference Pseudorange Residual Analysis  
The DD pseudorange is the basic observation of pseudorange relative positioning, and its quality directly affects the positioning. The DDPR is determined by subtracting the DD geometric distance between the satellite and the receiver from the DD pseudorange observation, and the equation is the following:  
\[\text{DDPR}=\
abla\Delta P-\
abla\Delta\rho=\
abla\Delta I+\
abla\Delta T+ \
abla\Delta M+\
abla\Delta O+\
abla\Delta\epsilon \tag{8}\]  
It can be seen that the DDPR mainly includes the DD troposphere, ionosphere, satellite orbit, multipath error, and observational noise. This metric accurately reflects the quality of the observations when the terminal coordinates are precisely known. To enhance the quality of a reference station's observations, a geodesic receiver can be used for relative positioning. This helps reduce both the multipath error and observational noise, thus improving the overall quality of observations by a reference station. Moreover, when the distance between the smartphone and the reference station is short, the influence of DD atmospheric and orbit errors can be disregarded. As a result, the DDPR primarily reflects the observational noise and multipath error of a smartphone. Figure 1 illustrates the DDPRs of each GPS/BDS satellite in a relatively open environment with an ultra-shortbaseline. Specifically, Figure 1a represents the Huawei P40 smartphone, while Figure 1b represents the geodesic receiver, and the two terminals were in the same location and correspond to the same reference station. From the figure, it is evident that the DDPRs exhibit significant differences between the smartphone and the geodesic receiver. The DDPRs of the geodesic receiver predominantly fall within the range of \(-2\) m to \(2\) m, without any abnormally large values during testing. In contrast, the DDPRs of the smartphone show substantial variation among satellites and are primarily concentrated in the range of \(-20\) m to \(20\) m. Some epochs even display intermittent jumps, reaching nearly \(100\) m. Preliminary analysis suggested that smartphones use linear polarized antennas and low-cost, low-power navigation chips, their observation noise is high, and compared with geodesic receivers, they are more susceptible to errors such as multipath effects or NLOSs, resulting in large DDPRs. Consequently, effective detection and elimination of signals with gross errors or reduction in the observational weight of poor-quality observations can potentially enhance the positioning accuracy.  
However, in practical applications, precise terminal coordinates are often unknown, making it challenging to obtain an accurate DDPR to assess observational quality. To overcome this limitation, this study proposes selecting a subset of satellites with the most reliable observational quality for positioning, thus obtaining an initial terminal position. These chosen satellites are less susceptible to multipath, NLOS, and other errors, yielding relatively dependable positioning results. Based on this approach, the DDPRs of all visible satellites can be estimated. Although the residuals are not accurate enough due to the approximate position of the terminal, they can still reflect large gross errors such as multipath ones and NLOSs in the observations to a certain extent. Finally, the stochastic model of observations was constructed by using DDPRs to further improve positioning accuracy.  
Figure 1: DDPRs of different terminals in a relatively open environment. (**a**) Huawei P40 smartphone. (**b**) Geodesic receiver.