get.phybreak: Accessing a phybreak object

Description Usage Arguments Functions Author(s) References Examples

Description

Accessing a phybreak object

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
get.tree(phybreak.object, samplenr = 0)

get.parameters(phybreak.object, samplenr = 0, whichpars = "posterior")

get.mcmc(phybreak.object, thin = 1, nkeep = Inf)

get.phylo(phybreak.object, samplenr = 0, simmap = FALSE)

get.multiPhylo(phybreak.object, thin = 1, nkeep = Inf)

get.seqdata(phybreak.object)

Arguments

phybreak.object

An object of class phybreak.

samplenr

The posterior tree sample to choose. If samplenr = 0, the current state is used.

whichpars

Which parameters to return. Either a vector with parameter names, or "all" for all parameters, or "posterior" for parameters for which a posterior is sampled.

thin

Thinning interval.

nkeep

Number of samples to keep, counting from tail of the chain.

simmap

Whether to include class "simmap" elements (package phytools), colouring the branches on the tree to indicate hosts. Is used by plotPhylo.

Functions

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
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
#First build a phybreak-object.
simulation <- sim.phybreak(obsize = 5)
MCMCstate <- phybreak(data = simulation)
MCMCstate <- burnin.phybreak(MCMCstate, ncycles = 20)
MCMCstate <- sample.phybreak(MCMCstate, nsample = 50, thin = 2)

get.tree(MCMCstate)
get.parameters(MCMCstate)
codaobject <- get.mcmc(MCMCstate, thin = 2)
plot.phylo(get.phylo(MCMCstate))
get.seqdata(MCMCstate)

#function from package phangorn:
phangorn::parsimony(get.phylo(MCMCstate), get.seqdata(MCMCstate))

tree0 <- get.phylo(MCMCstate)
seqdata <- get.seqdata(MCMCstate)
phangorn::pml(tree0, seqdata, 
              rate = 0.75*get.parameters(MCMCstate)["mu"]) 
logLik(MCMCstate, genetic = TRUE, withinhost = FALSE, 
       sampling = FALSE, generation = FALSE) 
              #should give the same result as 'pml'

phybreak documentation built on May 2, 2019, 3:36 p.m.