Infer transmission tree given a phylogenetic tree

inferTTree(
  ptree,
  w.shape = 2,
  w.scale = 1,
  ws.shape = NA,
  ws.scale = NA,
  w.mean = NA,
  w.std = NA,
  ws.mean = NA,
  ws.std = NA,
  mcmcIterations = 1000,
  thinning = 1,
  startNeg = 100/365,
  startOff.r = 1,
  startOff.p = 0.5,
  startPi = 0.5,
  updateNeg = TRUE,
  updateOff.r = TRUE,
  updateOff.p = FALSE,
  updatePi = TRUE,
  qNeg = NA,
  qOff.r = NA,
  qOff.p = NA,
  qPi = NA,
  startCTree = NA,
  updateTTree = TRUE,
  optiStart = 2,
  dateT = Inf,
  delta_t = NA,
  verbose = F
)

Arguments

ptree

Phylogenetic tree

w.shape

Shape parameter of the Gamma distribution representing the generation time

w.scale

Scale parameter of the Gamma distribution representing the generation time

ws.shape

Shape parameter of the Gamma distribution representing the sampling time

ws.scale

Scale parameter of the Gamma distribution representing the sampling time

w.mean

Mean of the Gamma distribution representing the generation time

w.std

Std of the Gamma distribution representing the generation time

ws.mean

Mean of the Gamma distribution representing the sampling time

ws.std

Std of the Gamma distribution representing the sampling time

mcmcIterations

Number of MCMC iterations to run the algorithm for

thinning

MCMC thinning interval between two sampled iterations

startNeg

Starting value of within-host coalescent parameter Ne*g

startOff.r

Starting value of parameter off.r

startOff.p

Starting value of parameter off.p

startPi

Starting value of sampling proportion pi

updateNeg

Whether of not to update the parameter Ne*g

updateOff.r

Whether or not to update the parameter off.r

updateOff.p

Whether or not to update the parameter off.p

updatePi

Whether or not to update the parameter pi

qNeg

Proposal kernel range for parameter Ne*g

qOff.r

Proposal kernel range for parameter Off.r

qOff.p

Proposal kernel range for parameter Off.p

qPi

Proposal kernel range for parameter pi

startCTree

Optional combined tree to start from

updateTTree

Whether or not to update the transmission tree

optiStart

Type of optimisation to apply to MCMC start point (0=none, 1=slow, 2=fast)

dateT

Date when process stops (this can be Inf for fully simulated outbreaks)

delta_t

Grid precision (smaller is better but slower)

verbose

Whether or not to use verbose mode (default is false)

Value

posterior sample set of transmission trees

Examples

