Description Usage Arguments Details Value Methods (by class) Author(s) References Examples
Effective sample size
1 2 3 4 5 6 7 8 9 10 |
x |
An object of class |
x |
Vector of class |
x |
Vector of class |
When applied to an object of class phybreak
, ESS
calculates for all parameters and continuous
variables (infection times) the effective sample size (ESS) with the effectiveSize
function in coda. For the infectors,
a method is used that is similar to the method for the approximate ESS for phylogenetic trees, described in
Lanfaer et al (2016):
Define as distance measure between two sampled infectors D(i,j) = 0 if i = j, and D(i,j) = 1 if i <> j
Calculate the mean squared distance f(k) between sampled infectors at intervals k = 1,2,... in the mcmc chain. The distance will increase with increasing interval k.
Use the rate at which f(k) approaches the asymptote to calculate the ESS (see Lanfaer et al, 2016)
The latter method can also be directly called for single vectors of class factor
or integer
.
Effective sample sizes.
phybreak
: Effective sample size of phybreak posterior.
factor
: Effective sample size of a categorical variable.
numeric
: Effective sample size of a categorical variable.
Don Klinkenberg don@xs4all.nl
Lanfaer et al. (2016) Estimating the effective sample size of tree topologies from Bayesian phylogenetic analyses. Genome Biol Evol, 8(8): 2319-2332.
1 2 3 4 5 6 7 | #First create 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)
ESS(MCMCstate)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.