Skip to contents

Function to find best model for ancestral state reconstruction using corHMM.

Usage

find_best_asr_model(
  df,
  tr,
  tip_name_variable,
  trait,
  node_states = "joint",
  upper_bound = 1e+50,
  lower_bound = 1e-09
)

Arguments

df

Dataframe with tip name (e.g., tip_name_variable) and phenotype/trait (e.g., trait) variables

tr

Phylogeny object of class "phylo"

tip_name_variable

Name of variable containing tip names in the dataframe (df). Tip name variable must correspond to tip names in the tree.

trait

Name of phenotype/trait variable in the dataframe (df).

node_states

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

upper_bound

Upper bound for likelihood search. Default: 1e50

lower_bound

Lower bound for likelihood search. Default: 1e-9

Value

model_statistics

Dataframe with summary of model options

best_model

Character string indicating best model (i.e., "ER" or "ARD)

node_states

Characetr string whether "joint" or "marginal" reconstruction was performed

corHMM_output_best_model

corHMM output for best model