1 ## delta.plot.R (2010-01-12)
5 ## Copyright 2010 Emmanuel Paradis
7 ## This file is part of the R-package `ape'.
8 ## See the file ../COPYING for licensing issues.
10 delta.plot <- function(X, k = 20, plot = TRUE, which = 1:2)
12 if (is.matrix(X)) X <- as.dist(X)
14 if (n < 4) stop("need at least 4 observations")
16 ## add a category for the cases delta = 1
17 ans <- .C("delta_plot", as.double(X), as.integer(n),
18 as.integer(k), integer(k + 1), double(n),
19 NAOK = TRUE, DUP = FALSE, PACKAGE = "ape")
21 ## add the counts of delta=1 to the last category:
22 counts[k] <- counts[k] + counts[k + 1]
23 counts <- counts[-(k + 1)]
25 delta.bar <- ans[[5]]/choose(n - 1, 3)
28 if (length(which) == 2) layout(matrix(1:2, 1, 2))
30 barplot(counts, space = 0, xlab = expression(delta[q]))
32 axis(1, at = a, labels = a/k)
35 plot(delta.bar, type = "h", ylab = expression(bar(delta)))
38 invisible(list(counts = counts, delta.bar = delta.bar))