## 4 Bayesian Estimation
### Gibbs Sampling  
Deriving expectations directly through integration from the PDF of joint posterior distribution is often analytically intractable. Hence, Gibbs sampling is employed to draw samples from the posterior distribution. Before using the Gibbs sampling, we need to confirm some theorems. Theorem 3: _If \(t_{i}(i=1,2,\ldots,n)\) are observed (i.e., the data are complete) and \(\mathbf{a}=(a_{1},a_{2},\ldots,a_{s})\) is given, the conditional posterior density of \(b\) is log-concave._  
Proof: When the data are complete, the joint posterior density function is expressed as:  
\[\pi_{*}(\mathbf{a},b|data^{*})\propto b^{n+\theta^{*}}e^{-b(a^{*}+\lambda)} \prod_{j=1}^{s}a_{j}^{m_{j}+\theta_{j}-1}\prod_{i=1}^{n}[t_{i}^{b-1}(1+t_{i}^{ b})^{-(a^{*}+1)}], \tag{32}\]  
where \(data^{*}\) refers to the complete data. Therefore, the conditional posterior density of \(b\) is given by:  
\[\pi_{b}(b|\mathbf{a},data^{*})\propto b^{n+\theta^{*}}e^{-b(a^{*}+\lambda)} \prod_{i=1}^{n}[t_{i}^{b-1}(1+t_{i}^{b})^{-(a^{*}+1)}]. \tag{33}\]  
After calculation, We calculate the second-order derivative of the logarithmic function with respect to \(b\):  
\[\frac{\partial^{2}\ln\pi_{b}(b|\mathbf{a},data^{*})}{\partial b^{2}}=-\frac{n +\theta^{*}}{b^{2}}-(a^{*}+1)\sum_{i=1}^{n}\frac{t_{i}^{b}(lnt_{i})^{2}}{(1+t_{ i}^{b})^{2}}<0; \tag{34}\]thus, we can see that the conditional posterior density function of \(b\) is log-concave, which indicates that we can employ the adaptive rejection sampling [24] to draw samples from the posterior conditional distribution of \(b\). When the data are complete and \(b\) is given, the conditional posterior of \(a_{j}(j=1,\ldots,s)\) follows a Gamma distribution. Through (32), we know that the conditional posterior density functions of \(a_{j},j=1,2,\ldots,s\) are as follows:  
\[ \begin{split}\pi_{j*}(a_{j}|&\mathbf{a}_{-j},b, data^{*})\propto e^{-h_{j}}a_{j}^{m_{j}+\theta_{j}-1}\prod_{i=1}^{n}(1+t_{i}^{b}) ^{-a_{j}}\\ &=e^{-a_{j}(b+\sum_{i=1}^{n}\ln(1+t_{i}^{b}))}a_{j}^{m_{j}+\theta _{j}-1},j=1,2,\ldots,s,\end{split}  \tag{35}\]  
where \(\mathbf{a}_{-j}\) represents vector \((a_{1},a_{2},\ldots,a_{j-1},a_{j+1},\ldots,a_{s})\). Thus, \(a_{j}\) follows the Gamma conditional posterior distribution with the shape parameter \(m_{j}+\theta_{j}\) and the rate parameter \(b+\sum_{i=1}^{n}\ln(1+t_{i}^{b})\). For those censored data, if we have the estimated values of \(a_{j}\) and \(b\), we can use \(\tilde{t}_{i}\) to substitute \(t_{i}\), where \(\tilde{t}_{i}\) can be sampled from the conditional distribution of \(T_{i}\). The conditional density function of \(T_{i}\) is given by:  
\[f_{\{T|T\in[l_{i}r_{i}],D_{i}=j\}}(t,j;\mathbf{a},b)=\frac{f(t,j;\mathbf{a},b )}{F(r_{i},j;\mathbf{a},b)-F(l_{i},j;\mathbf{a},b)},l_{i}<t<r_{i}. \tag{36}\]  
According to the two theorems above, in Algorithm 2, the Gibbs sampling procedure is shown. ```
1: Initialize the values of \(b^{(0)}\) and \(\mathbf{a}^{(0)}\). 2: Generate \(b^{(0)}\) from \(Exp(\lambda)\),
3: Generate \(a_{j}^{(0)}\) from \(Gamma(\theta_{j},b^{(0)}),j=1,2,\ldots,s\),
4:for\(k=1\) to \(N\)do
5: Sample \(t_{n_{1}+i}^{(k)}\) from \(f_{T|T\in[l_{i}r_{i}]}(t;\mathbf{a}^{(k-1)},b^{(k-1)}),i=1,2,\ldots,n_{2}\), then obtain \[data^{*(k)}=(t_{1},\ldots,t_{n_{1}},t_{n_{1}+1}^{(k)},\ldots,t_{n_{1}+n_{2}}^{ (k)}).\]
6: Sample \(b^{(k)}\) through \(\pi_{b}(b|\mathbf{a}^{(k-1)},data^{*(k)})\) using the adaptive rejection sampling method proposed in [24]. 7: Sample \(a_{j}^{(k)}\) from \(Gamma(\theta_{j},\omega^{(k)})\), \(j=1,2,\ldots,s\), where \[\omega^{(k)}=b^{(k)}+\sum_{i=1}^{n_{1}}\ln(1+t_{i}^{(k)})+\sum_{i=1}^{n_{2}} \ln(1+(t_{n_{1}+i}^{(k)})^{b^{(k)}}).\]
8:endfor
```  
**Algorithm 2** Gibbs sampling method to Bayesian estimation  
The notation \(Exp(\lambda)\) refers to the exponential distribution with the expected value \(\frac{1}{\lambda}\), and Gamma\((u,v)\) refers to the Gamma distribution with the shape parameter \(u\) and the scale parameter \(\frac{1}{v}\).