## 4 Pairwise Clock Synchronization under Exponential Delays
### Joint Estimation of Clock Offset and Skew under Exponential Delays
#### 4.2.1 Removing Nuisance Parameters  
Based on the two-way message exchange mechanism in Equation (2) and assuming symmetric exponential delays, the likelihood function based on observations \(\{U_{i}\}_{i=1}^{N}\) and \(\{V_{i}\}_{i=1}^{N}\) is given by:  
\[\begin{split} p(\mathbf{T}_{i}|d,\theta,f,\lambda)=& \lambda^{-2N}\exp\left[-\frac{1}{\lambda}\left(\sum_{i=1}^{N}\frac{T_{i}^{b}-T _{i}^{c}}{f}-\sum_{i=1}^{N}(T_{i}^{a}-T_{i}^{d})-2 Nd\right)\right]\\ &\times\prod_{i=1}^{N}I\left[\frac{T_{i}^{b}-\theta}{f}-T_{i}^{a }-d\geq 0;T_{i}^{d}-\frac{T_{i}^{c}-\theta}{f}-d\geq 0\right]\end{split} \tag{21}\]  
It is observed that the likelihood function Equation (21) assumes a complicated expression, and the MLEs might be difficult to derive. According to this observation, an algorithm for joint estimation of clock offset and skew, referred to as the ML-like estimator (MLL), was proposed in [18] by using the first and last observations of timing message exchanges. Specifically, from the first equation in Equation (2), subtracting \(T_{1}^{b}\) from \(T_{N}^{b}\) yields:  
\[T_{N}^{b}-T_{1}^{b}=f\cdot(T_{N}^{a}-T_{1}^{a}+X_{N}-X_{1}) \tag{22}\]  
Similarly, from the second equation in Equation (2), subtracting \(T_{1}^{c}\) from \(T_{N}^{c}\) leads to:  
\[T_{N}^{c}-T_{1}^{c}=f\cdot(T_{N}^{d}-T_{1}^{d}+Y_{1}-Y_{N}) \tag{23}\]  
Such an approach helps to remove the explicit dependency on the nuisance parameters \(\lambda\), \(d\) and \(\theta\). In addition, an ML-like estimate \(\hat{f}_{\text{MLL}}\) of the clock skew is derived using Equation (22) and (23). Finding an estimate of the clock offset is achieved by rewriting Equation (2) as:  
\[U_{i}^{\prime}= d^{\prime}+\theta+X_{i}^{\prime}\] \[V_{i}^{\prime}= d^{\prime}-\theta+Y_{i}^{\prime}\]  
where \(U_{i}^{\prime}=T_{i}^{b}-T_{i}^{a}\hat{f}_{\text{MLL}},V_{i}^{\prime}=T_{i}^{ d}\hat{f}_{\text{MLL}}-T_{i}^{c},X_{i}^{\prime}=X_{i}\hat{f}_{\text{MLL}},Y_{i}^{ \prime}=Y_{i}\hat{f}_{\text{MLL}}\), and \(d^{\prime}=d\hat{f}_{\text{MLL}}\). It can be seen that the above model shares the same form as the no-skew model in Equation (4). Therefore, an ML-like estimate of the clock offset is obtained \(\hat{\theta}_{\text{MLL}}=(U_{(1)}^{\prime}-V_{(1)}^{\prime})/2\). The above algorithm for joint estimation of clock offset and skew is computationally simple, but it exhibits a suboptimal performance compared to the maximum likelihood estimator, since it exploits a reduced set of statistics. That is the reason why the above estimator is referred to as the ML-like estimator.  
Another approach to remove the nuisance parameter was reported in [32] by adding two equations in Equation (2). It follows that:  
\[T_{i}^{b}+T_{i}^{c}=f(T_{i}^{a}+T_{i}^{d})+2\theta+f(X_{i}-Y_{i}) \tag{24}\]  
where the nuisance parameter \(d\) is removed. Dividing the above expression by \(f\) and defining \(\theta_{1}=1/f\) and \(\theta_{2}=\theta/f\) leads to a new model represented in matrix form as follows:  
\[\left[\begin{array}{c}T_{1}^{a}+T_{1}^{d}\\ \vdots\\ T_{N}^{a}+T_{N}^{c}\end{array}\right]=\left[\begin{array}{cc}T_{1}^{b}+T_{1 }^{c}&-2\\ \vdots&\vdots\\ T_{N}^{b}+T_{N}^{c}&-2\end{array}\right]\left[\begin{array}{c}\theta_{1}\\ \theta_{2}\end{array}\right]+\left[\begin{array}{c}Y_{1}-X_{1}\\ \vdots\\ Y_{N}-X_{N}\end{array}\right] \tag{25}\]Assuming symmetric exponential delays, it is easy to verify that \(Z_{i}\stackrel{{\triangle}}{{=}}X_{i}-Y_{i}\) follows a Laplace distribution with location parameter zero and scale parameter \(1/\lambda\). Thus, the log-likelihood function for model Equation (25) is expressed as:  
\[\ln p(\mathbf{T}_{i}|\theta_{1},\theta_{2})=N\ln\frac{\lambda}{2}-\lambda\sum \limits_{i=1}^{N}|T_{i}^{a}+T_{i}^{d}-\theta_{1}(T_{i}^{b}+T_{i}^{c})+2\theta _{2}| \tag{26}\]  
Therefore, the MLEs of \(\theta_{1}\) and \(\theta_{2}\) can be found by maximizing Equation (26), and the corresponding estimators for \(\theta\) and \(f\) are obtained using the relationships \(\theta_{1}=1/f\) and \(\theta_{2}=\theta/f\).