Learn R Programming

phylolm (version 2.0)

rbinTrait: Binary trait simulation

Description

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

Usage

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

Arguments

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

  • a numeric vector of 0-1 values with names from the tip labels in the tree.

encoding

latin1

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

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

Run the code above in your browser using DataLab