Description Usage Arguments Value Examples
Sample allelic series (partitions) from Ewen's sampling formula, optionally informed by user-specified tree(s). Trees must be in coalescent units for appropriate inference.
1 | ewenss.sampler(samples, trees, prior.alpha, verbose = T)
|
samples |
number of samples |
trees |
either a user-specified tree(s) of class "phylo" ("multiPhylo"), detailed in the 'ape' package, or an integer with the number of leaves to be partitioned |
prior.alpha |
prior type c("fixed","gamma") for the concentration parameter, see examples for format. type "beta.prime" supported but sampler appears unstable, use ewenss.calc function instead |
verbose |
optionally report function progress |
list of allelic series IDs and probabilities, formatted as prior.M object for TIMBR function
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | #specifying hyperparameters for gamma prior using calc.concentration.prior
hyperparam <- calc.concentration.prior(8, 0.05, 0.01)
prior.alpha <- list(type="gamma", shape=hyperparam[1], rate=hyperparam[2])
#running the sampler without user-specified trees; compare with target prior probabilities
prior.M <- ewenss.sampler(100000, 8, prior.alpha)
exp(prior.M$ln.probs[prior.M$M.IDs=="0,0,0,0,0,0,0,0"])
exp(prior.M$ln.probs[prior.M$M.IDs=="0,1,2,3,4,5,6,7"])
#running the sampler with a user-specified tree and fixed concentration parameter; compare with tree structure
tree <- ape::rcoal(8, LETTERS[1:8])
ape::plot.phylo(tree)
prior.alpha <- list(type="fixed", alpha=1)
prior.M <- ewenss.sampler(100000, tree, prior.alpha)
head(prior.M$M.IDs)
head(exp(prior.M$ln.probs))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.