epibayesmcmc(inf.list, nsamp, thinning, bprior, tiprior, teprior,
pprior = c(5,N), kiprior, keprior, N, priordists="gamma",
betapriordist=priordists, thetaipriordist=priordists,
thetaepriordist=priordists, kipriordist = priordists,
kepriordist=priordists, extrathinning=FALSE,
inferEtimes = FALSE, inferItimes = FALSE, parentprobmult = 1)
SEIR.simulator
.inf.list is an $m$ row by 5 column array giving the identity, likely parent, and exposed, infective, and removal times for each of the $m$ nodes that were infected during the course of the epidemic. Column 1 gives the ID (an integer) of the node, and column 2 gives the identity of the probable parent of the node (if known). Columns 3, 4, and 5 give the exposed, infective, and removal times. Note that if these times are not internally consistent, an error message will be generated and no inference will be performed. It is necessary to include data for exposure and infective times, even if these values are not known (in this case, set the respective columns of data to NA).
nsamp is the number of samples that will be produced for each of the model parameters.
thinning is the thinning interval, e.g., to return every $10^{th}$ sample, use thinning = 10.
The type of prior distribution (default is gamma / inverse gamma) can be specified for all parameters using priordists or for each parameter individually. The prior distribution for p is always the beta distribution (set both hyper-parameters of this prior to 1 to get a uniform distribution). For the other parameters, either uniform or gamma / inverse gamma priors can be chosen. (The two theta parameters use inverse gamma prior distributions, while the other parameters use gamma priors.)
The parameters of the prior distributions are given as lists of (two) hyper-parameters. If the uniform prior is being used for a parameter, then the hyper-parameters are the lower and upper limits of the distribution. If the gamma distribution is being used with parameters $c$ and $d$, then the prior mean is $c \cdot d$ and the prior variance is $c \cdot d^2$. If the inverse gamma distribution is being used with parameters $c$ and $d$, then the prior mean is $\frac{d}{c-1}$ and the prior variance is $\frac{d^2}{(c-1)^2 \cdot (c-2)}$.
The boolean variables inferEtimes and inferItimes indicate whether the exposure and infective times respectively are assumed to be unknown (need to be inferred by the algorithm) or are assumed to be known (and are not updated in the algorithm). If data exposure and / or infective times are not known, set the respective columns of data to NA (any data passed to the function when will be ignored).
If exposure and / or infective times are being inferred and we wish to return the inferred values of these times (along with the inferred transmission tree), set extrathinning equal to an integer specifying the extra thinning interval for these values. Because returning values for a large number of nodes can be very space-intensive, an extra thinning interval can be given as a multiple of the thinning interval for the other parameters. For example, using thinning = 10 and extrathinning = 20 will return the values of the inferred exposure and infective times and transmission tree every 200 iterations, and the values of the other parameters every 10 iterations. If these inferred values are not desired, set this variable to FALSE.
The default prior distribution for the parent of each node is uniform on all of the other nodes. To specify a non-uniform distribution, use column 2 of inf.list and set parentpriormult to an integer multiplier greater than 1.
Uses an algorithm similar to that described in Groendyke et al. (2010) and Britton and O'Neill (2002).
SEIR.simulator
for simulating an SEIR epidemic over an Erdos-Renyi network, Hagelloch
for an example epidemic data set, and PlotEpiTree
for plotting the epidemic.# Simulate an epidemic through a network of 30
set.seed(1)
examplenet <- buildER(N = 30, p = 0.1)
exampleepidemic <- SEIR.simulator(examplenet, N = 30,
beta = 0.3, ki = 2, thetai = 5, latencydist = "gamma")
# Run MCMC algorithm on this epidemic
examplemcmc <- epibayesmcmc(exampleepidemic, nsamp = 100000,
thinning = 100, bprior = c(0, 1), tiprior = c(0, 5), teprior = c(0, 5),
kiprior = c(0, 10), keprior = c(0, 10), N = 30, priordists = "uniform")
Run the code above in your browser using DataLab