Skip to contents

Function to generate an annotated edge matrix with ancestral and tip states

Usage

get_parent_child_data(
  tr,
  ancestral_states,
  trait_data,
  node_states,
  confidence_threshold = NULL
)

Arguments

tr

Phylogeny object of class "phylo"

ancestral_states

Ancestral states inferred by corHMM. Stored in corHMM_obj$states

trait_data

Named phenotype/trait string. Strings' values correspond to the tip states. Strings' names correspond to the tip names.

node_states

Perform "joint" or "marginal" reconstruction. Default: joint

confidence_threshold

The confidence threshold to categorize ancestral state inferences from a marginal reconstruction.We suggest using a value of 0.5 (i.e., winner takes all), but permit modification to elevated values. Required when node_states == "marginal". If the MLE estimate does not fit under or above the threshold, the node's prediction is 'unsure' and labeled as 0.5.

Value

Dataframe with ancestral and tip states

parent

The upstream node of the child

child

The downstream node of the parent

parent_value

Trait value at the parental node

child_value

Trait value at the child node

child_name

Character string specifying the name of the child, if it is at the tip.