Learn R Programming

cauphy (version 1.0.3)

rTraitCauchy: Cauchy Trait Simulation

Description

Simulate a continuous trait using the Cauchy Process

Usage

rTraitCauchy(
  n = 1,
  phy,
  model = c("cauchy", "lambda", "kappa", "delta"),
  parameters = NULL
)

Value

If n=1, a numeric vector with names from the tip labels in the tree. For more than 1 replicate, a matrix with the tip labels as row names, and one column per replicate.

Arguments

n

number of independent replicates

phy

a phylogeny in ape phylo format.

model

a phylogenetic model. Default is "cauchy", for the Cauchy process. Alternative are "lambda", "kappa", and "delta".

parameters

list of parameters for the model (see Details).

Details

The default choice of parameters is as follow:

model = cauchy

root.value = 0, disp = 1

model = lambda

root.value = 0, disp = 1, lambda = 1

model = kappa

root.value = 0, disp = 1, kappa = 1

model = delta

root.value = 0, disp = 1, delta = 1

See Also

rTrait, rTraitCont

Examples

Run this code
set.seed(1289)
phy <- ape::rphylo(40, 0.01, 0)
# One trait
y <- rTraitCauchy(n = 1, phy = phy, model = "cauchy",
                  parameters = list(root.value = 0, disp = 0.1))
y
plot(phy, x.lim = c(0, 750))
phydataplot(y, phy, offset = 150)
# Many trait
y <- rTraitCauchy(n = 10, phy = phy, model = "cauchy",
                  parameters = list(root.value = 0, disp = 0.1))
head(y)


Run the code above in your browser using DataLab