get_phybreak: Extracting from a phybreak object

Description Usage Arguments Functions Author(s) References Examples

Description

Extracting from a phybreak object

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
get_data(x)

get_parameters(x, whichpars = "posterior")

get_transtree(x)

get_phylo(x, simmap = FALSE, samplenr = 0)

get_multiPhylo(x, thin = 1, nkeep = Inf)

get_mcmc(x, thin = 1, nkeep = Inf)

get_bottlenecks(x)

Arguments

x

An object of class phybreak.

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.

simmap

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

samplenr

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

thin

Thinning interval.

nkeep

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

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(dataset = simulation)
MCMCstate <- burnin_phybreak(MCMCstate, ncycles = 20)
MCMCstate <- sample_phybreak(MCMCstate, nsample = 50, thin = 2)

get_transtree(MCMCstate)
get_parameters(MCMCstate)
mcmcobject <- get_mcmc(MCMCstate, thin = 2)
plot.phylo(get_phylo(MCMCstate))
get_data(MCMCstate)
get_bottlenecks(MCMCstate)

#function from package phangorn:
phangorn::parsimony(get_phylo(MCMCstate), get_data(MCMCstate)$sequences)

tree0 <- get_phylo(MCMCstate)
seqdata <- get_data(MCMCstate)$sequences
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'

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