Learn R Programming

phybreak (version 0.2.0)

infectorsets: Sampled infectors for each host in a phybreak-object.

Description

The function takes a phybreak-object containing MCMC-samples, and returns for each host a table with posterior infectors, with support per infector.

Usage

infectorsets(phybreak.object, which.hosts = "all", percentile = 0.95,
  minsupport = 0, samplesize = Inf, infector.name = TRUE,
  support = c("proportion", "count"))

Arguments

phybreak.object

An object of class phybreak.

which.hosts

A vector with hosts (positions in the dataset), or "all" for all hosts.

percentile

Return infectors ordered by support, until a cumulative support indicated by percentile, support measured by proportion (value between 0 and 1).

minsupport

Only return infectors with more support than minsupport. Values in the range [0,1] are interpreted as support in "proportion" of posterior samples, values > 1 as code"count" of posterior samples.

samplesize

The number of samples to include (taken from the tail of the MCMC-chain).

infector.name

Whether to return the names of the infectors, or their position in the dataset.

support

Whether to return the support (= posterior probability) for each infector as a "proportion" or as a "count" of posterior trees in which that transmission link or transmission cluster is present.

Value

A named list with data.frames, each with a vector of infectors and a vector of supports.

References

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

Examples

Run this code
# NOT RUN {
#First build a phybreak-object containing samples.
simulation <- sim.phybreak(obsize = 5)
MCMCstate <- phybreak(data = simulation$sequences, times = simulation$sample.times)
MCMCstate <- burnin.phybreak(MCMCstate, ncycles = 20)
MCMCstate <- sample.phybreak(MCMCstate, nsample = 50, thin = 2)

infectorsets(MCMCstate)
# }

Run the code above in your browser using DataLab