Learn R Programming

Rphylopars (version 0.2.9)

simtraits: Simulate traits for phylopars estimation

Description

Simulates traits for codephylopars estimation.

Usage

simtraits(ntaxa = 15, ntraits = 4, nreps = 1, nmissing = 0, tree, v, anc, intraspecific, model="BM", parameters, nsim, return.type="data.frame")

Arguments

ntaxa
Either number of taxa (ntaxa) or a tree can be supplied.
ntraits
Number of traits to be simulated.
nreps
Number of replicates per trait per species to simulate.
nmissing
Number of randomly missing trait values.
tree
Either number of taxa (ntaxa) or a tree can be supplied.
v
Trait covariance (v) can be optionally supplied; otherwise off-diagonal elements are set to 0.8.
anc
Value for ancestral state at root node.
intraspecific
Optional value for within-species variance.
model
Model of evolution (default="BM"). Other options include "OUfixedRoot", "OUrandomRoot", "lambda", "kappa", "delta", "EB".
parameters
List of parameters for the model. alpha for the selection strength in the OU model, lambda, kappa, delta, or rate for the EB model.
nsim
Number of simulations to perform (default is 1)
return.type
Default is "data.frame". Can also specify "matrix" if nreps=1.

Value

trait_data
Data for phylopars()
tree
The original phylogenetic tree (either provided to the function or generated internally)
sim_tree
The transformed tree on which trait simulations were performed (identical to tree if model="BM")
original_X
If within-species variation is simulated, original_X is the original species mean values before adding within-species variation.

References

Bruggeman J, Heringa J and Brandt BW. (2009) PhyloPars: estimation of missing parameter values using phylogeny. Nucleic Acids Research 37: W179-W184.

Harmon Luke J, Jason T Weir, Chad D Brock, Richard E Glor, and Wendell Challenger. 2008. GEIGER: investigating evolutionary radiations. Bioinformatics 24:129-131.

Examples

Run this code
# simulate data
sim_data <- simtraits(ntaxa = 15,ntraits = 4,nreps = 3,nmissing = 10)

# estimate parameters under Brownian motion
# pheno_error = TRUE assumes intraspecific variation
# pheno_correlated = FALSE assumes intraspecific variation is not correlated
# phylo_correlated = TRUE assumed traits are correlated

PPE <- phylopars(trait_data = sim_data$trait_data,tree = sim_data$tree,
  pheno_error = TRUE,phylo_correlated = TRUE,pheno_correlated = FALSE)

PPE

Run the code above in your browser using DataLab