logLik.phybreak: Log-likelihood of a phybreak-object.

Description Usage Arguments Details Value Author(s) References Examples

View source: R/logLik-phybreak.R

Description

The likelihood of a phybreak-object is calculated, with the option to include or exclude parts of the likelihood for genetic data, phylogenetic tree (within-host model), sampling times and generation times.

Usage

1
2
3
## S3 method for class 'phybreak'
logLik(object, genetic = TRUE, withinhost = TRUE,
  sampling = TRUE, generation = TRUE, ...)

Arguments

object

An object of class phybreak.

genetic

Whether to include the likelihood of the mutation model.

withinhost

Whether to include the likelihood of within-host (coalescent) model.

sampling

Whether to include the likelihood of the sampling model (sampling intervals).

generation

Whether to include the likelihood of the transmission model (generation intervals).

...

Some methods for this generic require additional arguments. None are used in this method.

Details

The sequence likelihood is calculated by Felsenstein's pruning algorithm, assuming a prior probability of 0.25 for each nucleotide. The within-host likelihood is the likelihood of coalescence times given the within-host model and slope. The generation interval and sampling interval likelihood are log-densities of the gamma distributions for these variables.

Value

The log-likelihood as an object of class logLik.

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
#First build a phybreak-object containing samples.
simulation <- sim.phybreak(obsize = 5)
MCMCstate <- phybreak(data = simulation)
logLik(MCMCstate)

MCMCstate <- burnin.phybreak(MCMCstate, ncycles = 20)
logLik(MCMCstate)

tree0 <- get.phylo(MCMCstate)
seqdata <- get.seqdata(MCMCstate)
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.