Skip to main content
. 2022 Jan 12;24(1):115. doi: 10.3390/e24010115
Algorithm 1 Particle Marginal Metropolis–Hastings (PMMH) Method.
  • 1:

    initialize the parameters Θ0

  • 2:

    fork=1,,K (K is the number of samples) do

  • 3:

       draw the sample candidate of parameters Θ*qΘ*|Θk1

  • 4:

       draw the initial particles z1mpz1 for m=1,,M (m is the particle number of the particle that is the source of resampling)

  • 5:

       calculate the weights of particles w11,w12,,w1M with Equation (8)

  • 6:

       normalize the weights of particles W11,W12,,W1M with Equation (7)

  • 7:

       resample the particles z11,z12,,z1M according to the normalized weights W11,W12,,W1M

  • 8:

       for n=2,,N do

  • 9:

          draw the particles zn1,zn2,,znM at time step n with Equation (6)

  • 10:

         calculate the weights of particles wn1,wn2,,wnM with Equation (8)

  • 11:

         normalize the weights of particles Wn1,Wn2,,WnM with Equation (7)

  • 12:

         resample the particles zn1,zn2,,znM according to the normalized weights Wn1,Wn2,,WnM

  • 13:

       end for

  • 14:

       calculate the marginal likelihood py1:N|Θ* with Equation (9)

  • 15:

       calculate the acceptance probability paccept with Equation (3)

  • 16:

       draw a uniform random number αU0,1 (Ua,b is a uniform distribution with range [a,b))

  • 17:

       if αpaccept then

  • 18:

         set the sample of parameters ΘkΘ*

  • 19:

       else

  • 20:

         set the sample of parameters ΘkΘk1

  • 21:

       end if

  • 22:

    end for

  • 23:

    returnΘkk=1K