Learn R Programming

BBMV (version 2.1)

get.landscape.FPK: Plot macroevolutionary landscapes estimated by the FPK or BBM+V models

Description

Plots a line representing the adaptive landscape estimated in a BBM+V or an FPK model.

Usage

get.landscape.FPK(fit, Npts = 100, main = "Macroevolutionary landscape"
  , ylab = "N.exp(-V)", xlab = "Trait", xlim = NULL, ylim = NULL)
add.ML.landscape.FPK(fit,Npts=100,COLOR=1,LTY='dashed')

Arguments

fit

An FPK model fit, as returned by find.mle_FPK.

Npts

The number of points used to discretize the trait interval for plotting.

main

Title for the plot.

ylim

The upper limit of the plotting region when multiple adaptive landscapes are plotted together.

xlim

The limits of thex-axis.

ylab

Label of the y-axis.

xlab

Label of the x-axis.

COLOR

The color of the line when added to a plot of the posterior of a MCMC run.

LTY

The type of the line when added to a plot of the posterior of a MCMC run.

Value

A plot of the adaptive landscape across the trait interval.

Examples

Run this code
# NOT RUN {
# Simulate data: tree + continuous trait
library(geiger)
tree=sim.bdtree(stop='taxa',n=10) # tree with few tips for quick tests
tree$edge.length=100*tree$edge.length/max(branching.times(tree)) # rescale the tree 
# Simulate trait evolving on a macroevolutionary landscape with two peaks of equal heights
x=seq(from=-1.5,to=1.5,length.out=100)
bounds=c(min(x),max(x)) # the bounds we use for simulating
V6=10*(x^4-0.5*(x^2)+0.*x) # this is the evolutionary potential: it has two wells
TRAIT= Sim_FPK(tree,x0=0,V=V6,sigma=10,bounds=c(-5, 5)) 
# fit the FPK model: 
ll_FPK4=lnL_FPK(tree,TRAIT,Npts=25,a=NULL,b=NULL,c=NULL) # the full model
fit4=find.mle_FPK(model=ll_FPK4)
# Plot the landscape estimated
get.landscape.FPK(fit=fit4)
# }
# NOT RUN {
# }

Run the code above in your browser using DataLab