View source: R/simcharacter.R
sim.character  R Documentation 
Simulate a character distribution (state of each species) under some simple models of trait evolution. Currently this does not return the full history (node states, and state changes) but this may be added in a future version.
sim.character(tree, pars, x0=0, model="bm", br=NULL)
make.sim.character(tree, pars, model="bm", br=NULL)
tree 
A bifurcating phylogenetic tree, in 
pars 
A set of model parameters (see Details below), as the order and interpretation depends on the model. 
x0 
Root state. The default is zero, which may not make sense in all models. 
model 
Character string specifying which model to evolve the
character under. Possible values are 
br 
For cases where none of the models specifiable through the

This function duplicates functionality in other packages; see
sim.char
in geiger
in particular. The main difference
here is that for continuous characters, this does not use the
variancecovariance matrix, which can make it much faster for very
large trees. I believe that this approach is similar to fastBM
in phytools
.
model="bm"
: Brownian Motion. Takes a single
parameter, representing the rate of diffusion (must be positive)
model="ou"
: OrnsteinUhlenbeck process. Takes a vector
of three parameters, representing the rate of diffusion, strength of
restoring force, and the "optimum" value. The first two parameters
must be nonnegative, and the rate of diffusion must be positive.
model="bbm"
: Bounded Brownian Motion. Takes a vector
of three parameters (s2
, c
, d
), representing
the rate of diffusion, lower and upper bound, respectively. The
rate of diffusion must be positive.
model="mk"
: Mk model (see make.mkn
). Takes a Q
matrix as its argument. The element Q[i,j]
represents the
rate of transition from state i
to state j
, and the
diagonal elements must be such that rowSums(Q)
is zero.
model="meristic"
: A special case of the Mk model, where the
trait is meristic and character transitions are only possible
between adjacent states. There are three parameters (k
,
up
, down
), representing the number of states, and rate
of character change up (from state i
to i+1
) and down.
Richard G. FitzJohn
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.