# Secure Transmission for Buffer-Aided Relay Networks in the Internet of Things
## 4 Performance Analysis
### Secrecy Outage Analysis
#### 4.1.1 NJ Scheme  
According to [28], the secrecy outage probability at state \(s_{n}\) under the NJ scheme is given by  
\[P_{out,n}^{N\!I}\left(\gamma_{th}\right)=F_{\gamma_{E1}^{N\!I}}\left(\gamma_{ th}\right)\cdot F_{\gamma_{E2}^{N\!I}}\left(\gamma_{th}\right). \tag{21}\]  
**Theorem 1**.: _The CDF of \(\gamma_{E1}^{NJ}\) under the NCE scenario is given by_  
\[F_{\gamma_{E1}^{NJ}}\left(x\right)=\sum_{s=0}^{M_{1,n}}\sum_{t=0}^{K-1}\left( \begin{array}{c}M_{1,n}\\ s\end{array}\right)\left(\begin{array}{c}K-1\\ t\end{array}\right)\frac{\left(-1\right)^{s+t}K\lambda_{SE}}{\lambda_{SE} \left(t+1\right)+\lambda_{SR}sx}e^{-\frac{\lambda_{SR}s\left(s-1\right)}{ \gamma_{S_{1}}}}. \tag{22}\]  
Proof of Theorem 1.: See Appendix A.  
**Theorem 2**.: _The CDF of \(\gamma_{E1}^{NJ}\) under the CE scenario can be written as_  
\[F_{\gamma_{E1}^{NJ}}\left(x\right)=\sum_{s=0}^{M_{1,n}}\left( \begin{array}{c}M_{1,n}\\ s\end{array}\right)\left(-1\right)^{s}\left(\frac{\lambda_{SE}}{\lambda_{SE} +\lambda_{SR}sx}\right)^{K}e^{-\frac{\lambda_{SR}s\left(s-1\right)}{\gamma_{S_ {1}}}}. \tag{23}\]  
Proof of Theorem 2.: See Appendix B.  
It is worth noting that, if we replace some parameters, i.e., \(M_{1,n}\to M_{2,n}\), \(P_{S_{1}}\to P_{R_{1}}\), \(\lambda_{SR}\rightarrow\lambda_{RD}\) and \(\lambda_{SE}\rightarrow\lambda_{RE}\), we can derive the CDF of \(\gamma_{E2}^{NJ}\) due to the symmetry of the first and second hops.  
Next, we proceed with the stationary probability under the NJ scheme \(\mathbf{\pi}^{NJ}\). Firstly, we denote \(\Omega_{n}\) as the set whose states can be transferred from state \(s_{n}\) successfully within one step. Then, according to the authors of [13; 38; 39], we denote \(\mathbf{A}^{NJ}\in\mathbb{R}^{N\times N}\) as the state transition matrix of the Markov chain under the NJ scheme, where the entry \(\mathbf{A}^{NJ}_{v,t}=\Pr\left[T\left(t+1\right)=s_{v}\left|T\left(t\right)=s _{n}\right.\right]\) denotes the transition probability of moving from state \(s_{n}\) to the state \(s_{v}\), where \(s_{v}\) is an element in set \(\Omega_{n}\).  
As can be seen from the relay selection policy, if the packet is not successfully transmitted to the corresponding node, the buffer state keeps unchanged. In other words, the secrecy outage event occurs. On the other hand, when the current state transforms to another state \(s_{v}\) within one step, i.e., \(s_{v}\in\Omega_{n}\), then the corresponding transmission is successful. From these observations, the entry of \(\mathbf{A}^{NJ}\) is given by  
\[\mathbf{A}^{NJ}_{v,n}=\left\{\begin{array}{ll}P_{out,n}^{NJ}\left(\gamma_{ th}\right),&s_{v}=s_{n}\\ \frac{1-P_{out,n}^{NJ}\left(\gamma_{th}\right)}{M_{1,n}+M_{2,n}},&s_{v}\in \Omega_{n}\\ 0,&else\end{array}\right.. \tag{24}\]  
Based on this, we can obtain the stationary probability vector in the following.  
**Theorem 3**.: _The stationary probability vector of the NJ scheme is given by_  
\[\mathbf{\pi}^{NJ}=\left(\mathbf{A}^{NJ}-\mathbf{I}+\mathbf{Q}\right) ^{-1}\mathbf{b}, \tag{25}\]  
_where \(\mathbf{\pi}^{NJ}=\left[\pi_{1}^{NJ},\pi_{2}^{NJ}\cdots,\pi_{N}^{NJ}\right]^{T}, \mathbf{b}=\left(1,1,\cdots,1\right)^{T}\), \(\mathbf{I}\) is the identity matrix and \(\mathbf{Q}\) is the all-ones matrix._  
Proof of Theorem 3.: The proof can be found in [13].  
Now, by substituting Equations (21) and (25) into Equation (20), the closed-form expression of the secrecy outage probability for the NCE and CE scenarios under the NJ scheme can be easily derived, respectively.