Learn R Programming

phylolm (version 2.1)

rbinTrait: 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.

encoding

utf-8

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(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)

Run the code above in your browser using DataLab