Learn R Programming

geiger (version 0.2-5)

sim.char: Simulate character evolution

Description

Simulates evolution of discrete or continuous characters on a phylogenetic tree

Usage

sim.char(phy, model.matrix, nsims = 1, model = "brownian", root.state = 1)

Arguments

phy
Phylogenetic tree
model.matrix
Matrix describing model: either vcv matrix or q matrix
nsims
Number of simulations to run
model
"brownian", "speciational", or "discrete"
root.state
Starting state at root

Value

  • Array of simulated data

Examples

Run this code
data(geospiza)
attach(geospiza) 

# Multivariage continuous
drop.tip(geospiza.tree, "olivacea")->g.tree


s<-ic.sigma(g.tree, geospiza.data)
sims<-sim.char(g.tree, s, 100)

# Discrete character evolution
q<-list(rbind(c(-.01, .01), c(.01, -.01)))
sims<-sim.char(geospiza.tree, q, model="discrete", n=100)

Run the code above in your browser using DataLab