Description Usage Arguments Value References Examples

View source: R/sim.trait.values.R

Fossil recovery rates or other parameter values can be simulated for a phylo (`tree`

) or taxonomy (`taxonomy`

) object,
under an "autocorrelated" or "independent" trait values model.
Under the `autocorrelated`

model, trait values evolve along lineages according to a Brownian motion process, where the strength of the relationship between ancestor and descendant values is determined by the parameter *ν* (`v`

).
If *ν* is small values will be more similar between ancestor and descendants, and if *ν* is zero all trait values will be equal.
For a given species *i* with ancestor *j*, a new trait value *κ_i* is drawn from a lognormal distribution with

*κ_i ~ LN( ln([κ_j] - (σ^2/2), σ)*

where *σ = ν * t_i* and *t_i* is the lineage duration of the species.
This fossil recovery model is described in Heath et al. (2014) and is equivalent to the autocorrelated relaxed clock model described in Kishino et al. (2001).
Under the `independent`

model a new trait value is drawn for each species from any valid user-specified distribution (`dist`

).
`change.pr`

is the probability that a trait value will change at each speciation event.
If `change.pr = 1`

trait values will be updated at every speciation events.

1 2 3 4 5 6 7 8 9 10 |

`init` |
Initial value at the origin or root of the phylo or taxonomy object. Default = 1. |

`tree` |
Phylo object. |

`taxonomy` |
Taxonomy object. |

`root.edge` |
If TRUE include the root edge. Default = TRUE. |

`model` |
Model used to simulate rate variation across lineages. Options include "autocorrelated" (default) or "independent". |

`v` |
Brownian motion parameter |

`dist` |
Distribution of trait values used to draw new values under the "independent" model. This parameter is ignored if |

`change.pr` |
Probability that trait values change at speciation events. Default = 1. |

A vector of parameter values.
Values are output for each species in the order in which they appear in the taxonomy object (if taxonomy was provided) or for each edge in the order in which they appear in the tree object.
If the tree object has a root edge (`root.edge`

), the first entry in the vector will correspond to this edge.

Heath et al. 2014. The fossilized birth-death process for coherent calibration of divergence-time estimates. PNAS 111:E2957-E2966.

Kishino et al. 2001. Performance of a divergence time estimation method under a probabilistic model of rate evolution MBE 18:352-361.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | ```
# simulate tree
t = ape::rtree(6)
# simulate taxonomy
s = sim.taxonomy(t, 0.5, 1, 0.5)
# simulate rates under the autocorrelated trait values model
rate = 2
rates = sim.trait.values(rate, taxonomy = s, v = 1)
f = sim.fossils.poisson(rates, taxonomy = s)
plot(f, t)
# simulate rates under the independent trait values model
dist = function() { rlnorm(1, log(rate), 1) }
rates = sim.trait.values(rate, taxonomy = s, model = "independent", dist = dist)
f = sim.fossils.poisson(rates, taxonomy = s)
plot(f, t)
# simulate rates under the independent trait values model with infrequent changes
rates = sim.trait.values(rate, taxonomy = s, model = "independent",
dist = dist, change.pr = 0.1)
f = sim.fossils.poisson(rates, taxonomy = s)
plot(f, t)
``` |

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.