From: Reconstructing nonlinear dynamic models of gene regulation using stochastic sampling
Algorithm 1 Iterative Hybrid Monte Carlo and Metropolis Hastings algorithm |
---|
Require: desired distribution p(·), starting value (ω0, λ 0), proposal distribution q λ (·|λ (t)), number of leapfrog steps for HMC L, proposal distribution for stepsize ϵ of leapfrog steps qϵ(·), standard deviation σ ρ for the sampling of the momentum variables ρ, number of Markov chain samples T |
1: t ← 0 |
2: while t <T do |
3: Sample from qϵ(·) |
4: Sample from for all i ∈ {1,..., n} |
5: Perform L leapfrog steps with stepsize starting at state (ω(t), ρ (t)) |
6: Store resulting candidate state in |
7: Sample u1 from (0, 1) |
8: α1 ← min {1, exp H(ω(t), ρ(t)) - H)} |
9: if u1 <α1 then |
10: ω(t+1)← |
11: else |
12: ω(t+1)← ω(t) |
13: end if |
14: Sample from q λ (·|λ(t)) |
15: Sample u2 from (0, 1) |
16: |
17: if u2 <α2 then |
18: λ(t+1)← |
19: else |
20: λ(t+1)← λ(t) |
21: end if |
22: Append (ω(t+1), λ(t+1)) to Markov chain |
23: t ← t + 1 |
24: end while |
25: return Markov chain |