inferTTree(ptreeFromPhylo(ape::rtree(5),2020),mcmcIterations=100)
#> 
  |                                                                            
  |                                                                      |   0%
  |                                                                            
  |=                                                                     |   1%
  |                                                                            
  |=                                                                     |   2%
  |                                                                            
  |==                                                                    |   3%
  |                                                                            
  |===                                                                   |   4%
  |                                                                            
  |====                                                                  |   5%
  |                                                                            
  |====                                                                  |   6%
  |                                                                            
  |=====                                                                 |   7%
  |                                                                            
  |======                                                                |   8%
  |                                                                            
  |======                                                                |   9%
  |                                                                            
  |=======                                                               |  10%
  |                                                                            
  |========                                                              |  11%
  |                                                                            
  |========                                                              |  12%
  |                                                                            
  |=========                                                             |  13%
  |                                                                            
  |==========                                                            |  14%
  |                                                                            
  |==========                                                            |  15%
  |                                                                            
  |===========                                                           |  16%
  |                                                                            
  |============                                                          |  17%
  |                                                                            
  |=============                                                         |  18%
  |                                                                            
  |=============                                                         |  19%
  |                                                                            
  |==============                                                        |  20%
  |                                                                            
  |===============                                                       |  21%
  |                                                                            
  |===============                                                       |  22%
  |                                                                            
  |================                                                      |  23%
  |                                                                            
  |=================                                                     |  24%
  |                                                                            
  |==================                                                    |  25%
  |                                                                            
  |==================                                                    |  26%
  |                                                                            
  |===================                                                   |  27%
  |                                                                            
  |====================                                                  |  28%
  |                                                                            
  |====================                                                  |  29%
  |                                                                            
  |=====================                                                 |  30%
  |                                                                            
  |======================                                                |  31%
  |                                                                            
  |======================                                                |  32%
  |                                                                            
  |=======================                                               |  33%
  |                                                                            
  |========================                                              |  34%
  |                                                                            
  |========================                                              |  35%
  |                                                                            
  |=========================                                             |  36%
  |                                                                            
  |==========================                                            |  37%
  |                                                                            
  |===========================                                           |  38%
  |                                                                            
  |===========================                                           |  39%
  |                                                                            
  |============================                                          |  40%
  |                                                                            
  |=============================                                         |  41%
  |                                                                            
  |=============================                                         |  42%
  |                                                                            
  |==============================                                        |  43%
  |                                                                            
  |===============================                                       |  44%
  |                                                                            
  |================================                                      |  45%
  |                                                                            
  |================================                                      |  46%
  |                                                                            
  |=================================                                     |  47%
  |                                                                            
  |==================================                                    |  48%
  |                                                                            
  |==================================                                    |  49%
  |                                                                            
  |===================================                                   |  50%
  |                                                                            
  |====================================                                  |  51%
  |                                                                            
  |====================================                                  |  52%
  |                                                                            
  |=====================================                                 |  53%
  |                                                                            
  |======================================                                |  54%
  |                                                                            
  |======================================                                |  55%
  |                                                                            
  |=======================================                               |  56%
  |                                                                            
  |========================================                              |  57%
  |                                                                            
  |=========================================                             |  58%
  |                                                                            
  |=========================================                             |  59%
  |                                                                            
  |==========================================                            |  60%
  |                                                                            
  |===========================================                           |  61%
  |                                                                            
  |===========================================                           |  62%
  |                                                                            
  |============================================                          |  63%
  |                                                                            
  |=============================================                         |  64%
  |                                                                            
  |==============================================                        |  65%
  |                                                                            
  |==============================================                        |  66%
  |                                                                            
  |===============================================                       |  67%
  |                                                                            
  |================================================                      |  68%
  |                                                                            
  |================================================                      |  69%
  |                                                                            
  |=================================================                     |  70%
  |                                                                            
  |==================================================                    |  71%
  |                                                                            
  |==================================================                    |  72%
  |                                                                            
  |===================================================                   |  73%
  |                                                                            
  |====================================================                  |  74%
  |                                                                            
  |====================================================                  |  75%
  |                                                                            
  |=====================================================                 |  76%
  |                                                                            
  |======================================================                |  77%
  |                                                                            
  |=======================================================               |  78%
  |                                                                            
  |=======================================================               |  79%
  |                                                                            
  |========================================================              |  80%
  |                                                                            
  |=========================================================             |  81%
  |                                                                            
  |=========================================================             |  82%
  |                                                                            
  |==========================================================            |  83%
  |                                                                            
  |===========================================================           |  84%
  |                                                                            
  |============================================================          |  85%
  |                                                                            
  |============================================================          |  86%
  |                                                                            
  |=============================================================         |  87%
  |                                                                            
  |==============================================================        |  88%
  |                                                                            
  |==============================================================        |  89%
  |                                                                            
  |===============================================================       |  90%
  |                                                                            
  |================================================================      |  91%
  |                                                                            
  |================================================================      |  92%
  |                                                                            
  |=================================================================     |  93%
  |                                                                            
  |==================================================================    |  94%
  |                                                                            
  |==================================================================    |  95%
  |                                                                            
  |===================================================================   |  96%
  |                                                                            
  |====================================================================  |  97%
  |                                                                            
  |===================================================================== |  98%
  |                                                                            
  |===================================================================== |  99%
  |                                                                            
  |======================================================================| 100%
#> Result from TransPhylo analysis
#> pi=7.36e-01 [5.65e-01;8.29e-01]
#> neg=5.33e-01 [1.28e-01;1.08e+00]
#> off.r=9.83e-01 [2.80e-01;1.57e+00]
#> off.p=5.00e-01 [5.00e-01;5.00e-01]