rbinTrait {phylolm}R Documentation

Binary trait simulation

Description

Simulates a binary trait along a phylogeny, according to the model in Ives and Garland (2010).

Usage

rbinTrait(n=1, phy, beta, alpha, X = NULL, model = c("LogReg"))

Arguments

n

number of independent replicates.

phy

a phylogenetic tree of type phylo with brach lengths.

beta

a vector of coefficients for the logistic regression model.

alpha

the phylogenetic correlation parameter.

X

a design matrix with one row for each tip in the phylogenetic tree.

model

Currently, only phylogenetic logistic regression is implemented.

Value

If n=1, a numeric vector of 0-1 values 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.

Note

In the absence of a design matrix X, a single intercept is used. In this case beta should be a vector of length one and the model reduces to a 2-state Markov process on the tree with stationary mean e^\beta/(1+e^\beta). If a design matrix X is provided, the length of beta should be equal to the number of columns in X.

Author(s)

Lam Si Tung Ho and C. An?

References

Ives, A. R. and T. Garland, Jr. 2010. "Phylogenetic logistic regression for binary dependent variables". Systematic Biology 59:9-26.

See Also

rTrait.

Examples

tre = rtree(50)
x = rTrait(n=1,phy=tre)
X = cbind(rep(1,50),x)
y = rbinTrait(n=1, phy=tre, beta=c(-1,0.5), alpha=1, X=X)

[Package phylolm version 2.6.2 Index]