Learn R Programming

phylocurve (version 2.1.1)

sim.curves: Simulate function-valued curve evolution

Description

This function simulates evolution of a function-valued trait (glm with logit link) under Brownian motion.

Usage

sim.curves(nspecies = 30, x_length = 20, startree = FALSE, lambda = 1, seed)

Arguments

nspecies

Number of species

x_length

Number of points on the curve to simulate

startree

Simulate using a star tree

lambda

Pagel's lambda tree transformation parameter (lambda = 0 for star tree; lambda = 1 for original tree)

seed

Optional seed to set for reproducibility

Value

data

Data frame with simulated curves formatted appropriately for phylocurve()

tree

Phylogenetic tree of class "phylo"

true_coefs

True tip and ancestral coefficients for glm logit link

References

Pagel, M. 1999. "Inferring the historical patterns of biological evolution". Nature 401:877-884.

Examples

Run this code
# NOT RUN {
# simulate evolution of a function-valued trait (glm with logit link)
sim_data <- sim.curves()

# perform ancestral curve reconstruction
anc_recon <- phylocurve(y~x,tree = sim_data$tree,data = sim_data$data)

# get tip coefficients and aligned function data
tip.coefficients <- get.tip.coefficients(formula = y~x,tree = sim_data$tree,data = sim_data$data)
data <- get.aligned.function.data(tip.coefficients)

# estimate evolutionary rates
evo.model.fitted <- evo.model(sim_data$tree,data)
# }

Run the code above in your browser using DataLab