I attempt to sample the posterior distribution of parameters($\alpha,\alpha_1,\alpha_2,\lambda_1,\lambda_2$) using the Metropolis-Hastings within Gibbs.
Steps of Random Walk Metropolis-Hastings
start with t=1 and the initial values {($\alpha=1,\alpha_1=1,\alpha_2=1,\lambda_1=1,\lambda_2$=1)}
using the initial values generate candidate points from proposal densities
alpha.can<-abs(rnorm(1,alpha[t-1],0.5)); alpha1.can<-abs(rnorm(1,alpha1[t-1],0.5)); alpha2.can<-abs(rnorm(1,alpha2[t-1],0.5)); lamda1.can<-abs(rnorm(1,lamda1[t-1],0.5)); lamda2.can<-abs(rnorm(1,lamda2[t-1],0.005))
Generate u.$\alpha$~$\mathscr U$[0,1], u.$\alpha_1$~$\mathscr U$[0,1], u.$\alpha_2$~$\mathscr U$[0,1], u.$\lambda_1$~$\mathscr U$[0,1], u.$\lambda_2$~$\mathscr U$[0,1].
Calculate the ratio of candidate point alpha.can and previous point alpha[t-1]
R1=$\frac{g(alpha.can \quad given \quad {\alpha_1[t-1],\alpha_2[t-1],\lambda_1[t-1],\lambda_2[t-1]})}{g(alpha[t-1] \quad given \quad {\alpha_1[t-1],\alpha_2[t-1],\lambda_1[t-1],\lambda_2[t-1]})}$ where g is the full conditional posterior of $\alpha$.
If u.$\alpha \;$ <= min (R1,1), accept the candidate point, otherwise set alpha.can=alpha[t-1]
Similarly from step 4, the ratio of candidate point alpha1.cand and previous point alpha1 [t-1] is
R2=$\frac{g(alpha1.can \quad given \quad {\alpha[t],\alpha_2[t-1],\lambda_1[t-1],\lambda_2[t-1]})}{g(alpha1[t-1] \quad given \quad {\alpha[t],\alpha_2[t-1],\lambda_1[t-1],\lambda_2[t-1]})}$ where g is the full conditional posterior of $\alpha_1$.
If u.$\alpha_1 \;$ <= min (R2,1), accept the candidate point, otherwise set alpha1.can=alpha1[t-1]$\qquad$ and so on for $\alpha_2,\lambda_1,\lambda_2$.
Repeat steps 2-7 (T=10000) times and obtain sample of {$\alpha,\alpha_1,\alpha_2,\lambda_1,\lambda_2 $}.
Thanks in Advance