sim.curves: Simulate function-valued curve evolution

Description Usage Arguments Value References Examples

View source: R/phylocurve.R

Description

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

Usage

1
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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
# 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)

phylocurve documentation built on Dec. 16, 2019, 1:35 a.m.