sfreemap.map: Simulation free stochastic character mapping on a...

Description Usage Arguments Value Author(s) References See Also

Description

This function performs an analitic stochastic character mapping on a phylogenetic tree (algorithym proposed by Minin and Suchard).

Usage

1
sfreemapr.map(tree, tip_states, Q, ...)

Arguments

tree

a phylogenetic tree as an object of class "phylo", or a list of trees as an object of class "multiPhylo".

tip_states

Two formats are accepted:

  • A named vector containing the states of the nodes at the tips as values, and the taxa labels as names;

  • A matrix with taxa labels as rownames, states as colnames and the numeric value 1 representing if the taxa is in the corresponding state, or 0 otherwise.

Q

The transition rate matrix. Can be given as a matrix or estimated by the program, according to the following options:

  • "empirical": first it fits a continuous-time reversible Markov model for the evolution of x and then simulates stochastic character histories using that model and the tip states on the tree. This is the same procedure that is described in Bollback (2006), except that simulation is performed using a fixed value of the transition matrix, Q, instead of by sampling Q from its posterior distribution (from Phytools).

  • "mcmc": samples Q nsim times from the posterior probability distribution of Q using MCMC, then it simulates nsim stochastic maps conditioned on each sampled value of Q.

  • A transition rate matrix. Make sure to name rows and columns properly with the state labels. Also, this matrix must be symmetrical.

...

Optional parameters listed below:

"prior": the prior distribution on the root node of the tree. Options are:

  • "equal" (default): root node is sampled from the conditional scaled likelihood distribution at the root;

  • "estimated": the stationary distribution is estimated by numerically solving pi*Q=0;

"tol" (default: 1e-8): the tolerance for zero elements in Q, elements less then tol will be set to zero;

"parallel" (default: TRUE): when tree is of type multiPhylo we can run sfreemapr in parallel. The number of processes will be the same as the cores available in your machine.

When Q="mcmc" some other parameters might be set:

  • "n_simulations" (default: 100): The number of Q matrices that will be generated;

  • "burn_in" (default: 1000): the burn in for the MCMC, when Q="mcmc";

  • "sample_freq" (default: 100): sample frequency for the MCMC, when Q="mcmc".

Value

Returns a modified object of class "phylo", adding the following data:

mapped.edge

a matrix containing the total time spent in each state along each edge of the tree

mapped.edge.lmt

a matrix containing the number of labelled markov transitions for each state along each edge of the tree

Q

the given or estimated value of Q

logL

The likelihood of given or sampled Q

Author(s)

Diego Pasqualin dpasqualin@inf.ufpr.br

References

Vladimir N Minin e Marc A Suchard. Fast, accurate and simulation-free stochastic mapping. Philosophical Transactions of the Royal Society B: Biological Sciences, 363 (1512): 3985-3995, 2008.

See Also

See Also


dpasqualin/sfreemapr documentation built on May 15, 2019, 10:45 a.m.