Learn R Programming

phytools (version 0.7-70)

ratebystate: Method for investigating the rate of one trait as a function of the state of another

Description

This function attempts to ask if the rate of a continuous character, y, depends on the state of a separate continuous trait, x. This is accomplished by regressing the squared contrasts in y on the branch or node ancestral estimates of x.

Usage

ratebystate(tree, x, y, nsim=100, corr=c("pearson","spearman"), ...)

Arguments

tree

phylogenetic tree.

x

a continuous character - the dependent variable in the model.

y

a second continuous trait - the response variable.

nsim

number of simulations for hypothesis testing.

corr

correlation method to use. Same as in cor.

...

optional arguments which include sim.method ("fastBM" or "sim.corrs"; see fastBM and sim.corrs); method ("by.node" or "by.branch" indicating whether to assume the rate varies as a function of the node state or the mean branch state); message - a logical value indicating whether or not to return corr and method; finally logarithm - indicating whether or not to fit a model in which the variance of Brownian evolution in y changes as a multiplicative function of x. The default is logarithm=FALSE.

Value

This function returns an object of class "ratebystate" with up to the following four elements:

beta

value of the regression coefficient for square of the contrasts in y regressed on the ancestral or branch-wise estimated states for x.

r

correlation coefficient for corr=corr.

corr

string giving the value of corr.

method

string giving the value of method.

References

Revell, L. J. (2012) phytools: An R package for phylogenetic comparative biology (and other things). Methods Ecol. Evol., 3, 217-223.

See Also

fastAnc, pic