This is just a place to play around with different inference algorithms. Gitbook markdown is very application-specific so can't copy this algorithm text into other apps to play around with!
For
, where is the number of parallel MCMC chains (also known as slots)
Generate initial state
Generate an initial set of parameters , and copy this to both the global () and chimeric () parameter chain (sequence ;
Generate an initial epidemic trajectory
Calculate and record the initial likelihood for each subpopulation, $$\mathcal{L_i}(D_i|Z_i(\Theta_{m,0}))$ ;
For
where is the length of the MCMC chain, add to the sequence of parameter values :
Generate a proposed set of parameters from the current chimeric parameters using the proposal distribution $$g(\Theta^*|\Theta^C_{m,k-1})$ ;
Generate an epidemic trajectory with these proposed parameters,
Calculate the likelihood of the data given the proposed parameters for each subpopulation,
Calculate the overall likelihood with the proposed parameters,
Make "global" decision about proposed parameters
Generate a uniform random number
Calculate the overall likelihood with the current global parameters,
Calculate the acceptance ratio
If
: ACCEPT the proposed parameters to the global and chimeric parameter chains
Set \Theta^G_{m,k} =$$$$\Theta^*
Set
Update the recorded subpopulation-specific likelihood values (chimeric and global) with the likelihoods calculated using the proposed parameter ;
Else
: REJECT the proposed parameters for the global chain and make subpopulation-specific decisions for the chimeric chain
Set
Make "chimeric" decision:
For
Generate a uniform random number
Calculate the acceptance ratio
If
: ACCEPT the proposed parameters to the chimeric parameter chain for this location
Set
Update the recorded chimeric likelihood value for subpopulation to that calculated with the proposed parameter
Else
: REJECT the proposed parameters for the chimeric parameter chain for this location
Set
`End if ;
End for
subpopulations
End making chimeric decisions
End if
End making global decision
End for
iterations of each MCMC chain
End for
parallel MCMC chains
Collect the final global parameter values for each parallel chain