Sim_FPK: Simulation of the BBM+V process.

Description Usage Arguments Value Author(s) Examples

View source: R/Sim_FPK.R

Description

The function simulates a continuous trait evolving according to the FPK process along the branches of a phylogenetic tree.

Usage

1
Sim_FPK(tree, x0 = 0, V = rep(0, 100), sigma, bounds)

Arguments

tree

A phylogenetic tree in phylo format.

x0

The value of the trait at the root of the tree.

V

A vector giving the values of the evolutionary potential at each point of the discretized trait grid. Default is a flat potential, i.e. bounded Brownian Motion.

sigma

The square root of the diffusion rate.

bounds

A vector giving the values of the bounds of the trait interval.

Value

A numeric vector with values of the trait at the tips of the tree. Names correspond to tip labels in the tree.

Author(s)

F. C. Boucher

Examples

1
2
3
4
5
6
# Simulate data: tree + continuous trait
library(geiger)
tree=sim.bdtree(stop='taxa',n=20) # tree with few tips for quick tests
tree$edge.length=100*tree$edge.length/max(branching.times(tree)) # rescale the tree
# Simulate a trait evolving on the tree with a linear trend towards small values
TRAIT= Sim_FPK(tree,x0=0,V=seq(from=0,to=5,length.out=50),sigma=10,bounds=c(-5, 5)) 

BBMV documentation built on Nov. 17, 2017, 7:02 a.m.