Simulates and calculates statistics for various continuous characters on trees.
Phylogenetic Independent Contrasts.
References:
- Felsenstein, J. 1985. Phylogenies and the comparative method. American
- Naturalist 125:1-15.
- Garland, T., Jr., Jr., A. F. Bennett, and E. L. Rezende. 2005.
- Phylogenetic approaches in comparative physiology. Journal of Experimental Biology 208:3015-3035.
Arguments:
- tree
- Tree to use
- char_matrix
- ContinuousCharacterMatrix that is the source of the data
- polytomy_strategy
One of: ‘error’, ‘ignore’, ‘resolve’:
- ‘error’
- throws an error if tree has polytomies
- ‘ignore’
- no error, but raw contrasts will not be calculated for polytomies
- ‘resolve’
- will be arbitarily-resolved with 0-length branches
Defaults to ‘error’ if not specified or set to None.
Returns a Tree object annotated with the following attributes added to each node (as annotations to be serialized if annotate_pic_statistics is True):
- pic_state_value
- pic_state_variance
- pic_contrast_raw
- pic_contrast_variance
- pic_contrast_standardized
- pic_edge_length_error
- pic_corrected_edge_length
This tree will have an attribute added to each node, pic. This attribute will be a dictionary with character (column) index as keys. Each column index will map to another dictionary that has the following keys (and values):
- pic_state_value
- pic_state_variance
- pic_contrast_raw
- pic_contrast_variance
- pic_contrast_standardized
- pic_edge_length_error
- pic_corrected_edge_length
Returns the value of variable and its mean value over a path. We assume that some variable started at start_x and moved toward x, but has to bounce of barriers specified by min_x and max_x.
x determines the direction and magnitude of the change.
start_x must fall in the legal range (between the min and max). If x is also legal, then (x, (x + start_x)/2.0) will be returned reflecting the fact that the arithmetic mean of the endpoints represents the mean value of the variable if it took a direct path (at constant rate).
Takes a node and a random number generator object, rng This function “evolves” a set of rates on the subtree descending from the node.
kwargs keys that are used are:
Currently the only model supported is the one of Kishino, Thorne, and Bruno. “Performance of a Divergence Time Estimation Method under a Probabilistic Model of Rate Evolution.” Molecular Biology and Evolution (2001) vol. 18 (3) pp. 352-361. This model is specified by the code “KTB”. A node’s rate is a log-normal variate with variance determined by the product of the duration of the branch and the roeotroe parameter. The mean of the distribution is chosen such that mean of the log-normal is identical to the rate at the parent. The mean_rate for the branch is the average of the rates at the endpoints.