## 3 Statistical Hypothesis Testing
After standardization, we obtain a new random variable \(V\) that obeys the standard normal distribution, which can be written as  
\[V=\frac{1}{\sqrt{18}}\sum_{W\in\{Z,X\},\ k,\ l\in\{0,1,2\}}\frac{n^{W}_{\mu_{k }\
u_{l}}-P^{2}_{W}P_{\mu_{k}\
u_{l}}N_{data}Q^{W}_{\mu_{k}\
u_{l}}}{\sqrt{P^{ 2}_{W}P_{\mu_{k}\
u_{l}}N_{data}(1-Q^{W}_{\mu_{k}\
u_{l}})}}\sim N(0,1). \tag{9}\]  
Furthermore, \(\Phi(v)\) is the distribution function of \(V\), given by  
\[\Phi(v)=\frac{1}{\sqrt{2\pi}}\int_{-\infty}^{v}e^{-\frac{v^{2}}{2}}\mathrm{d}t,\ \ -\infty<vs.<\infty, \tag{10}\]  
where \(v\) is the value of \(V\) and is just the test statistic that we find. (iii) Find the value of the test statistic. We set the parameters \(N_{data},e_{d},e_{0}\), \(p_{d}\), \(L_{uc}\), \(L_{bc}\), \(\delta,\theta\), \(P_{Z}\), \(P_{X}\), \(\mu_{k}\), \(v_{l}\), \(P_{\mu_{k}}\), and \(P_{\
u_{l}}\), where \(k,l\in\{0,1,2\}\), and we calculate the theoretical value of \(Q^{W}_{\mu_{k}\
u_{l}}\) according to Equations (2)-(4). We record \(n^{W}_{\mu_{k}\
u_{l}}\) where \(k,l\in\{0,1,2\}\), \(W\in\{X,Z\}\). We substitute the above data into Equation (9) and obtain the value of the test statistic \(v\). (iv) Choose a significance level. We need to determine a significance level \(\alpha\) (typically 0.05) for the test. In terms of the null hypothesis \(H_{0}\) of the test, we deduce that the test is a two-tailed hypothesis testing. Given \(\alpha\), the rejection region is \(|vs.|>v_{[1-\alpha/2]}\) where \(v_{[1-\alpha/2]}\) can be obtained by Equation (10). More precisely, the variables \(-v_{[1-\alpha/2]}\) and \(v_{[1-\alpha/2]}\) refer to the boundary values between the rejection region and the acceptance region for the test. Let the left side of Equation (10) be equal to \(\alpha/2\); the upper limit of the integral will be \(-v_{[1-\alpha/2]}\). According to the symmetry of the probability density function of normal distribution, \(v_{[1-\alpha/2]}\) can be obtained. (v) Make a decision. Compare the test statistic \(v\) with the critical values \(v_{[1-\alpha/2]}\) and \(-v_{[1-\alpha/2]}\). If \(v>v_{[1-\alpha/2]}\) or \(v<-v_{[1-\alpha/2]}\), we will reject \(H_{0}\) and accept \(H_{1}\). This means that we believe there is a PNS attack on the channel. Otherwise, we fail to reject \(H_{0}\). That is to say, we consider there is no PNS attack on the channel. Note that the significance level of the test \(\alpha\) is just the Type I error probability of the test, namely, the probability of mistaking no PNS attack for having a PNS attack. Let \(\beta\) denote the Type II error probability of the test, to be precise, the probability of mistaking having a PNS attack for no PNS attack. Note that \(\beta\) is usually difficult to solve in most situations. Furthermore, determining the value of \(\beta\) requires more information about the aggression behavior. If the result is judged to be a PNS attack, the secure key rate in this case can be estimated by Equation (1). Otherwise, all pulses with the \(Z\) basis leading to a successful BSM event including both single-photon pulses and multiphoton pulses can be used to generate the keys. Furthermore, the secure key rate formula Equation (1) becomes  
\[R\geq qQ^{Z}_{\mu_{2}\
u_{2}}[1-f_{e}H(E^{Z}_{\mu_{2}\
u_{2}})-H(E^{Z}_{\mu_{2} \
u_{2}})]. \tag{11}\]  
By comparing Equation (11) with Equation (1), we can easily find the secure key rate has been highly improved when the judgment result is no PNS attack. This is mainly due to the contribution of multiphoton components.