Estimate transmission dynamics and parameters

Description

MCMC algorithm to sample transmission parameters, infection times and transmission routes.

Usage

1
2
3
4
5
transmission_analysis(epidata, distmat, seqIDs, resmat, iterations = 1e+05, 
augmoves = 10, feedb = 1, tag = 1, noaug = 1, model = 2, path = NULL, 
sensprior = c(1, 1), impprior = c(1, 1), betaprior = 1e+06, 
gammaprior = c(1, 1), gammaGprior = c(1, 1), tparprior = 1e+06, 
sigma = c(0.004, 0.03, 0.005, 0.25))

Arguments

epidata

Epidemiological data, in the form of an integer matrix consisting of columns: patient ID, day of admission, day of discharge.

distmat

Genetic distance matrix. Entry [i,j] provides the pairwise SNP distance between patients seqIDs[i] and seqIDs[j].

seqIDs

Vector of patient IDs corresponding to the rows and columns of distmat.

resmat

Matrix of test results, each row corresponding to the patient ID in epidata. Entry 0=negative, 1=positive, -1=missing.

iterations

Number of iterations for the MCMC algorithm to run.

augmoves

Number of data augmentation moves to make per MCMC iteration.

feedb

Frequency of console feedback; provided every 10^feeback iterations, with parameter snapshot every 10^feeback+1 iterations.

tag

Integer tag to attach to output file.

noaug

Level of data augmentation. 0=none, 1=sample infection times and routes for patients with positive swabs only, 2=sample infection times and routes for all patients.

model

Genetic diversity model to use. 1=importation clustering model, 2=transmission chain diversity model.

path

Location to store output files.

sensprior

Prior Beta distribution parameters for test sensitivity (z).

impprior

Prior Beta distribution parameters for importation probability (p).

betaprior

Prior exponential distribution mean for transmission rate (beta).

gammaprior

Prior Beta distribution parameters for within host/group genetic diversity (gamma).

gammaGprior

Prior Beta distribution parameters for between host/group genetic diversity (gamma_gl).

tparprior

Prior exponential distribution mean for genpar.

sigma

Vector of initial variances for Normal proposal distributions for beta, gamma, gamma_gl and genpar. MCMC algorithm automatically updates variances to reach acceptance rate of 20-40%.

Details

MCMC algorithm runs in C, and writes output file to specified path.

Value

Returns a matrix in which each row corresponds to MCMC iteration. Columns are as follows: p, z, beta, gamma, gamma_gl, genpar, number of importations, number of acquisitions, number of groups, likelihood, infection source [cols 11:(n+10)], infection group [cols (n+10):(2n+10)].

Examples

1
2
3
4
5
6
7
8
9
  ## Not run: 
  data(hospitaldata)
  # Short example run
  mcmcoutput <- transmission_analysis(epidata=hospitaldata$epi, distmat=hospitaldata$distmat, 
                           seqIDs=hospitaldata$patientseqIDs, resmat=hospitaldata$resmat, 
                           path=getwd(), iterations=10000, augmoves=5)
  traceplots(mcmcoutput)
  
## End(Not run)