# Distributed Localization with Complemented RSS and AOA Measurements: Theory and Methods
## 3 Existing Methods
### MCMC-MH Method  
The authors in [65] proposed a different approach based on Bayesian regression. Their approach is known as Markov chain Monte Carlo with Metropolis-Hastings (MCMC-MH) algorithm [66] (Chapter 6), [67] (Chapter 12). In such an approach, one is interested in sampling from a generic distribution, i.e., from the posterior distribution of a parameter, say \(\theta\), given its prior and likelihood, i.e., \(p(\theta|y)=\frac{p(\theta)\times p(y|\theta)}{p(y)}\). This approach is often used when one knows how to write \(p(\theta|y)\), but does not know how to generate a random number from this distribution (because it is too complex). Hence, one generates a sequence of values \((\theta^{(1)},\theta^{(2)},\ldots,\theta^{(n)})\) in such a way that when \(n\to\infty\), we have that \(\theta^{(n)}\sim p(\theta|y)\). The samples \(\theta^{(n)}\) can later be exploited to estimate, for instance, the mean of the posterior distribution.  
To better explain the main idea of MCMC-MH, we divide it into three parts. In the first part, the term Monte Carlo refers to generation of random numbers from a chosen distribution, called the proposal distribution. The proposal distribution is entirely up to the user, but is usually chosen as a Normal one with predefined mean and variance. The key idea of Monte Carlo approach is that the more generations are performed, the more similar the resulting density is with the proposal density. In the second part, one has a Markov chain that is a sequence of numbers, where each number is dependent on the previous one in the sequence. If one generates a sequence of numbers using Markov chain Monte Carlo method, the trace plot of the parameter of interest, \(\theta\), is often called a random walk. Finally, the Metropolis-Hastings algorithm is used to determine which generated values of \(\theta\) to accept/reject. It is based on the proportion between the posterior probability of a newly generated value and the posterior probability of the previously accepted value, i.e.,  
\[r(\theta^{(new)},\theta^{(t-1)})=\frac{p(\theta^{(new)}|y)}{p(\theta^{(t-1)}| y)}=\frac{p(\theta^{(new)})\times p(y|\theta^{(new)})}{p(\theta^{(t-1)}) \times p(y|\theta^{(t-1)})}.\]  
One then calculates the acceptance probability of the new point as \(\alpha(\theta^{(new)},\theta^{(t-1)})=\min\left\{r(\theta^{(new)},\theta^{(t-1 )}),1\right\}\). Finally, to check whether to accept/reject the new value, one draws a uniform random number and keeps \(\theta^{(new)}\) if the acceptance probability is greater then the uniform  
Figure 8: Illustration of the least-squares fitting method.  
random number and rejects \(\theta^{(new)}\) otherwise. A simplified pseudo-code of MCMC-MH algorithm is summarized in Algorithm 1 and is graphically illustrated in Figure 9.  
```
1:Generate: \(\theta^{(new)}\) from a proposal distribution
2:Calculate: \(r\left(\theta^{(new)},\theta^{(t-1)}\right)\)
3:Calculate: \(\alpha\left(\theta^{(new)},\theta^{(t-1)}\right)\)
4:Draw: \(u\sim\mathcal{U}[0,1]\)
5:if\(u<\alpha\left(\theta^{(new)},\theta^{(t-1)}\right)\)then
6:\(\theta^{(t)}=\theta^{(new)}\)
7:else
8:\(\theta^{(t)}=\theta^{(t-1)}\)
9:endif
```  
**Algorithm 1** Summary of MCMC-MH algorithm