This document intends to display a feature of the nLTT package: if a stem is added to a phylogeny, the begin of that stem is set as the most recent common ancestor.
Here I create a random phylogeny:
set.seed(42) <- ape::rcoal(2) tree1 $edge.length <- tree1$edge.length / tree1$edge.length # nolint ape variable nametree1
I copy that same phylogeny and add a stem:
<- tree1 tree2 $root.edge <- 1 # nolint ape variable nametree2
Here is how the stemless phylogeny looks like:
::plot.phylo(tree1, root.edge = TRUE) ape::add.scale.bar() #nolintape
TRUE, just show it is absent.
Here is how the phylogeny with stem looks like:
::plot.phylo(tree2, root.edge = TRUE) ape::add.scale.bar() #nolintape
When overlaying their nLTT plots, one can expect two things:
The nLTT package does the latter:
::nltt_plot(tree1, xlim = c(0, 1), ylim = c(0, 1)) nLTT::nltt_lines(tree2, col = "red")nLTT
When looking at the nLTT plot, one can eyeball that the nLTT statistic (the surface between the two curves) is around about one quarter.
When calculating the nLTT statistic, one needs to explicitly set to take the stems into account:
print(nLTT::nLTTstat_exact(tree1, tree2, ignore_stem = FALSE))
##  0.25
When ignoring the stems, the phylogenies are equal, thus have an nLTT statistic of zero:
print(nLTT::nLTTstat_exact(tree1, tree2, ignore_stem = TRUE))
##  0