sim_Mk_trace_history: Simulate discrete trait evolution tracing lineage history.

Description Usage Arguments Value

View source: R/simMK_trace_history.R

Description

This function simulates discrete traits based on the same lineage history created when using 'sim_Mk_budding_exp'. It is useful to simulate under the same lineage history and phylogenetic tree while changing rate parameters or parameter for the decay function. If you don't want to retain a particular lineage history, then please refer to 'sim_Mk_budding_exp'. Please also check the help page for 'sim_Mk_budding_exp' to understand how progenitor lineages are simulated.
CLADOGENETIC CHANGES AT BUDDING: The function allows for state changes at budding nodes. The 'cladogenetic_change' parameter controls whether cladogenetic changes happens and which transition rule should be used. The parameter 'cladogenetic_state' allows for the user to include restrictions to which state should the daughter lineage have after a budding speciation even. Note that anagenetic change is likely to occur along the branches of the tree (dependent on the transition matrix - Q). This means that the state of any lineage at a node can change to another state after time 't'. In the case of the 'convergent_any' and 'convergent_other' options, the convergence happens with respect to the state of the daughter lineage after the first budding speciation event of the progenitor lineage. In other words, the daughter lineage can leave the state of convergence at any time along a branch following the transition matrix (Q).

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
sim_Mk_trace_history(
  sim_MK,
  Q,
  anc = NULL,
  change_rate = 2,
  decay_fn = TRUE,
  cladogenetic_change = "none",
  cladogenetic_state = "any",
  cladogenetic_prob = 1
)

Arguments

sim_MK

the output from ”sim_Mk_budding_exp'.

Q

transition matrix for a Markov model.

anc

state at the root. If "NULL", then a random state is selected.

change_rate

the rate for an exponential reduction of the rate of trait evolution proportional to lineage-age.

decay_fn

TRUE or FALSE. If TRUE, then the rate of trait evolution has a negative (exponential) relationship with lineage-age. If FALSE, then this relationship becomes positive.

cladogenetic_change

if a cladogenetic trait change should occur at the node associated with a budding event. Options are "none": anagenetic changes only; "flat": trait changes randomly; "prob": trait changes following the transition probabilities from the Q matrix.

cladogenetic_state

the state of the daughter lineage after a cladogenetic event. Options are "any": cladogenetic changes can change to any state; "other": always change to a state distinct from the state of the progenitor lineage at the moment of speciation; "convergent_any": same as "any", but all subsequent daughter lineages of the same progenitor will converge to the state of the first daughter at the time of its origin; "convergent_other": same as "other", but all subsequent daughter lineages will converge to the state of the first daughter at the time of its origin. This parameter is ignored if 'cladogenetic_change = "none"'.

cladogenetic_prob

a number between 0.0 and 1.0 . It is the probability that a budding speciation will be followed by a cladogenetic change dependent on the parameters "cladogenetic_change" and "cladogenetic_state". By default all budding events, if present, are followed by a cladogenetic change (i.e., value of 1.0).

Value

A list with simmap, tip_state, edge_state, ancestry, rate_scaler, and scaler_mat.


Caetanods/buddPhy documentation built on Oct. 12, 2021, 12:14 p.m.