# A Wi-Fi FTM-Based Indoor Positioning Method with LOS/NLOS Identification
## 3 The Proposed Indoor Localization Method
### The Identification Model of LOS/NLOS
#### 3.2.3 The Determination of \(\sigma\)  
\(\sigma\) is the variance of RSSIs collected at a fixed point. In the literature [24; 25], the variances of RSSIs collected at different distances have traditionally been set as a fixed value. According to the analysis in the second section, we assumed that the variances of RSSIs at different distances were different. For this reason, the variances were calculated, as shown in Table 2. It can be seen that the variance decreased by about 1 dBm\({}^{2}\) from 0 to 6 m, while it nearly did not change from 6 to 18 m. According to the trend of change, the exponential function was used to fit the variances and ranging results. To verify if the function was suitable, the sum of squares due to error (SSE) and coefficient of determination (R-square) of the fitting result was compared with that found by other functions, including the Fourier, Gaussian, linear fitting, polynomial, rational, and sum of sine functions, shown in the Table 3. SSE and R-square can be calculated by Equation (10) and Equation (11), where \(\overline{RSSI}\) is the average of RSSI. The smaller the SSE or the bigger the R-square, the better the fitting results will be. It can be seen that from both the SSE and R-square that the exponential function is more suitable. \[SSE=\sum\limits_{i=1}^{N}{(RSSI^{(i)}-RSSI^{(i)}_{fit})} \tag{10}\]  
\[R-square=\frac{\sum\limits_{i=1}^{N}{(\overline{RSSI}-RSSI^{(i)}_{fit})}}{ \sum\limits_{i=1}^{N}{(\overline{RSSI}-RSSI^{(i)})}} \tag{11}\]  
For the fitting, a large amount of RSSIs with the same ranging results should be obtained. However, due to different ranging results, a credible variance was hard to achieve. The ranging results were divided into several 0.5 m-long ranges. Next, all the training data were put into the corresponding range according to the ranging results. Then, the average of the ranging results and the variances of RSSIs in each range were calculated and used as the input of the fitting. The variances were calculated by the following two methods:  
1. The variances of RSSIs were directly calculated, according to Equation (7). 2. All the RSSIs were counted in a certain interval and the probabilities of each RSSI were calculated. Then, the Gaussian regression was performed on the probability and the corresponding RSSI. \(\sigma\) of the Gaussian model was taken as the \(\sigma\) of the current distance. After the \(\sigma\) values were determined, the ranging results and \(\sigma\) values were fitted to generate a ranging result-based \(\sigma\) model. Figure 8 shows the fitting results of methods A and B. The red dot is the \begin{table}
\begin{tabular}{c c c c c c} \hline \hline
**Distance Range (m)** & **0–3** & **3–6** & **6–9** & **9–12** & **12–15** & **15–18** \\ \hline \(\sigma\) (dBm) & 3.48 & 2.34 & 1.66 & 1.69 & 1.74 & 1.74 \\ \hline \hline \end{tabular}
\end{table} 
Table 2: Variance of RSSIs at different distances. \begin{table}
\begin{tabular}{c c c} \hline \hline
**Fitting Function** & **SSE (dBm\({}^{2}\))** & **R-Square Value** \\ \hline Our Model & 72.77 & 0.48 \\ Fourier & 85.70 & 0.40 \\ Linear Fitting & 99.85 & 0.30 \\ Polynomial & 115.13 & 0.19 \\ Rational & 92.79 & 0.35 \\ Sum of Sine & 115.14 & 0.19 \\ \hline \hline \end{tabular}
\end{table} 
Table 3: Sum of squares due to error (SSE) and coefficient of determination (R-square) values of the different fitting functions. variance calculated by method A, while the blue point is the variance calculated by the other method. The fitting results and raw data are shown in Figure 8a, and the residuals of the two methods are shown in Figure 8b. It can be seen that variances calculated by method B fluctuate largely, which might be caused by over-fitting. In the range of 0-4 m, the variance of method B is higher than 15. Table 1 shows that the attenuation of RSSI caused by the reinforced concrete is about 15 dBm, so that when the variance is higher than 15, the output probability of LOS and NLOS is similar, which may make the set of threshold and identification difficult.