See vignette('analyze_output') for more details.
Arguments
- tr
Rooted phylogeny
- timepoints
Factor vector of time points named by tree tip label. The levels should be ordered correctly (most often by sampling time). All tip lables must be included in this vector. If you want to exclude certain tips, you must drop them from the tree prior to using this function.
- bl_thresh
Branch length threshold under which branches are collapsed to prior to calculations (default: 1e-08). This is the
tolargument inape::di2multi().
Value
Tibble including tree summary statistics:
Mean leaf depth (normalized Sackin index)
Mean branch length
Mean internal branch length
Mean external branch length
Mean divergence (mean per-generation root-to-tip distance)
Mean diversity (mean per-generation tip-to-tip distance)
Divergence slope across timepoints
Diversity slope across timepoints
Mean number of lineages through time
Examples
tr <- ape::rtree(100)
times <- factor(sample(3, 100, replace = TRUE), levels = 1:3)
names(times) <- tr$tip.label
calc_tr_stats(tr, times)
#> # A tibble: 9 × 2
#> stat_name stat_value
#> <chr> <dbl>
#> 1 mean_leaf_depth 8.37
#> 2 mean_bl 0.527
#> 3 mean_int_bl 0.548
#> 4 mean_ext_bl 0.506
#> 5 mean_divergence 4.74
#> 6 mean_diversity 7.65
#> 7 divergence_slope 0.288
#> 8 diversity_slope 0.429
#> 9 mean_ltt 22.5
