Inference scratch
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!
Current inference algorithm
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,
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
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 chainsSet
Set
Update the recorded subpopulation-specific likelihood values (chimeric and global) with the likelihoods calculated using the proposed parameters
Else
: REJECT the proposed parameters for the global chain and make subpopulation-specific decisions for the chimeric chainSet
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 locationSet
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 locationSet
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 chainsCollect the final global parameter values for each parallel chain
Making chimeric decision first
Last updated