sample_phybreak: Sampling from a phybreak MCMC-chain.

Description Usage Arguments Value Author(s) References Examples

View source: R/sample_phybreak.R

Description

Function to take (additional) samples from the posterior distribution of a phylogenetic and transmission tree (plus associated parameters), within a phybreak object (sample.phybreak is deprecated).

Usage

1
2
3
4
sample_phybreak(x, nsample, thin = 1, classic = 0, keepphylo = 0,
  withinhost_only = 0, parameter_frequency = 1, status_interval = 10)

sample.phybreak(...)

Arguments

x

An object of class phybreak.

nsample

The number of samples to take.

thin

The thinning to use (values after every thin'th iteration will be included in the posterior). Each iteration does one update of all parameters and tree updates with each host as focal host once.

classic

The proportion of tree updates with the classic protocol (reference see below), in which within-host minitrees are proposed by simulating coalescent times and tree topology. In the current default protocol only coalescent times are proposed with the minitree topology kept intact. This is followed by removing and reconnecting the sampling tips one by one. This results in better mixing of the mcmc-chain if there is much genetic information (many SNPs) and/or if there are many possible within-host minitree topologies (e.g. many samples per host). The classic protocol is faster in terms of updates/second and can thus be more efficient with little genetic information.

keepphylo

The proportion of tree updates keeping the phylogenetic tree intact, only possible if there is one sample per host and the wh.model = "linear" with complete bottleneck.

withinhost_only

The proportion of tree updates in which only the within-host minitree is sampled, and the transmission tree and infection times are kept unchanged.

parameter_frequency

The relative frequency by which the model parameters are updated relative to updating each host.

status_interval

The number of seconds between each on-screen print of the progress of the mcmc-chain.

Value

The phybreak object used to call the function, including (additional) samples from the posterior.

Author(s)

Don Klinkenberg don@xs4all.nl

References

Klinkenberg et al. (2017) Simultaneous inference of phylogenetic and transmission trees in infectious disease outbreaks. PLoS Comput Biol, 13(5): e1005495.

Examples

1
2
3
4
5
6
#First create a phybreak-object
simulation <- sim_phybreak(obsize = 5)
MCMCstate <- phybreak(dataset = simulation)

MCMCstate <- burnin_phybreak(MCMCstate, ncycles = 20)
MCMCstate <- sample_phybreak(MCMCstate, nsample = 50, thin = 2)

donkeyshot/phybreak documentation built on Sept. 17, 2021, 9:32 p.m.