Bayesian MCMC is performed to obtain posterior estimates of the model parameters and latent variables. When the datatype
is set to ``known removal'' or ``unknown removal'', we assume the infectious periods (SIR model) or the incubation and/or delay periods (SINR model) follow gamma distributions with fixed shape and unknown rate parameters. We assign a gamma prior distribution for the rate parameter with shape \(a\) and rate \(b\). This leads the rate parameter(s) to have a gamma conditional distribution.
Under the SIR model, the conditional distribution is:
$$ \delta|\theta,\boldsymbol{I},\boldsymbol{R} \sim \Gamma(m+a_{\delta},M+b_{\delta}), $$
where \(\delta\) is the rate of the infectious period distribution; \(m\) is the number of infected individuals; \(M=\sum_{i=1}^{m}{(R_{i}-I_{i})}\); and \(a_{\delta}\) and \(b_{\delta}\) are the prior parameters for the infectious period rate, respectively.
Under the SINR model, the conditional distribution is:
$$ \delta^{(inc)}|\theta,\boldsymbol{I},\boldsymbol{N},\boldsymbol{R} \sim \Gamma(m+a_{\delta^{(inc)}},M_{inc}+b_{\delta^{(inc)}}),$$
where \(\delta^{(inc)}\) is the rate of the incubation period distribution; \(M_{inc}=\sum_{i=1}^{m}{(N_{i}-I_{i})}\); and \(a_{\delta^{(inc)}}\) and \(b_{\delta^{(inc)}}\) are the prior parameters for the incubation period rate, respectively; and
$$ \delta^{(delay)}|\theta,\boldsymbol{I},\boldsymbol{N},\boldsymbol{R} \sim \Gamma(m+a_{\delta^{(delay)}},M_{delay}+b_{\delta^{(delay)}}),$$
where \(\delta^{(delay)}\) is the rate parameter of the delay period distribution; \(M_{delay}=\sum_{i=1}^{m}{(R_{i}-N_{i})}\); and \(a_{\delta^{(delay)}}\) and \(b_{\delta^{(delay)}}\) are the prior parameters for the delay period rate, respectively.
A Gibbs update (i.e., sampling from the conditional posterior distribution) is then used for the infectious period (SIR model) or the incubation and/or delay period rates (SINR model). The required information for each period distribution are entered via the delta
argument. We assume each period type follows a gamma distribution with fixed shape and unknown rate. Thus, to update the rate parameter of each period, delta
is a list containing a vector of the fixed shape value(s), a vector (matrix) of the initial values of the rate(s), and a vector (matrix) of the parameters of the prior distribution of the rate parameter(s). In the case of incubation and delay periods being estimated, the input of the initial values is a \(2 \times \code{nchains}\) matrix, and the prior parameters are given by a \(2 \times 2\) matrix in which each row contains the required information for each period rate.
An independence sampler is used for updating the infection times and infectious periods (SIR model), or the infection and/or removal times, and the incubation and/or delay periods (SINR model). Under the SIR model, we update each infection time \(I_{i}\) by proposing infectious period \(D^{*}_{i}\) from a proposal distribution with tuning parameter, such that \(D_{i}\sim\) f(.). Then, the new infection time is just the difference between the fixed known removal time and the new infectious period of the \(i^{th}\) individual. Each infection time/infectious period is updated in this way in turn. The same procedure is applied for updating the missing event times and incubation and delay periods for the SINR model, with their corresponding parameters.
The control.sus
and control.trans
arguments provide all the information needed for the susceptibility and transmissibility functions. These arguments must be defined as a list of three objects. The first object is a list of: 1) a vector or matrix of initial values; and 2) a vector or matrix of the following arguments in order: initial value, prior distribution ("gamma", (positive) "half normal" or "uniform"), a vector of the prior distribution parameters, and the proposal variance. The second object is a matrix of the susceptibility or transmissibility risk factors. The third contains the power parameters of the susceptibility or transmissibility functions and has the same structure as the first object. The other model parameters kernel.par
, spark.par
and gamma.par
also have the same structure as the first object. These model parameters, along with the model parameters of the susceptibility and transmissibility functions (control.sus
and control.trans
), are updated in turn using a random-walk Metropolis Hastings algorithm with normal proposals. The normal proposals must be tuned, via the proposal variance, by the user to achieve good mixing properties.
Note that, setting the variance of the normal proposal distribution to zero fixes a parameter at its initial value. This option allows the user to fix such a parameter in the MCMC procedure while updating others.
For faster run of the epictmcmc
function, an option of running multiple chains on parallel can be performed, controlled via the two options nchains
and parallel
. If parallel
is set to TRUE, the number of required cores is set to the minimum of nchains
and the number of available cores on the user's computer.