ivy.contrasts module

Calculate independent contrasts

TODO: include utilities for transforming data, etc.

ivy.contrasts.PIC(node, data, results=None)[source]

Phylogenetic independent contrasts.

Recursively calculate independent contrasts of a bifurcating node given a dictionary of trait values.

Parameters:
  • node (Node) – A node object
  • data (dict) – Mapping of leaf names to character values
Returns:

Mapping of internal nodes to tuples containing ancestral

state, its variance (error), the contrast, and the contrasts’s variance.

Return type:

dict

TODO: modify to accommodate polytomies.