Description Usage Arguments Details Value Note Author(s) References See Also Examples
View source: R/BioGeoBEARS_simulate_v1.R
This function simulates a biogeographical history, given a Q transition matrix, a starting state, and a branch length. All this involves is exponentiating the Q transition matrix, producing a P transition probability matrix, and then producing a random draw from this P matrix, conditional on the ancestor.
1 2 | given_a_starting_state_simulate_branch_end(index_Qmat_0based_of_starting_state = 1,
Qmat, branchlength = 1, all_tips_living = TRUE)
|
index_Qmat_0based_of_starting_state |
An integer
index value, between 0 and |
Qmat |
A (square, dense) Q transition matrix. Using a sparse matrix would require writing another function. |
branchlength |
The length of the branch, or branch segment if you are dealing with a stratified phylogeny. |
all_tips_living |
Currently this is the only assumption. If, hypothetically, you had a phylogeny with extinct tips (representing the ends of the ranges of fossil taxa), you might want to treat them differently, IF you think that the time-invariant geographic range addition/subtraction process is the same one that made lineages go extinct (it could be something else, e.g. mass extinction). False attribution of extinctions to the range loss process will dramatically elevate the rate of range loss, and also range expansion to compensate, and the resulting high rates can substantially degrade inference (Matzke_Maguire_2011_SVP). |
This could be sped up in various ways, if needed.
state_desc
0-based index of the descendant state
(just before cladogenesis, if below a node).
Go BEARS!
Nicholas J. Matzke matzke@berkeley.edu
http://phylo.wikidot.com/matzke-2013-international-biogeography-society-poster https://code.google.com/p/lagrange/
Matzke_2012_IBS
Matzke_Maguire_2011_SVP
rcpp_calc_anclikes_sp_COOweights_faster
1 | testval=1
|
Loading required package: rexpokit
Loading required package: cladoRcpp
Loading required package: ape
Loading required package: phylobase
Attaching package: 'phylobase'
The following object is masked from 'package:ape':
edges
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.