Learn R Programming

phybreak (version 0.2.0)

thin_phybreak: Remove posterior samples from a phybreak-object.

Description

The function removes (all or some) posterior samples by thinning and/or removing the first part of the chain, but keeps the state of variables and parameters intact.

Usage

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

Arguments

x

An object of class phybreak.

thin

The thinning interval to use.

nkeep

the number of most recent samples to keep. If nkeep = Inf (default), the whole chain is thinned and returned. Otherwise, samples from the tail are kept.

Value

The phybreak-object provided as input, but with fewer posterior samples.

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 create a phybreak-object
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)

MCMCstate <- thin_phybreak(MCMCstate, thin = 2)
# }

Run the code above in your browser using DataLab