# Efficient Phylogenetics on Large Trees

## Documentation for package ‘castor’ version 1.3

- DESCRIPTION file.

## Help Pages

castor-package | Efficient computations on large phylogenetic trees.
asr_empirical_probabilities | Empirical ancestral state probabilities.
asr_independent_contrasts | Ancestral state reconstruction via phylogenetic independent contrasts.
asr_max_parsimony | Maximum-parsimony ancestral state reconstruction.
asr_mk_model | Ancestral state reconstruction with Mk models and rerooting
asr_squared_change_parsimony | Squared-change parsimony ancestral state reconstruction.
castor | Efficient computations on large phylogenetic trees.
collapse_monofurcations | Remove monofurcations from a tree.
collapse_tree_at_resolution | Collapse nodes of a tree at a phylogenetic resolution.
count_clades_over_time | Count number of clades over time.
count_tips_per_node | Count descending tips.
exponentiate_matrix | Exponentiate a matrix.
extend_tree_to_height | Extend a rooted tree up to a specific height.
find_farthest_tips | Find farthest tip to each tip & node of a tree.
find_nearest_tips | Find nearest tip to each tip & node of a tree.
find_root | Find the root of a tree.
find_root_of_monophyletic_tips | Find the node or tip that, as root, would make a set of target tips monophyletic.
fit_bm_model | Fit a Brownian motion model for multivariate trait evolution.
fit_tree_model | Fit a cladogenic model to an existing tree.
generate_random_tree | Generate a tree using a Poissonian speciation/extinction model.
generate_tree_with_evolving_rates | Generate a random tree with birth/death rates evolving under Brownian motion.
get_all_distances_to_root | Get distances of all tips and nodes to the root.
get_all_node_depths | Get the phylogenetic depth of each node in a tree.
get_independent_contrasts | Phylogenetic independent contrasts for continuous traits.
get_mrca_of_set | Most recent common ancestor of a set of tips/nodes.
get_pairwise_distances | Get distances between pairs of tips or nodes.
get_pairwise_mrcas | Get most recent common ancestors of tip/node pairs.
get_random_diffusivity_matrix | Create a random diffusivity matrix for a Brownian motion model.
get_random_mk_transition_matrix | Create a random transition matrix for an Mk model.
get_stationary_distribution | Stationary distribution of Markov transition matrix.
get_subtree_at_node | Extract a subtree descending from a specific node.
get_subtree_with_tips | Extract a subtree spanning a specific subset of tips.
get_tips_for_mrcas | Find tips with specific most recent common ancestors.
get_trait_acf | Phylogenetic autocorrelation function of a numeric trait.
get_trait_depth | Calculate depth of phylogenetic conservatism for a binary trait.
get_trait_stats_over_time | Calculate mean & standard deviation of a numeric trait on a dated tree over time.
get_tree_span | Get min and max distance of any tip to the root.
get_tree_traversal_root_to_tips | Traverse tree from root to tips.
hsp_empirical_probabilities | Hidden state prediction via empirical probabilities.
hsp_independent_contrasts | Hidden state prediction via phylogenetic independent contrasts.
hsp_max_parsimony | Hidden state prediction via maximum parsimony.
hsp_mk_model | Hidden state prediction with Mk models and rerooting
hsp_squared_change_parsimony | Hidden state prediction via squared-change parsimony.
is_monophyletic | Determine if a set of tips is monophyletic.
map_to_state_space | Map states of a discrete trait to integers.
merge_short_edges | Eliminate short edges in a tree by merging nodes into multifurcations.
multifurcations_to_bifurcations | Expand multifurcations to bifurcations.
pick_random_tips | Pick random subsets of tips on a tree.
reconstruct_past_diversification | Reconstruct past diversification dynamics from a diversity time series.
reorder_tree_edges | Reorder tree edges in preorder or postorder.
root_at_midpoint | Root or re-root a tree at the midpoint node.
root_at_node | Root or re-root a tree at a specific node.
root_in_edge | Root or re-root a tree in the middle of an edge.
root_via_outgroup | Root or re-root a tree based on an outgroup tip.
simulate_bm_model | Simulate a Brownian motion model for multivariate trait co-evolution.
simulate_diversification_model | Simulate a speciation/extinction model.
simulate_mk_model | Simulate an Mk model for discrete trait evolution.
simulate_ou_model | Simulate an Ornstein-Uhlenbeck model for continuous trait evolution.
simulate_rou_model | Simulate a reflected Ornstein-Uhlenbeck model for continuous trait evolution.
trim_tree_at_height | Trim a rooted tree down to a specific height.
write_tree | Write a tree in Newick (parenthetic) format.