library('TreeDistData')
origPar <- par()

# Obtain values from TreeDistData documentation
nTrees <- 50
nLeaves <- 40
replicates <- 500L

data(linTestOneResults, package = 'TreeDistData')
data(linTestTwoResults, package = 'TreeDistData')
data(linTestSPRResults, package = 'TreeDistData')

withText <- 2.4
yRange <- c(0, 1)
Panel <- function (letter, x, ...) {
  text(x, 1.05, paste0('(', letters[letter], ')'), pos = 2, offset = 0, ...)
}

```{R, echo=FALSE, fig.asp=1.4, fig.width=5, fig.align='center'} PlotFunc <- function () { par(mfrow = c(2, 2), mar = c(withText, withText, 1, 0), xpd = NA, mgp = c(withText - 1L, 0.5, 0), cex = 0.8)

x <- seq(30, 70, 10) plot(type = 'n', range(x) - c(5, 0), yRange, axes = FALSE, ylab = 'Success rate', xlab = '% leaves in skeleton') axis(1, x) yLab <- seq(0, 1, length.out = 5) axis(2, yLab) scores <- colMeans(linTestOneResults) / replicates methods <- rownames(scores) XX <- lapply(methods, function (method) { lines(x, scores[method, ], col = TreeDistCol(method), lwd = 2, lty = 1) }) Panel(1, min(x))

par(mar = c(withText, 1, 1, 0))

x <- seq(10, 40, 10) / 100 * nLeaves plot(type = 'n', range(x), yRange, axes = FALSE, ylab = '', xlab = 'Leaf label interchanges') axis(1, x) axis(2, at = yLab, labels = rep('', 5)) scores <- colMeans(linTestTwoResults) / replicates methods <- rownames(scores) XX <- lapply(methods, function (method) { lines(x, scores[method, ], col = TreeDistCol(method), lwd = 2, lty = 1) })

Panel(2, min(x))

par(mar = c(withText, withText, 1, 0), xpd = NA) x <- seq(20, 100, 20) / 100 * nLeaves plot(type = 'n', range(x), yRange, axes = FALSE, ylab = 'Success rate', xlab = 'Subtree prune & regraft operations') axis(1, x) yLab <- seq(0, 1, length.out = 5) axis(2, yLab) scores <- colMeans(linTestSPRResults) / replicates XX <- lapply(rownames(scores), function (method) { lines(x, scores[method, ], col = TreeDistCol(method), lwd = 2, lty = 1) }) Panel(3, min(x))

par(mar = c(0, 0, 0, 0)) plot.new() legend('right', tdAbbrevs[tdPlotSequence], bty = 'n', lwd = 2, lty = 1, cex = 0.9, col = TreeDistCol(tdPlotSequence)) }

PlotFunc() suppressWarnings(par(origPar))

**Figure 2.** Cluster recovery results. Successful cluster recovery rate for each tree distance metric under (a), test one: add 40 – _k_ leaves to two _k_-leaf skeletons; (b), test two: conduct _k_ LLI operations on two 40-leaf skeletons; (c), test three: conduct _k_ SPR operations on two 40-leaf skeletons.

## Rankings

Rankings were calculated for each value of _k_ and each clustering method, using lowest
value in ties.  The table reports the average ranking for all values of _k_ and all clustering
methods for each test.

```r
x <- seq(30, 70, 10)
tm <- 'average'
ranks <- cbind(
  rowMeans(apply(-linTestOneResults, c(1, 3), rank, ties.method = tm)),
  rowMeans(apply(-linTestTwoResults, c(1, 3), rank, ties.method = tm)),
  rowMeans(apply(-linTestSPRResults, c(1, 3), rank, ties.method = tm)))

dimnames(ranks) <- list(tdMdAbbrevs[rownames(ranks)],
                        paste('Test', c('one', 'two', 'three')))
ranks <- cbind(ranks, 'Mean rank' = round(rowMeans(ranks), 2))
ranks <- ranks[order(ranks[, 'Mean rank']), ]

.TDDTable(DT::datatable, ranks)


ms609/TreeDistData documentation built on May 21, 2021, 6:53 a.m.