Skip to main content
. 2024 Feb 29;12:e17019. doi: 10.7717/peerj.17019

Algorithm 4.

Step 1: Specify the values of a1, a2, b1, b2, and r, then compute a(r) using Eq. (16) and compute b+(r) using Eq. (18)
Step 2: At the i step
(a) Generate u from uniform distribution with parameters 0 and a(r), denoted as U(0,a(r))
(b) Generate v from uniform distribution with parameters 0 and b+(r), denoted as U(0,b+(r))
(c) Compute ρ=vur
(d) If the value of ρ is accepted, the set β(i)=ρ if u[p(β|x)]1/(r+1); otherwise, repeat step (a)–step (c)
(e) Generate λ from inverse gamma distribution with parameters n2+a2 and 12j=1n(xjβ(i)+β(i)xj2)+b2, denoted as IG(n2+a2,12j=1n(xjβ(i)+β(i)xj2)+b2) and compute α(i)=λ
Step 3: Compute the posterior distribution of θ, denoted as θBaye, using Eq. (19)
Step 4: Repeat step 2 and step 3, a total M times and obtain an array of θBaye’s
Step 5: Compute Lθ.HPD and Uθ.HPD