# Ambiguity-Resolved Model Tests for Carrier-Phase GNSS
## 3 The AF and AK Tests
### The Ambiguity-Known Test  
The AK test statistic is obtained from (4) by setting \(a_{0}=a\) and assuming \(a\) as known. This gives, with the help of Lemma 1,  
\[\underline{T}(a,a)=||\underline{\hat{e}}_{0}(a)||^{2}_{Q_{yy}}-||\underline{ \hat{e}}_{a}(a)||^{2}_{Q_{yy}}=||\underline{\hat{e}}(a)||^{2}_{Q_{zz}} \tag{9}\]It is distributed under \(\mathcal{H}_{0}\) and \(\mathcal{H}_{a}\) as  
\[\mathcal{I}(\hat{\mathbbm{a}}_{0},\hat{\mathbbm{a}})\left\{\begin{array}{ll} \mathcal{H}_{0}&\chi^{2}(q,0)\\ \mathcal{H}_{a}&\chi^{2}(q,\lambda_{\text{AK}})\end{array}\right. \tag{10}\]  
with noncentrality parameter \(\lambda_{\text{AK}}=||c||_{\mathbb{Q}_{\ell(a)\ell(a)}}^{2}\).  
Again, a special case occurs when, under the alternative hypothesis, the mean of \(y\) is allowed to vary freely over the whole of \(\mathbb{R}^{m}\) while \(a\) is known, i.e., when \(\mathcal{R}(B,C)=\overline{\mathbb{R}}^{m}\). Then, \(\hat{\varrho}_{a}(a)\equiv 0\) and (6) reduces, with the help of Lemma 1, to  
\[\underline{T}(a,a)=||\hat{\varrho}_{0}(a)||_{Q_{yy}}^{2}=||\hat{\varrho}_{0}|| _{Q_{yy}}^{2}+||\hat{\varepsilon}_{0}(a)||_{Q_{0}\ell_{0}}^{2} \tag{11}\]  
This is the test statistic that is used for AK _detection_, i.e., for testing the ambiguity-known null hypothesis against the most relaxed ambiguity-known alternative hypothesis.  
Note that both detectors, (8) and (11), are expressed in the _singular_ residual vector \(\hat{\varrho}_{0}\). A useful alternative expression follows if one makes use of \(\mathcal{H}_{0}\)'s _misclosure vector_, which has a nonsingular distribution. The misclosure vector is defined as \(\underline{t}_{0}=D^{T}y\), with \(D\in\mathbb{R}^{m\times(m-n-p)}\) being a basis matrix of the null space of \([A,B]^{T}\), i.e., \(D^{T}[A,B]=0\). Then, \(\hat{t}\stackrel{{\mathcal{H}_{0}}}{{\sim}}\mathcal{N}_{m-n-p}(C_ {0},C,Q_{0\ell_{0}})\), with \(C_{t_{0}}=D^{T}C\) and \(Q_{t\ell_{0}}=D^{T}Q_{yy}D\). From expressing \(\hat{\varrho}_{0}\) in \(\underline{t}_{0}\) as \(\hat{\varrho}_{0}=Q_{yy}D(D^{T}Q_{yy}D)^{-1}\underline{t}_{0}\), it follows that  
\[||\hat{\varrho}_{0}||_{Q_{yy}}^{2}=||\underline{t}_{0}||_{Q_{t\ell_{0}}}^{2} \tag{12}\]  
In order to compare the performance of the AF and AK tests, we compare their power. Since the estimator \(\hat{\varrho}(a)\) is more precise than \(\hat{\varrho}\), we have \(Q_{\ell(a)\ell(a)}\leq Q_{\ell\hat{\varrho}}\) and, therefore, \(\lambda_{\text{AK}}\geq\lambda_{\text{AF}}\). This shows that the _power_ of the AK test will never be smaller than that of the AF test, i.e., \(\mathsf{P}[\underline{T}(a,a)>\tau_{a}|\mathcal{H}_{a}]\geq\mathsf{P}[ \underline{T}(\hat{\mathbbm{a}}_{0},\hat{\mathbbm{a}})>\tau_{a}|\mathcal{H}_{a}]\). As an example application, we consider the presence testing of a differential tropospheric zenith delay based on a single-epoch, single-frequency, double-differenced (DD) GPS model. Figure 1 shows the power functions of the two tests, thereby illustrating the significant improvement in power that can be achieved with carrier-phase GNSS once all \(n=7\) double-differenced ambiguities are known.