ivy.sim.discrete_sim module

ivy.sim.discrete_sim.sim_discrete(tree, Q, anc=None, charname=None, rseed=None)[source]

Simulate discrete character on a tree given transition rate matrix.

Parameters:
  • tree (Node) – Root node of tree.
  • Q (np.array) – Instantaneous rate matrix
  • anc (int) – Root state. Optional. If None, root state is chosen from stationary distrubution of Q matrix
  • rseed (int) – Random seed to be passed to np.random. Optional
Returns:

Copy of tree with each node containing its simulated

state and the character history of its subtending branch.

Return type:

Node