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

Description Usage Arguments Value Author(s) References Examples

View source: R/infectorsets.R

Description

The function takes a phybreak-object containing MCMC-samples, and returns for each host the posterior infectors, with support per infector. That can be in the form of a list, with infectors ordered by support, or in the form of a matrix with supports for all host-infector combinations (host in columns, infectors in rows).

Usage

1
2
3
infectorsets(x, which.hosts = "all", percentile = 0.95,
  minsupport = 0, samplesize = Inf, infector.name = TRUE,
  support = c("proportion", "count"), output = c("list", "matrix"))

Arguments

x

An object of class phybreak.

which.hosts

A vector with hosts (exact names or 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 "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.

output

Whether to return a list of hosts with infectors, or a matrix with support values for all host-infector pairs. Arguments percentile, samplesize, and infector.name are not used in case of matrix.

Value

A named list with data.frames, each with a vector of infectors and a vector of supports. Or a matrix with supports for each host-infector pair.

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
7
#First build a phybreak-object containing samples.
simulation <- sim_phybreak(obsize = 5)
MCMCstate <- phybreak(dataset = simulation)
MCMCstate <- burnin_phybreak(MCMCstate, ncycles = 20)
MCMCstate <- sample_phybreak(MCMCstate, nsample = 50, thin = 2)

infectorsets(MCMCstate)

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